text
stringlengths
0
15.7k
source
stringlengths
6
112
if backgroundDimensions is not missing value then
lns3.scpt
copy backgroundDimensions to {windowWidth, windowHeight}
lns3.scpt
set the commandSubstring to (("-w" & space & windowWidth) as string) & space & (("-h" & space & windowHeight) as string)
lns3.scpt
set backgroundPosition to the background position of advancedSettingsRecord
lns3.scpt
if backgroundPosition is not missing value then
lns3.scpt
copy backgroundPosition to {windowLeft, windowBottom}
lns3.scpt
set the commandSubstring to (("-x" & space & windowLeft) as string) & space & (("-y" & space & windowBottom) as string)
lns3.scpt
set backgroundOpacity to the opacity of advancedSettingsRecord
lns3.scpt
if backgroundOpacity is not missing value then
lns3.scpt
if backgroundOpacity is greater than 100 then
lns3.scpt
set backgroundOpacity to 100
lns3.scpt
else if backgroundOpacity is less than 0 then
lns3.scpt
set backgroundOpacity to 0
lns3.scpt
set the opacityAsRealAsString to (the backgroundOpacity * 0.01) as string
lns3.scpt
set the commandSubstring to "-o" & space & opacityAsRealAsString
lns3.scpt
do shell script commandString
lns3.scpt
end display overlay text
lns3.scpt
on RBGtoHTML(RGB_values)
lns3.scpt
set the the hex_value to ""
lns3.scpt
repeat with i from 1 to the count of the RGB_values
lns3.scpt
set this_value to (item i of the RGB_values) div 256
lns3.scpt
if this_value is 256 then set this_value to 255
lns3.scpt
set x to item ((this_value div 16) + 1) of the hex_list
lns3.scpt
set y to item (((this_value / 16 mod 1) * 16) + 1) of the hex_list
lns3.scpt
set the hex_value to (the hex_value & x & y) as string
lns3.scpt
return ("#" & the hex_value) as string
lns3.scpt
end RBGtoHTML
lns3.scpt
use AppleScript version "2.5" -- requires OS X 10.11 or higher
lns3.scpt
use framework "EventKit"
lns3.scpt
on fetch store
lns3.scpt
set theEKEventStore to current application's EKEventStore's alloc()'s init()
lns3.scpt
theEKEventStore's requestAccessToEntityType:0 completion:(missing value)
lns3.scpt
set authorizationStatus to current application's EKEventStore's authorizationStatusForEntityType:0
lns3.scpt
if authorizationStatus is not 3 then
lns3.scpt
display dialog "Access must be given in System Preferences" & linefeed & "-> Security & Privacy first." buttons {"OK"} default button 1
lns3.scpt
tell pane id "com.apple.preference.security" to reveal anchor "Privacy"
lns3.scpt
return theEKEventStore
lns3.scpt
end fetch store
lns3.scpt
on fetch calendar calName cal type calType event store theStore
lns3.scpt
if calType = cal local then
lns3.scpt
set calType to 0
lns3.scpt
else if calType = cal cloud then
lns3.scpt
set calType to 1
lns3.scpt
else if calType = cal exchange then
lns3.scpt
set calType to 2
lns3.scpt
else if calType = cal subscription then
lns3.scpt
set calType to 3
lns3.scpt
else if calType = cal birthday then
lns3.scpt
set calType to 4
lns3.scpt
error "Invalid cal type"
lns3.scpt
set theCalendars to theStore's calendarsForEntityType:0
lns3.scpt
set theNSPredicate to current application's NSPredicate's predicateWithFormat_("title == %@ AND type IN %@", calName, {calType})
lns3.scpt
return (theCalendars's filteredArrayUsingPredicate:theNSPredicate)'s firstObject()
lns3.scpt
end fetch calendar
lns3.scpt
on fetch calendars listOfCalNames as list cal type list listOfCalTypes as list : {} event store theStore
lns3.scpt
if listOfCalTypes = {} then
lns3.scpt
if listOfCalNames = {} then
lns3.scpt
return theCalendars as list
lns3.scpt
set theNSPredicate to current application's NSPredicate's predicateWithFormat_("title IN %@", listOfCalNames)
lns3.scpt
repeat with i from 1 to count of listOfCalTypes
lns3.scpt
set calType to item i of listOfCalTypes
lns3.scpt
set item i of listOfCalTypes to calType
lns3.scpt
set theNSPredicate to current application's NSPredicate's predicateWithFormat_("type IN %@", listOfCalTypes)
lns3.scpt
set theNSPredicate to current application's NSPredicate's predicateWithFormat_("title IN %@ AND type IN %@", listOfCalNames, listOfCalTypes)
lns3.scpt
return (theCalendars's filteredArrayUsingPredicate:theNSPredicate) as list
lns3.scpt
end fetch calendars
lns3.scpt
on fetch events by UID calID event store theStore
lns3.scpt
set theEvents to (theStore's calendarItemsWithExternalIdentifier:calID)
lns3.scpt
set theEvents to theEvents's sortedArrayUsingSelector:"compareStartDateWithEvent:"
lns3.scpt
return theEvents as list
lns3.scpt
end fetch events by UID
lns3.scpt
on fetch events starting date startDate ending date endDate searching cals calList event store theStore
lns3.scpt
set calListArray to current application's NSArray's arrayWithObject:calList
lns3.scpt
set calList to calListArray's |firstObject|()
lns3.scpt
if not (calList's isKindOfClass:(current application's NSArray)) as boolean then set calList to calListArray
lns3.scpt
set thePredicate to theStore's predicateForEventsWithStartDate:startDate endDate:endDate calendars:calList
lns3.scpt
set theEvents to theStore's eventsMatchingPredicate:thePredicate
lns3.scpt
end fetch events
lns3.scpt
on filter events event list theEvents event summary theTitle : missing value event location theLocation : missing value event description desc : missing value has attendees hasA : missing value has recurrence hasRecRules : missing value runs all day allDay : missing value
lns3.scpt
set theEventsArray to current application's NSArray's arrayWithObject:theEvents
lns3.scpt
set theEvents to theEventsArray's |firstObject|()
lns3.scpt
if not (theEvents's isKindOfClass:(current application's NSArray)) as boolean then set theEvents to theEventsArray
lns3.scpt
set predArray to current application's NSMutableArray's arrayWithCapacity:6
lns3.scpt
if theTitle is not missing value then
lns3.scpt
predArray's addObject:(current application's NSPredicate's predicateWithFormat_("title ==[c] %@", theTitle))
lns3.scpt
if theLocation is not missing value then
lns3.scpt
predArray's addObject:(current application's NSPredicate's predicateWithFormat_("location ==[c] %@", theLocation))
lns3.scpt
if desc is not missing value then
lns3.scpt
predArray's addObject:(current application's NSPredicate's predicateWithFormat_("hasNotes == %@ AND notes ==[c] %@", true, desc))
lns3.scpt
if hasA is not missing value then
lns3.scpt
predArray's addObject:(current application's NSPredicate's predicateWithFormat_("hasAttendees == %@", hasA))
lns3.scpt
if hasRecRules is not missing value then
lns3.scpt
predArray's addObject:(current application's NSPredicate's predicateWithFormat_("hasRecurrenceRules == %@", hasRecRules))
lns3.scpt
if allDay is not missing value then
lns3.scpt
predArray's addObject:(current application's NSPredicate's predicateWithFormat_("allDay == %@", allDay))
lns3.scpt
set theCount to count of predArray
lns3.scpt
if theCount = 1 then
lns3.scpt
set theEvents to (theEvents's filteredArrayUsingPredicate:(predArray's firstObject()))
lns3.scpt
else if theCount > 1 then
lns3.scpt
set thePred to current application's NSCompoundPredicate's andPredicateWithSubpredicates:predArray
lns3.scpt