text
stringlengths
0
15.7k
source
stringlengths
6
112
end getName
References from Bookends.applescript
set referencesCreated to 0
References from Bookends.applescript
set referencesUpdated to 0
References from Bookends.applescript
set referencesUpToDate to 0
References from Bookends.applescript
set theDatabase to open database databaseName
References from Bookends.applescript
if not (exists record at referencesPath) then
References from Bookends.applescript
set theGroup to create location referencesPath in theDatabase
References from Bookends.applescript
set theGroup to get record at referencesPath in theDatabase
References from Bookends.applescript
set citationIds to (dt's getGroupChildrenAsMutableArray(theDatabase, theGroup))
References from Bookends.applescript
set exisitingRecords to children of theGroup
References from Bookends.applescript
tell application "Bookends" to tell front library window to set theRefs to publication items
References from Bookends.applescript
tell application id "DNtp" to set myProgress ¬
References from Bookends.applescript
to show progress indicator "Creating/updating citations..." steps count of theRefs
References from Bookends.applescript
repeat with theRef in theRefs
References from Bookends.applescript
set {theID, modDate} to {id, date modified} of theRef
References from Bookends.applescript
set theUrl to "bookends://sonnysoftware.com/" & theID
References from Bookends.applescript
set nextRecord to ((children in theGroup) whose URL is theUrl)
References from Bookends.applescript
if (count of nextRecord) is not 0 then
References from Bookends.applescript
set nextRecord to item 1 of nextRecord
References from Bookends.applescript
dt's removeFromNSArray(id of nextRecord, citationIds)
References from Bookends.applescript
if modification date of nextRecord = modDate then
References from Bookends.applescript
set referencesUpToDate to referencesUpToDate + 1
References from Bookends.applescript
step progress indicator (name of nextRecord as string)
References from Bookends.applescript
set referencesUpdated to referencesUpdated + 1
References from Bookends.applescript
set referencesCreated to referencesCreated + 1
References from Bookends.applescript
set nextRecord to create record with {content:"", type:rtf} in theGroup
References from Bookends.applescript
set dtUrl to reference URL of nextRecord
References from Bookends.applescript
set URL of nextRecord to theUrl
References from Bookends.applescript
set user20 of theRef to dtUrl & "?reveal=1"
References from Bookends.applescript
set modDate to date modified of theRef
References from Bookends.applescript
set theAttachments to (name of attachment items) of theRef
References from Bookends.applescript
set theCitationText to «event ToySGUID» theID given «class RRTF»:"false", string:referenceFormat
References from Bookends.applescript
if (count of theAttachments) > 0 then
References from Bookends.applescript
set theCitationText to theCitationText & "
References from Bookends.applescript
Attachments:"
References from Bookends.applescript
repeat with theAttachment in theAttachments
References from Bookends.applescript
[[" & theAttachment & "]]"
References from Bookends.applescript
set theTitle to my getName(theRef)
References from Bookends.applescript
step progress indicator theTitle
References from Bookends.applescript
set name of nextRecord to theTitle
References from Bookends.applescript
set rich text of nextRecord to theCitationText
References from Bookends.applescript
set modification date of nextRecord to modDate
References from Bookends.applescript
if moveDeletedToTrash then
References from Bookends.applescript
set citationsMissing to (dt's deleteItemsInNSArray(theDatabase, citationIds))
References from Bookends.applescript
set citationsMissing to citationsMissing & " moved to trash."
References from Bookends.applescript
set citationsMissing to (dt's flagItemsInNSArray(theDatabase, citationIds))
References from Bookends.applescript
set citationsMissing to citationsMissing & " flagged as deleted."
References from Bookends.applescript
log message "Bookends import" info ((referencesCreated as string) & " added, " & (referencesUpdated as string) & " updated, " & referencesUpToDate & " up to date, " & citationsMissing)
References from Bookends.applescript
on error theErrorMessage
References from Bookends.applescript
log message "Bookends import error" info theErrorMessage
References from Bookends.applescript
next track
spotify-setNextTrack.applescript
property showQuickEntry : 1
Outlook2015-2-OmniFocus.scpt
property bringOmnifocusToForeground : 0
Outlook2015-2-OmniFocus.scpt
property attachMailToOFTask : 1
Outlook2015-2-OmniFocus.scpt
property focusSpecificField : 2
Outlook2015-2-OmniFocus.scpt
property deleteMailAfterProcessing : 0
Outlook2015-2-OmniFocus.scpt
property moveMailToFolder : 0
Outlook2015-2-OmniFocus.scpt
property targetMailFolderName : "Archive"
Outlook2015-2-OmniFocus.scpt
set selectedMessages to selected objects -- this will work in smart folders, but need to check if it is a message.
Outlook2015-2-OmniFocus.scpt
display dialog "Please select one or more messages first and then run this script." with icon 1
Outlook2015-2-OmniFocus.scpt
if class of theMessage is incoming message then -- for now just do incoming messages; add other times in the future
Outlook2015-2-OmniFocus.scpt
set theName to subject of theMessage
Outlook2015-2-OmniFocus.scpt
if theName is missing value then
Outlook2015-2-OmniFocus.scpt
set theName to "No Subject"
Outlook2015-2-OmniFocus.scpt
set theContent to content of theMessage
Outlook2015-2-OmniFocus.scpt
set theID to id of theMessage as string
Outlook2015-2-OmniFocus.scpt
set theSender to sender of theMessage
Outlook2015-2-OmniFocus.scpt
set theSenderAddress to "Unknown Sender"
Outlook2015-2-OmniFocus.scpt
set theSenderName to "No Sender Name"
Outlook2015-2-OmniFocus.scpt
set theSenderName to name of theSender
Outlook2015-2-OmniFocus.scpt
set theSenderAddress to address of theSender
Outlook2015-2-OmniFocus.scpt
set msgTime to time sent of theMessage
Outlook2015-2-OmniFocus.scpt
set OmniFocusHeader to linefeed & linefeed & "From: " & theSenderName & " [" & theSenderAddress & "]" & return & "Date: " & msgTime & return & return
Outlook2015-2-OmniFocus.scpt
set theFileName to (POSIX path of (path to home folder as string)) & "Documents/OutlookMsg" & theID & ".eml"
Outlook2015-2-OmniFocus.scpt
if (attachMailToOFTask is 1) then
Outlook2015-2-OmniFocus.scpt
log "saving the file: " & theFileName
Outlook2015-2-OmniFocus.scpt
save theMessage in theFileName
Outlook2015-2-OmniFocus.scpt
set myTxtContent to do shell script ("echo " & (quoted form of theContent) & " |textutil -format html -inputencoding UTF-8 -convert txt -stdin -stdout")
Outlook2015-2-OmniFocus.scpt
set theTxtContent to OmniFocusHeader & linefeed & linefeed & myTxtContent
Outlook2015-2-OmniFocus.scpt
set theDoc to default document
Outlook2015-2-OmniFocus.scpt
set theTask to theName
Outlook2015-2-OmniFocus.scpt
set theNote to theTxtContent
Outlook2015-2-OmniFocus.scpt
if (showQuickEntry is 1) then
Outlook2015-2-OmniFocus.scpt
tell quick entry
Outlook2015-2-OmniFocus.scpt
set NewTask to make new inbox task with properties {name:theTask, note:theTxtContent}
Outlook2015-2-OmniFocus.scpt
tell me to set theAttachment to (POSIX file theFileName)
Outlook2015-2-OmniFocus.scpt
tell the note of NewTask
Outlook2015-2-OmniFocus.scpt
make new file attachment with properties {file name:theAttachment, embedded:true}
Outlook2015-2-OmniFocus.scpt
if (bringOmnifocusToForeground is 1) then
Outlook2015-2-OmniFocus.scpt
repeat focusSpecificField times
Outlook2015-2-OmniFocus.scpt
tell the first document
Outlook2015-2-OmniFocus.scpt
make new file attachment with properties {file name:theFileName, embedded:true}
Outlook2015-2-OmniFocus.scpt
if (deleteMailAfterProcessing is 1) then
Outlook2015-2-OmniFocus.scpt
delete theMessage
Outlook2015-2-OmniFocus.scpt
if (moveMailToFolder is 1) then
Outlook2015-2-OmniFocus.scpt
move theMessage to folder targetMailFolderName
Outlook2015-2-OmniFocus.scpt
do shell script "rm ~/Library/Containers/com.microsoft.Outlook/Data/Documents/OutlookMsg*"
Outlook2015-2-OmniFocus.scpt
log "Error deleting old tmp files " & error_message & " (" & error_number & ")"
Outlook2015-2-OmniFocus.scpt
on findAndReplace(tofind, toreplace, TheString)
Outlook2015-2-OmniFocus.scpt
set ditd to text item delimiters
Outlook2015-2-OmniFocus.scpt