text
stringlengths 0
15.7k
| source
stringlengths 6
112
|
---|---|
set datesCount to count of items in contactDateValues
|
BirthdayReminder.applescript
|
if addr is {} then
|
BirthdayReminder.applescript
|
set tempName to tempName & " ❌📬"
|
BirthdayReminder.applescript
|
if bday is not missing value then
|
BirthdayReminder.applescript
|
set x to month of bday
|
BirthdayReminder.applescript
|
set y to day of bday
|
BirthdayReminder.applescript
|
if m is x and d is y then
|
BirthdayReminder.applescript
|
set finalNameDescription to "🎉 - " & tempName
|
BirthdayReminder.applescript
|
set tempNames to tempNames & finalNameDescription
|
BirthdayReminder.applescript
|
if datesCount > 0 then
|
BirthdayReminder.applescript
|
repeat with i from 1 to datesCount
|
BirthdayReminder.applescript
|
set x to month of item i of contactDateValues
|
BirthdayReminder.applescript
|
set y to day of item i of contactDateValues
|
BirthdayReminder.applescript
|
if item i of contactDateLabels is "anniversary" then
|
BirthdayReminder.applescript
|
set finalNameDescription to "💝 - " & tempName
|
BirthdayReminder.applescript
|
if item i of contactDateLabels is "other" then
|
BirthdayReminder.applescript
|
set finalNameDescription to "📅 - " & tempName
|
BirthdayReminder.applescript
|
tell application "Contacts" to quit
|
BirthdayReminder.applescript
|
set theText to "Mail cards to the following people:"
|
BirthdayReminder.applescript
|
repeat with i from 1 to the count of items in tempNames
|
BirthdayReminder.applescript
|
set theText to theText & newline & item i of tempNames
|
BirthdayReminder.applescript
|
make new event at end with properties {description:theText, summary:"📩 Mail Cards", location:"Delete this once cards are mailed", start date:theDate, allday event:true}
|
BirthdayReminder.applescript
|
set theLink to "- [" & theTitle & "]" & "(" & theURL & ")"
|
Append to Journal.applescript
|
do shell script "echo " & the quoted form of theLink & "| ~/.bin/daily_append"
|
Append to Journal.applescript
|
property version : "1.1"
|
ASLog.applescript
|
property LVL_OFF : {name:"OFF", value:0}
|
ASLog.applescript
|
property LVL_DEBUG : {name:"DEBUG", value:10}
|
ASLog.applescript
|
property LVL_INFO : {name:"INFO", value:20}
|
ASLog.applescript
|
property LVL_WARN : {name:"WARN", value:30}
|
ASLog.applescript
|
property LVL_ERROR : {name:"ERROR", value:40}
|
ASLog.applescript
|
property LEVELS : {LVL_OFF, LVL_DEBUG, LVL_INFO, LVL_WARN, LVL_ERROR}
|
ASLog.applescript
|
on add_level(lvlname, lvl)
|
ASLog.applescript
|
if lvl < 0 or lvl as integer ≠ lvl then
|
ASLog.applescript
|
error "Invalid level parameter: " & (lvl as string) number -1000
|
ASLog.applescript
|
if class of lvlname is not string then
|
ASLog.applescript
|
error "Invalid level parameter: " & (lvlname as string) number -1001
|
ASLog.applescript
|
set newLevel to {name:lvlname, value:lvl}
|
ASLog.applescript
|
set end of LEVELS to newLevel
|
ASLog.applescript
|
return newLevel
|
ASLog.applescript
|
end add_level
|
ASLog.applescript
|
on get_level(lvlname)
|
ASLog.applescript
|
repeat with i from 1 to (count LEVELS)
|
ASLog.applescript
|
set globallevel to item i of LEVELS
|
ASLog.applescript
|
if lvlname = name of globallevel then
|
ASLog.applescript
|
return globallevel
|
ASLog.applescript
|
error lvlname & " is not a known logging level." number -1002
|
ASLog.applescript
|
end get_level
|
ASLog.applescript
|
on get_level_name(lvl)
|
ASLog.applescript
|
if lvl = globallevel then
|
ASLog.applescript
|
return name of globallevel
|
ASLog.applescript
|
error name of lvl & " is not a known logging level." number -1002
|
ASLog.applescript
|
if msg contains "Can’t get name of" then
|
ASLog.applescript
|
error "Invalid log level format." number -1003
|
ASLog.applescript
|
end get_level_name
|
ASLog.applescript
|
script _HelperLib
|
ASLog.applescript
|
property class : "HelperLibrary"
|
ASLog.applescript
|
on get_date(dateformat)
|
ASLog.applescript
|
return (do shell script " date +" & quoted form of dateformat)
|
ASLog.applescript
|
end get_date
|
ASLog.applescript
|
on search_and_replace(myString, oldText, newText)
|
ASLog.applescript
|
set AppleScript's text item delimiters to oldText
|
ASLog.applescript
|
set myList to text items of myString
|
ASLog.applescript
|
set myString to myList as string
|
ASLog.applescript
|
end search_and_replace
|
ASLog.applescript
|
on exists_file(fp)
|
ASLog.applescript
|
return exists disk item fp
|
ASLog.applescript
|
end exists_file
|
ASLog.applescript
|
on write_to_file(filepath, txt)
|
ASLog.applescript
|
write (txt & linefeed) to POSIX file (POSIX path of filepath) starting at eof
|
ASLog.applescript
|
on create_file(filepath)
|
ASLog.applescript
|
ensure_directory_exists(parent_folder_of(filepath))
|
ASLog.applescript
|
open for access file filepath with write permission
|
ASLog.applescript
|
close access file filepath
|
ASLog.applescript
|
end create_file
|
ASLog.applescript
|
on explode(theText, theDelim)
|
ASLog.applescript
|
set theList to text items of theText
|
ASLog.applescript
|
on implode(theList, theDelim)
|
ASLog.applescript
|
on ensure_directory_exists(theDirectory)
|
ASLog.applescript
|
set targetFolder to theDirectory
|
ASLog.applescript
|
set folderList to items 1 thru -2 of explode(theDirectory, ":") --The trailing colon leaves an empty string at the end of the list
|
ASLog.applescript
|
set fullPath to item 1 of folderList & ":"
|
ASLog.applescript
|
repeat with i from 2 to (count folderList) --There is no directory to make a new folder in for the first item, so it can be ignored
|
ASLog.applescript
|
set currFolder to item i of folderList
|
ASLog.applescript
|
set fullPath to fullPath & currFolder & ":"
|
ASLog.applescript
|
set currDirectory to implode(items 1 thru (i - 1) of folderList, ":") & ":"
|
ASLog.applescript
|
if not my exists_file(fullPath) then
|
ASLog.applescript
|
tell application "Finder" to set targetFolder to (make new folder at currDirectory with properties {name:currFolder}) as text
|
ASLog.applescript
|
return targetFolder
|
ASLog.applescript
|
end ensure_directory_exists
|
ASLog.applescript
|
on parent_folder_of(theAlias)
|
ASLog.applescript
|
if class of theAlias is alias then
|
ASLog.applescript
|
set theAlias to theAlias as string
|
ASLog.applescript
|
set {colon, backslash, slash} to {":", "/", "\\"}
|
ASLog.applescript
|
if theAlias contains colon then
|
ASLog.applescript
|
set separator to colon
|
ASLog.applescript
|
else if theAlias contains backslash then
|
ASLog.applescript
|
set separator to backslash
|
ASLog.applescript
|
else if theAlias contains slash then
|
ASLog.applescript
|
set separator to slash
|
ASLog.applescript
|
if theAlias ends with separator then
|
ASLog.applescript
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.