text
stringlengths
0
15.7k
source
stringlengths
6
112
on error number -1728
capitalizeString.applescript
set otherChars to ""
capitalizeString.applescript
return firstChar & otherChars
capitalizeString.applescript
error "Can't capitalizeString: " & eMsg number eNum
capitalizeString.applescript
end capitalizeString
capitalizeString.applescript
tell application "Spotify" to set state to player state as text
Current Track.applescript
if state is equal to "playing" then
Current Track.applescript
tell application "Spotify" to artist of current track & " - " & name of current track
Current Track.applescript
say "Hello, world!" -- an audio message using a synthesized computer voice
AppleScript_SpeechSynthesisHelloWorld_V1.applescript
set theURL to the URL of the active tab of window 1
chrome_url.applescript
set the clipboard to theURL
chrome_url.applescript
fmGUI_ManageDb_Save({})
fmGUI_ManageDB_Save.applescript
on fmGUI_ManageDb_Save(prefs)
fmGUI_ManageDB_Save.applescript
set defaultPrefs to {notInManageDbIsError:true}
fmGUI_ManageDB_Save.applescript
set manageDbWindowNamePrefix to "Manage Database for"
fmGUI_ManageDB_Save.applescript
set waitCycleDelaySeconds to 10 -- seconds
fmGUI_ManageDB_Save.applescript
set waitSaveTotalSeconds to 60 * minutes --seconds
fmGUI_ManageDB_Save.applescript
set waitCycleMax to round (waitSaveTotalSeconds / waitCycleDelaySeconds) rounding down
fmGUI_ManageDB_Save.applescript
set frontmostWindowName to fmGUI_NameOfFrontmostWindow()
fmGUI_ManageDB_Save.applescript
if frontmostWindowName starts with manageDbWindowNamePrefix then
fmGUI_ManageDB_Save.applescript
fmGUI_ObjectClick_OkButton({})
fmGUI_ManageDB_Save.applescript
delay 1 -- let click register. will continue below to wait for window to close
fmGUI_ManageDB_Save.applescript
error "Couldn't save Manage Database - " & errMsg number errNum
fmGUI_ManageDB_Save.applescript
if notInManageDbIsError of prefs then
fmGUI_ManageDB_Save.applescript
error "Manage Database window wasn't open, so nothing to close." number 1024
fmGUI_ManageDB_Save.applescript
windowWaitUntil({windowName:frontmostWindowName, windowNameTest:"does not contain", whichWindow:"any", waitCycleDelaySeconds:waitCycleDelaySeconds, waitCycleMax:waitCycleMax})
fmGUI_ManageDB_Save.applescript
delay 1 -- let normal window come to front.
fmGUI_ManageDB_Save.applescript
error "unable to fmGUI_ManageDB_Save - " & errMsg number errNum
fmGUI_ManageDB_Save.applescript
end fmGUI_ManageDb_Save
fmGUI_ManageDB_Save.applescript
on fmGUI_NameOfFrontmostWindow()
fmGUI_ManageDB_Save.applescript
tell application "htcLib" to fmGUI_NameOfFrontmostWindow()
fmGUI_ManageDB_Save.applescript
end fmGUI_NameOfFrontmostWindow
fmGUI_ManageDB_Save.applescript
on fmGUI_ObjectClick_OkButton(prefs)
fmGUI_ManageDB_Save.applescript
tell application "htcLib" to fmGUI_ObjectClick_OkButton(prefs)
fmGUI_ManageDB_Save.applescript
end fmGUI_ObjectClick_OkButton
fmGUI_ManageDB_Save.applescript
on windowWaitUntil(prefs)
fmGUI_ManageDB_Save.applescript
tell application "htcLib" to windowWaitUntil(prefs)
fmGUI_ManageDB_Save.applescript
end windowWaitUntil
fmGUI_ManageDB_Save.applescript
on hazelProcessFile(theFile)
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
set p to POSIX path of theFile
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
set l to paragraphs of (do shell script "grep '\[ x \]' " & quoted form of p)
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
tell application "OmniFocus" to tell document 1
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
repeat with v in l
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
set taskName to (do shell script "n="" & v & ""; echo ${n:6}")
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
set taskNote to "Created from nvALT: nvalt://find/" & my encode_text(my remove_extension(my basename(p)), true, false)
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
make new inbox task with properties {name:taskName, note:taskNote}
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
end hazelProcessFile
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
on basename(thePath) -- Requires POSIX path
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
if thePath ends with "/" then
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
set nameIndex to -2
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
set nameIndex to -1
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
set ASTID to AppleScript's text item delimiters
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
set thePath to text item nameIndex of thePath
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
set AppleScript's text item delimiters to ASTID
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
return thePath
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
end basename
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
on encode_char(this_char)
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
set the ASCII_num to (the ASCII number this_char)
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
set the hex_list to {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"}
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
set x to item ((ASCII_num div 16) + 1) of the hex_list
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
set y to item ((ASCII_num mod 16) + 1) of the hex_list
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
return ("%" & x & y) as string
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
end encode_char
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
on encode_text(this_text, encode_URL_A, encode_URL_B)
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
set the standard_characters to "abcdefghijklmnopqrstuvwxyz0123456789"
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
set the URL_A_chars to "$+!'/?;&@=#%><{}[]"~`^\|*"
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
set the URL_B_chars to ".-_:"
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
set the acceptable_characters to the standard_characters
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
if encode_URL_A is false then set the acceptable_characters to the acceptable_characters & the URL_A_chars
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
if encode_URL_B is false then set the acceptable_characters to the acceptable_characters & the URL_B_chars
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
set the encoded_text to ""
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
repeat with this_char in this_text
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
if this_char is in the acceptable_characters then
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
set the encoded_text to (the encoded_text & this_char)
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
set the encoded_text to (the encoded_text & encode_char(this_char)) as string
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
return the encoded_text
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
end encode_text
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
on remove_extension(this_name)
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
if this_name contains "." then
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
set this_name to ¬
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
(the reverse of every character of this_name) as string
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
set x to the offset of "." in this_name
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
set this_name to (text (x + 1) thru -1 of this_name)
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
set this_name to (the reverse of every character of this_name) as string
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
return this_name
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
end remove_extension
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
on replaceString(theText, oldString, newString)
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
local ASTID, theText, oldString, newString, lst
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
set AppleScript's text item delimiters to oldString
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
set lst to every text item of theText
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
set AppleScript's text item delimiters to newString
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
set theText to lst as string
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
return theText
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
error "Can't replaceString: " & eMsg number eNum
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
end replaceString
Save%20nvALT%20Checkboxes%20to%20OmniFocus.scpt
property aVar : missing value
gistfile1-3.scpt
if aVar is missing value then
gistfile1-3.scpt
set aVar to 0
gistfile1-3.scpt
set aVar to aVar + 1
gistfile1-3.scpt
return aVar
gistfile1-3.scpt