text
stringlengths
0
15.7k
source
stringlengths
6
112
end _gregorianCalendar
lns2.scpt
to _nsTimeZoneForName(timezone, parameterName)
lns2.scpt
if timezone is "current" then
lns2.scpt
return current application's NSTimeZone's localTimeZone()
lns2.scpt
set timezone to _support's asTextParameter(timezone, parameterName)
lns2.scpt
set asocTimeZone to current application's NSTimeZone's timeZoneWithName:timezone
lns2.scpt
if asocTimeZone is missing value then _support's throwInvalidParameter(timezone, parameterName, text, "Unknown time zone name: “" & timezone & "”.")
lns2.scpt
return asocTimeZone
lns2.scpt
end _nsTimeZoneForName
lns2.scpt
to _asNSTimeZoneParameter(timezone, parameterName) -- timeZone may be text (time zone name) or integer (time zone's offset to GMT); result is NSTimeZone instance
lns2.scpt
if (count {timezone} each number) = 1 then
lns2.scpt
return current application's NSTimeZone's timeZoneForSecondsFromGMT:(_support's asIntegerParameter(timezone, parameterName))
lns2.scpt
return _nsTimeZoneForName(timezone, parameterName)
lns2.scpt
end _asNSTimeZoneParameter
lns2.scpt
to _asTimeZoneOffsetParameter(timezone, parameterName) -- timeZone may be text (time zone name) or integer (offset to GMT); result is time zone's offset to GMT; used by `time zone offset`
lns2.scpt
return _support's asIntegerParameter(timezone, parameterName)
lns2.scpt
return _nsTimeZoneForName(timezone, parameterName)'s secondsFromGMT()
lns2.scpt
end _asTimeZoneOffsetParameter
lns2.scpt
set start_time to current date
gistfile1 copy 9.applescript
set pubs_with_link to 0
gistfile1 copy 9.applescript
set num_of_links to 0
gistfile1 copy 9.applescript
set matchingFiles to {}
gistfile1 copy 9.applescript
set matchingKeys to {}
gistfile1 copy 9.applescript
set matchingInds to {}
gistfile1 copy 9.applescript
set recordsForIndex to {}
gistfile1 copy 9.applescript
set unSortedList to {}
gistfile1 copy 9.applescript
set allSelected to true
gistfile1 copy 9.applescript
display dialog "No documents found." giving up after 21
gistfile1 copy 9.applescript
if (count of thePublications) > 0 then
gistfile1 copy 9.applescript
display dialog "Processing selected " & (count of thePublications) & " papers"
gistfile1 copy 9.applescript
set allSelected to false
gistfile1 copy 9.applescript
set thePublications to the publications of document 1
gistfile1 copy 9.applescript
display dialog "Processing all " & (count of thePublications) & " papers"
gistfile1 copy 9.applescript
set papersFolder to papers folder
gistfile1 copy 9.applescript
set citeKeys to {}
gistfile1 copy 9.applescript
set newKey to cite key of thePub
gistfile1 copy 9.applescript
copy newKey to end of citeKeys
gistfile1 copy 9.applescript
set choiceFolder to papersFolder
gistfile1 copy 9.applescript
set filesarein to choiceFolder as string
gistfile1 copy 9.applescript
set fileList to {}
gistfile1 copy 9.applescript
set fileList to (the name of every file of folder (filesarein) whose name is (newKey & ".tex") or name is (newKey & ".ps") or name is (newKey & ".pdf"))
gistfile1 copy 9.applescript
repeat with fileName in fileList
gistfile1 copy 9.applescript
copy (choiceFolder & "/" & fileName) to end of pathList
gistfile1 copy 9.applescript
set baseFolder to papersFolder & "_supplements/"
gistfile1 copy 9.applescript
log ("Set baseFolder to " & baseFolder)
gistfile1 copy 9.applescript
if not (exists folder newKey of ((POSIX file baseFolder) as alias)) then
gistfile1 copy 9.applescript
make new folder at ((POSIX file baseFolder) as alias) with properties {name:newKey}
gistfile1 copy 9.applescript
set choiceFolder to baseFolder & newKey
gistfile1 copy 9.applescript
set fileList to (the name of every file of folder (filesarein) whose name extension is "tex" or name extension is "pdf" or name extension is "ps")
gistfile1 copy 9.applescript
tell thePub
gistfile1 copy 9.applescript
set existingFiles to {}
gistfile1 copy 9.applescript
set ind to 0
gistfile1 copy 9.applescript
set numToRemove to 0
gistfile1 copy 9.applescript
set allLinkedFiles to linked files
gistfile1 copy 9.applescript
set noOfLinkedFiles to count of allLinkedFiles
gistfile1 copy 9.applescript
repeat with lf in linked files
gistfile1 copy 9.applescript
set ind to ind + 1
gistfile1 copy 9.applescript
set dummy to (POSIX path of lf as string)
gistfile1 copy 9.applescript
if (offset of ".Trash" in (POSIX path of lf as string)) > 0 then
gistfile1 copy 9.applescript
display dialog ("Removing " & POSIX path of lf as string) & ": found in system trash"
gistfile1 copy 9.applescript
if (offset of "deleted" in (POSIX path of lf as string)) > 0 then
gistfile1 copy 9.applescript
display dialog ("Removing " & POSIX path of lf as string) & ": was deleted by dropbox"
gistfile1 copy 9.applescript
copy (POSIX path of lf as string) to end of existingFiles
gistfile1 copy 9.applescript
set numToRemove to numToRemove + 1
gistfile1 copy 9.applescript
set noOfGoodLinkedFiles to count of existingFiles
gistfile1 copy 9.applescript
if (noOfGoodLinkedFiles is not equal to noOfLinkedFiles) then
gistfile1 copy 9.applescript
delete linked files
gistfile1 copy 9.applescript
repeat with lf in existingFiles
gistfile1 copy 9.applescript
make new linked file with data lf at end of linked files
gistfile1 copy 9.applescript
set outString to ""
gistfile1 copy 9.applescript
set pubsPdfs to {}
gistfile1 copy 9.applescript
repeat with newFile in pathList
gistfile1 copy 9.applescript
set foundMatch to false
gistfile1 copy 9.applescript
set nfName to POSIX path of newFile as string
gistfile1 copy 9.applescript
set lfName to (POSIX path of lf as string)
gistfile1 copy 9.applescript
ignoring white space
gistfile1 copy 9.applescript
if lfName is equal to nfName then
gistfile1 copy 9.applescript
set foundMatch to true
gistfile1 copy 9.applescript
if (foundMatch) then
gistfile1 copy 9.applescript
set outString to outString & return & "Adding " & nfName & " to " & newKey
gistfile1 copy 9.applescript
make new linked file with data (POSIX file newFile as string) at end of linked files
gistfile1 copy 9.applescript
set num_of_links to num_of_links + 1
gistfile1 copy 9.applescript
if ((offset of (papersFolder & "/") in nfName) > 0) and ((offset of ".pdf" in nfName) > 0) then
gistfile1 copy 9.applescript
set pfLen to length of papersFolder
gistfile1 copy 9.applescript
set pdfName to text (pfLen + 2) thru (length of nfName) of nfName
gistfile1 copy 9.applescript
copy pdfName to end of pubsPdfs
gistfile1 copy 9.applescript
set newPubRecord to {pubKey:newKey, pubAuth:(author of thePub), pubTitle:(title of thePub), pubFiles:pubsPdfs, pubNote:(note of thePub)}
gistfile1 copy 9.applescript
copy newPubRecord to end of recordsForIndex
gistfile1 copy 9.applescript
copy newKey to end of unSortedList
gistfile1 copy 9.applescript
if outString is not "" then
gistfile1 copy 9.applescript
display dialog outString
gistfile1 copy 9.applescript
end tell --BibDesk
gistfile1 copy 9.applescript
if (allSelected and (length of recordsForIndex) > 0) then
gistfile1 copy 9.applescript
set sortedList to simple_sort(unSortedList)
gistfile1 copy 9.applescript
set htmlText to "
gistfile1 copy 9.applescript
<html>
gistfile1 copy 9.applescript
<title>Index of Papers</title>
gistfile1 copy 9.applescript
<table border=1>
gistfile1 copy 9.applescript
set etcR to ASCII character 10
gistfile1 copy 9.applescript
repeat with nextPubKey in sortedList
gistfile1 copy 9.applescript