text
stringlengths
0
15.7k
source
stringlengths
6
112
on dropWhileEnd(p, xs)
Sort.applescript
set i to length of xs
Sort.applescript
repeat while i > 0 and |λ|(item i of xs)
Sort.applescript
set i to i - 1
Sort.applescript
take(i, xs)
Sort.applescript
end dropWhileEnd
Sort.applescript
on intercalateS(sep, xs)
Sort.applescript
set {dlm, my text item delimiters} to {my text item delimiters, sep}
Sort.applescript
set s to xs as text
Sort.applescript
set my text item delimiters to dlm
Sort.applescript
return s
Sort.applescript
end intercalateS
Sort.applescript
on isDigit(c)
Sort.applescript
set n to (id of c)
Sort.applescript
48 ≤ n and 57 ≥ n
Sort.applescript
end isDigit
Sort.applescript
on isSpace(c)
Sort.applescript
set i to id of c
Sort.applescript
i = 32 or (i ≥ 9 and i ≤ 13)
Sort.applescript
end isSpace
Sort.applescript
on min(x, y)
Sort.applescript
if y < x then
Sort.applescript
y
Sort.applescript
x
Sort.applescript
end min
Sort.applescript
on mReturn(f)
Sort.applescript
if class of f is script then
Sort.applescript
f
Sort.applescript
script
Sort.applescript
property |λ| : f
Sort.applescript
end mReturn
Sort.applescript
on sort(xs)
Sort.applescript
((current application's NSArray's arrayWithArray:xs)'s ¬
Sort.applescript
sortedArrayUsingSelector:"compare:") as list
Sort.applescript
end sort
Sort.applescript
on strip(s)
Sort.applescript
script isSpace
Sort.applescript
on |λ|(c)
Sort.applescript
dropWhile(isSpace, dropWhileEnd(isSpace, s))
Sort.applescript
end strip
Sort.applescript
on take(n, xs)
Sort.applescript
if class of xs is string then
Sort.applescript
if n > 0 then
Sort.applescript
text 1 thru min(n, length of xs) of xs
Sort.applescript
""
Sort.applescript
items 1 thru min(n, length of xs) of xs
Sort.applescript
end take
Sort.applescript
on perform_mail_action(info)
SendToThings.scpt
set selectedMessages to |SelectedMessages| of info
SendToThings.scpt
repeat with eachMessage in selectedMessages
SendToThings.scpt
set theSubject to the subject of the eachMessage
SendToThings.scpt
set theContent to the content of the eachMessage
SendToThings.scpt
set tid to AppleScript's text item delimiters
SendToThings.scpt
set AppleScript's text item delimiters to ASCII character 10 -- (a line feed)
SendToThings.scpt
set theItem to text items of theContent
SendToThings.scpt
set AppleScript's text item delimiters to tid
SendToThings.scpt
tell application "Things beta"
SendToThings.scpt
set allProjects to name of to dos of list "Projects"
SendToThings.scpt
set theProject to ""
SendToThings.scpt
if theSubject as string is not equal to "" then
SendToThings.scpt
if (count of allProjects) is equal to 0 then
SendToThings.scpt
set newProject to make new project with properties {name:theSubject}
SendToThings.scpt
set theProject to theSubject
SendToThings.scpt
return my createToDo(true, theItem, theProject)
SendToThings.scpt
repeat with aProject in allProjects
SendToThings.scpt
if aProject as string is equal to theSubject then
SendToThings.scpt
set theProject to aProject
SendToThings.scpt
return my createToDo(false, theItem, theProject)
SendToThings.scpt
end perform_mail_action
SendToThings.scpt
on createToDo(isProject, tdItem, tdProject)
SendToThings.scpt
if class of tdItem is equal to list then
SendToThings.scpt
repeat with i in tdItem
SendToThings.scpt
if i as string is equal to "--" then
SendToThings.scpt
my createToDo(isProject, i, tdProject)
SendToThings.scpt
if tdItem as string is not equal to "" then
SendToThings.scpt
if isProject is true then
SendToThings.scpt
set newToDo to make new to do with properties ¬
SendToThings.scpt
{name:tdItem} at beginning of project tdProject
SendToThings.scpt
{name:tdItem}
SendToThings.scpt
end createToDo
SendToThings.scpt
tell application "System Events" to try
Scripts.applescript
set _path to (path of scripts folder) as string
Scripts.applescript
tell the front Finder window to if toolbar visible then
Scripts.applescript
set target to _path
Scripts.applescript
open _path
Scripts.applescript
tell application "Finder" to set sel to selection
copy-server-loc copy.applescript
open sel
copy-server-loc copy.applescript
on SAR(main_text, search_text, replace_text)
copy-server-loc copy.applescript
set old_delims to AppleScript's text item delimiters
copy-server-loc copy.applescript
set AppleScript's text item delimiters to search_text
copy-server-loc copy.applescript
set parts to every text item of main_text
copy-server-loc copy.applescript
set AppleScript's text item delimiters to replace_text
copy-server-loc copy.applescript
set newText to (parts as string)
copy-server-loc copy.applescript
set AppleScript's text item delimiters to old_delims
copy-server-loc copy.applescript
return newText
copy-server-loc copy.applescript
end SAR
copy-server-loc copy.applescript
on open theseItems
copy-server-loc copy.applescript
set ipAdress to "10.50.0.17" as text
copy-server-loc copy.applescript
set macFilePath to {}
copy-server-loc copy.applescript
repeat with oneFile in theseItems
copy-server-loc copy.applescript