text
stringlengths 0
15.7k
| source
stringlengths 6
112
|
---|---|
"echo " & quoted form of _abstract & "| tr -s '\\r\\n' ' '"
|
Add Zotero abstract.applescript
|
set _abstract to "(No abstract.)"
|
Add Zotero abstract.applescript
|
add custom meta data _abstract for "abstract" to _record
|
Add Zotero abstract.applescript
|
set _path to (path of workflows folder) as string
|
Workflows.applescript
|
SFR_DictItem("foo", "bar")
|
SFR_DictItem.applescript
|
on SFR_DictItem(itemName, itemValue)
|
SFR_DictItem.applescript
|
return "<:" & SFR_Escape(itemName) & ":=" & SFR_Escape(itemValue) & ":>"
|
SFR_DictItem.applescript
|
end SFR_DictItem
|
SFR_DictItem.applescript
|
property cal : missing value
|
WFO-to-Calendar.applescript
|
property scheduleEditorURL : "[INSERT URL HERE]" # I removed the actual URL here for confidentiality reasons
|
WFO-to-Calendar.applescript
|
setCalendar()
|
WFO-to-Calendar.applescript
|
set progress total steps to -1 -- indeterminant progress
|
WFO-to-Calendar.applescript
|
set progress description to "Getting WFO schedule data"
|
WFO-to-Calendar.applescript
|
set progress additional description to "Waiting for WFO to load..."
|
WFO-to-Calendar.applescript
|
set theText to getWFOtext()
|
WFO-to-Calendar.applescript
|
set scheduleData to parseWFOtext(theText)
|
WFO-to-Calendar.applescript
|
set progress completed steps to 1
|
WFO-to-Calendar.applescript
|
set progress description to "Deleting the events of week " & _date of item 1 of scheduleData
|
WFO-to-Calendar.applescript
|
set weekStartDate to date (_date of item 1 of scheduleData)
|
WFO-to-Calendar.applescript
|
deleteCalEvents(weekStartDate)
|
WFO-to-Calendar.applescript
|
set progress description to "Creating events of week " & _date of item 1 of scheduleData
|
WFO-to-Calendar.applescript
|
set progress total steps to 7
|
WFO-to-Calendar.applescript
|
repeat with d in scheduleData
|
WFO-to-Calendar.applescript
|
set progress completed steps to counter
|
WFO-to-Calendar.applescript
|
set progress additional description to "Day " & counter & " of 7"
|
WFO-to-Calendar.applescript
|
if item 1 of d's segments ≠ "No data" then
|
WFO-to-Calendar.applescript
|
repeat with s in segments of d
|
WFO-to-Calendar.applescript
|
log s
|
WFO-to-Calendar.applescript
|
if s does not start with "ACPHON" then
|
WFO-to-Calendar.applescript
|
set segmentName to item 1 of my SearchWithRegEx("^.* - (.*) (\\d+:\\d+ [A|P]M) - (\\d+:\\d+ [A|P]M)", s, 1)
|
WFO-to-Calendar.applescript
|
if segmentName = "Shift (container)" then set segmentName to "Shift"
|
WFO-to-Calendar.applescript
|
set startTime to date (_date of d & " at " & item 1 of my SearchWithRegEx("^.* - (.*) (\\d+:\\d+ [A|P]M) - (\\d+:\\d+ [A|P]M)", s, 2))
|
WFO-to-Calendar.applescript
|
set endTime to date (_date of d & " at " & my SearchWithRegEx("^.* - (.*) (\\d+:\\d+ [A|P]M) - (\\d+:\\d+ [A|P]M)", s, 3))
|
WFO-to-Calendar.applescript
|
makeCalEvents(segmentName, startTime, endTime)
|
WFO-to-Calendar.applescript
|
set progress description to "Import complete!"
|
WFO-to-Calendar.applescript
|
display notification "Calendar imported successfully!" with title "WFO to Calendar"
|
WFO-to-Calendar.applescript
|
on error errMsg number errNum from errFrom to errTo partial result errPartialResult
|
WFO-to-Calendar.applescript
|
set progress additional description to "Stopping..."
|
WFO-to-Calendar.applescript
|
error errMsg number errNum from errFrom to errTo partial result errPartialResult -- resignal the error
|
WFO-to-Calendar.applescript
|
on setCalendar()
|
WFO-to-Calendar.applescript
|
tell application "Calendar" to set cals to name of every calendar
|
WFO-to-Calendar.applescript
|
set p to POSIX path of (path to me) & "Contents/Resources/data.plist"
|
WFO-to-Calendar.applescript
|
set info to value of property list file p
|
WFO-to-Calendar.applescript
|
set cal to theCalendar of info
|
WFO-to-Calendar.applescript
|
if cals does not contain cal or cal is missing value then
|
WFO-to-Calendar.applescript
|
choose from list cals ¬
|
WFO-to-Calendar.applescript
|
"WFO to Calendar" with prompt ¬
|
WFO-to-Calendar.applescript
|
"Choose the calendar to import to" default items 1 ¬
|
WFO-to-Calendar.applescript
|
OK button name ¬
|
WFO-to-Calendar.applescript
|
without empty selection allowed
|
WFO-to-Calendar.applescript
|
set cal to item 1 of result
|
WFO-to-Calendar.applescript
|
tell property list file p
|
WFO-to-Calendar.applescript
|
set value of property list item "theCalendar" to cal
|
WFO-to-Calendar.applescript
|
end setCalendar
|
WFO-to-Calendar.applescript
|
on getWFOtext()
|
WFO-to-Calendar.applescript
|
if URLs contains scheduleEditorURL then
|
WFO-to-Calendar.applescript
|
if item n of URLs is scheduleEditorURL then
|
WFO-to-Calendar.applescript
|
open location scheduleEditorURL
|
WFO-to-Calendar.applescript
|
my waitForSafariToLoad("Saturday", thetab) -- Pause until schedule has loaded
|
WFO-to-Calendar.applescript
|
set theText to text of thetab
|
WFO-to-Calendar.applescript
|
if theText does not contain "Clear Day" then -- Means the Resolution button is clicked
|
WFO-to-Calendar.applescript
|
my doJava:"click" onType:"class" withIdentifier:"toolbar-item-caption" withElementNum:"0" withSetValue:(missing value) inTab:thetab
|
WFO-to-Calendar.applescript
|
my waitForSafariToLoad("Clear Day", thetab) -- Pause again in case the Segment view needs to load
|
WFO-to-Calendar.applescript
|
end getWFOtext
|
WFO-to-Calendar.applescript
|
on makeCalEvents(theTitle, startDate, endDate)
|
WFO-to-Calendar.applescript
|
set eventStartDate to current application's NSDate's dateWithTimeInterval:0.0 sinceDate:startDate
|
WFO-to-Calendar.applescript
|
set eventEndDate to current application's NSDate's dateWithTimeInterval:0.0 sinceDate:endDate
|
WFO-to-Calendar.applescript
|
set listOfCalNames to {cal} -- list of one or more calendar names
|
WFO-to-Calendar.applescript
|
set listOfCalTypes to {1} -- list of one or more calendar types: : Local = 0, CalDAV/iCloud = 1, Exchange = 2, Subscription = 3, Birthday = 4
|
WFO-to-Calendar.applescript
|
set authorizationStatus to current application's EKEventStore's authorizationStatusForEntityType:0 -- work around enum bug
|
WFO-to-Calendar.applescript
|
set theCalendars to theEKEventStore's calendarsForEntityType:0
|
WFO-to-Calendar.applescript
|
set calsToSearch to theCalendars's filteredArrayUsingPredicate:theNSPredicate
|
WFO-to-Calendar.applescript
|
if (count of calsToSearch) < 1 then error "No such calendar(s)."
|
WFO-to-Calendar.applescript
|
set ev to current application's EKEvent's eventWithEventStore:theEKEventStore
|
WFO-to-Calendar.applescript
|
ev's setCalendar:(item 1 of calsToSearch)
|
WFO-to-Calendar.applescript
|
ev's setTitle:theTitle
|
WFO-to-Calendar.applescript
|
ev's setStartDate:eventStartDate
|
WFO-to-Calendar.applescript
|
ev's setEndDate:eventEndDate
|
WFO-to-Calendar.applescript
|
set {theResult, theError} to theEKEventStore's saveEvent:ev span:(current application's EKSpanThisEvent) commit:true |error|:(reference)
|
WFO-to-Calendar.applescript
|
end makeCalEvents
|
WFO-to-Calendar.applescript
|
on deleteCalEvents(weekStartDate)
|
WFO-to-Calendar.applescript
|
set weekEndDate to weekStartDate + (7 * days)
|
WFO-to-Calendar.applescript
|
set listOfCaTypes to {1} -- list of one or more calendar types: : Local = 0, CalDAV/iCloud = 1, Exchange = 2, Subscription = 3, Birthday = 4
|
WFO-to-Calendar.applescript
|
set nowDate to current application's NSDate's |date|()
|
WFO-to-Calendar.applescript
|
set weekStartDate to current application's NSDate's dateWithTimeInterval:0.0 sinceDate:weekStartDate
|
WFO-to-Calendar.applescript
|
set todaysDate to current application's NSCalendar's currentCalendar()'s dateBySettingHour:0 minute:0 |second|:0 ofDate:nowDate options:0
|
WFO-to-Calendar.applescript
|
set weekEndDate to weekStartDate's dateByAddingTimeInterval:7 * days
|
WFO-to-Calendar.applescript
|
set theNSPredicate to current application's NSPredicate's predicateWithFormat_("title IN %@ AND type IN %@", listOfCalNames, listOfCaTypes)
|
WFO-to-Calendar.applescript
|
set thePred to theEKEventStore's predicateForEventsWithStartDate:weekStartDate endDate:weekEndDate calendars:calsToSearch
|
WFO-to-Calendar.applescript
|
set theEvents to (theEKEventStore's eventsMatchingPredicate:thePred)
|
WFO-to-Calendar.applescript
|
repeat with e in theEvents
|
WFO-to-Calendar.applescript
|
(theEKEventStore's removeEvent:e span:(current application's EKSpanThisEvent) commit:true |error|:(missing value))
|
WFO-to-Calendar.applescript
|
end deleteCalEvents
|
WFO-to-Calendar.applescript
|
on parseWFOtext(wfoText)
|
WFO-to-Calendar.applescript
|
set daysofweek to {"Saturday", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday"}
|
WFO-to-Calendar.applescript
|
set scheduleData to {}
|
WFO-to-Calendar.applescript
|
set dataScraped to false
|
WFO-to-Calendar.applescript
|
repeat until dataScraped
|
WFO-to-Calendar.applescript
|
set p to paragraph n of wfoText
|
WFO-to-Calendar.applescript
|
log p
|
WFO-to-Calendar.applescript
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.