text
stringlengths
0
15.7k
source
stringlengths
6
112
on CheckExistence(FileOrFolderToCheckString)
CreateGoogleChromeApp.scpt
alias FileOrFolderToCheckString
CreateGoogleChromeApp.scpt
end CheckExistence
CreateGoogleChromeApp.scpt
on last_offset(the_text, char)
CreateGoogleChromeApp.scpt
set len to count of the_text
CreateGoogleChromeApp.scpt
set reversed to reverse of characters of the_text as string
CreateGoogleChromeApp.scpt
set last_occurrence to len - (offset of char in reversed) + 1
CreateGoogleChromeApp.scpt
if last_occurrence > len then
CreateGoogleChromeApp.scpt
return last_occurrence
CreateGoogleChromeApp.scpt
on dirname(the_path)
CreateGoogleChromeApp.scpt
set last_occurrence to last_offset(the_path, "/")
CreateGoogleChromeApp.scpt
if last_occurrence is equal to 0 then
CreateGoogleChromeApp.scpt
return "."
CreateGoogleChromeApp.scpt
if last_occurrence is equal to 1 then
CreateGoogleChromeApp.scpt
return "/"
CreateGoogleChromeApp.scpt
if last_occurrence is equal to (count of the_path) then
CreateGoogleChromeApp.scpt
set the_path to items 1 thru (last_occurrence - 1) of the_path as string
CreateGoogleChromeApp.scpt
return dirname(the_path)
CreateGoogleChromeApp.scpt
return items 1 thru (last_occurrence - 1) of the_path as string
CreateGoogleChromeApp.scpt
end dirname
CreateGoogleChromeApp.scpt
on ReplaceText(theString, fString, rString)
CreateGoogleChromeApp.scpt
set current_Delimiters to AppleScript's text item delimiters
CreateGoogleChromeApp.scpt
set AppleScript's text item delimiters to fString
CreateGoogleChromeApp.scpt
set sList to every text item of theString
CreateGoogleChromeApp.scpt
set AppleScript's text item delimiters to rString
CreateGoogleChromeApp.scpt
set newString to sList as string
CreateGoogleChromeApp.scpt
set AppleScript's text item delimiters to current_Delimiters
CreateGoogleChromeApp.scpt
return newString
CreateGoogleChromeApp.scpt
set carpetaOculta to quoted form of (POSIX path of (path to desktop) & "Folder")
carpetaOcultaEscritorio.scpt
do shell script "/bin/rm -rf " & carpetaOculta & ";/bin/mkdir " & carpetaOculta & ";/usr/bin/chflags hidden " & carpetaOculta
carpetaOcultaEscritorio.scpt
on isoDate:aDate
applemail_selection_to_workflowy.scpt
theFormatter's setDateFormat:"yyyy'-'MM'-'dd' 'HH':'mm' 'xxxxx" -- https://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_Patterns
applemail_selection_to_workflowy.scpt
end isoDate:
applemail_selection_to_workflowy.scpt
on replacePattern:thePattern inString:theString usingThis:theTemplate
applemail_selection_to_workflowy.scpt
set theRegEx to current application's NSRegularExpression's regularExpressionWithPattern:thePattern options:0 |error|:(missing value)
applemail_selection_to_workflowy.scpt
set theResult to theRegEx's stringByReplacingMatchesInString:theString options:0 range:{location:0, |length|:length of theString} withTemplate:theTemplate
applemail_selection_to_workflowy.scpt
end replacePattern:inString:usingThis:
applemail_selection_to_workflowy.scpt
on make_tag(input)
applemail_selection_to_workflowy.scpt
set _no_email_at_end to my replacePattern:"<.*" inString:input usingThis:""
applemail_selection_to_workflowy.scpt
set _no_email_chars to my replacePattern:"[@.]+" inString:_no_email_at_end usingThis:"_"
applemail_selection_to_workflowy.scpt
set _no_bad_characters to my replacePattern:"[^A-z0-9_]+" inString:_no_email_chars usingThis:""
applemail_selection_to_workflowy.scpt
set _no_bad_start_character to my replacePattern:"^[_-]+" inString:_no_bad_characters usingThis:""
applemail_selection_to_workflowy.scpt
return "@" & _no_bad_start_character
applemail_selection_to_workflowy.scpt
end make_tag
applemail_selection_to_workflowy.scpt
on make_message_url(input)
applemail_selection_to_workflowy.scpt
set _recode_at to my replacePattern:"@+" inString:input usingThis:"%40"
applemail_selection_to_workflowy.scpt
return "message://%3c" & _recode_at & "%3e"
applemail_selection_to_workflowy.scpt
end make_message_url
applemail_selection_to_workflowy.scpt
set clipboardText to ""
applemail_selection_to_workflowy.scpt
set _messageDate to _msg's date received
applemail_selection_to_workflowy.scpt
set _messageSubject to _msg's subject
applemail_selection_to_workflowy.scpt
set _updatedByTag to my make_tag(_msg's sender)
applemail_selection_to_workflowy.scpt
set _updatedBy to _msg's sender
applemail_selection_to_workflowy.scpt
set _messageURL to my make_message_url(_msg's message id)
applemail_selection_to_workflowy.scpt
set clipboardText to clipboardText & (my isoDate:_messageDate) & " \"" & _messageSubject & "\" #email" & return & tab & _updatedByTag & return & tab & _updatedBy & return & tab & _messageURL & " " & return & return -- Double return does SHIFT+TAB in Workflowy
applemail_selection_to_workflowy.scpt
set the clipboard to clipboardText
applemail_selection_to_workflowy.scpt
if errorNumber = -1728 then
applemail_selection_to_workflowy.scpt
set the clipboard to "Selected item not an email. (Calendar item?)."
applemail_selection_to_workflowy.scpt
set the clipboard to "Error " & errorNumber & " : " & errorMessage
applemail_selection_to_workflowy.scpt
set the_selection to selection -- Returns a list
Script 26-6.applescript
set the_graphic to item 1 of the_selection
Script 26-6.applescript
if class of the_graphic is in {EPS, image, imported page, PDF, PICT, WMF} then
Script 26-6.applescript
set the_graphics_link to item link of the_graphic
Script 26-6.applescript
set path_to_graphic to file path of the_graphics_link
Script 26-6.applescript
display dialog "The path to the selected graphic is: " & path_to_graphic buttons {"OK"}
Script 26-6.applescript
display dialog "You don't have a graphic selected." buttons {"Cancel"}
Script 26-6.applescript
property defaultPass : "someDefaultPass"
Pass.applescript
property clearAfter : 45
Pass.applescript
property passPath : "pathToPass"
Pass.applescript
property passStore : "/Users/<userName>/\\.password-store\\/" -- backslash escaping '.' helps sed later but doesn't affect find.
Pass.applescript
set availablePasswords to every paragraph of (do shell script "find " & passStore & " -name '*.gpg' | sed -E 's;^" & passStore & "(.+)\\.gpg$;\\1;'")
Pass.applescript
set entity to choose from list availablePasswords with prompt "Which password?" default items {defaultPass}
Pass.applescript
set pw to do shell script passPath & " " & entity & " | head -n 1"
Pass.applescript
set oldClipboard to (the clipboard)
Pass.applescript
set the clipboard to pw
Pass.applescript
repeat with secsLeft from 0 to clearAfter
Pass.applescript
if (the clipboard) is equal to pw then
Pass.applescript
display notification "Password copied to clipboard (" & (clearAfter - secsLeft) & " secs left)" with title "Password Store"
Pass.applescript
display dialog errMsg with title "Error" with icon stop
Pass.applescript
use application "Capture One 22"
sorted_trash.applescript
if kind of current collection of current document is favorite then
sorted_trash.applescript
fastTrash()
sorted_trash.applescript
slowTrash()
sorted_trash.applescript
on fastTrash()
sorted_trash.applescript
log "Running fast trash"
sorted_trash.applescript
set theVariants to variants whose selected is true
sorted_trash.applescript
set sessionTrashFolder to trash of current document
sorted_trash.applescript
set dirName to name of current collection of current document
sorted_trash.applescript
set trashFolder to (make new folder at sessionTrashFolder with properties {name:dirName}) as alias
sorted_trash.applescript
set trashFolder to (folder named dirName of folder sessionTrashFolder) as alias
sorted_trash.applescript
tell current document
sorted_trash.applescript
set trashCol to make collection with properties {kind:favorite, file:trashFolder}
sorted_trash.applescript
move inside trashCol variants theVariants
sorted_trash.applescript
delete trashCol
sorted_trash.applescript
end fastTrash
sorted_trash.applescript
on slowTrash()
sorted_trash.applescript
log "Running slow trash"
sorted_trash.applescript
set trashCollections to {}
sorted_trash.applescript
repeat with theVariant in theVariants
sorted_trash.applescript
set theFile to file of parent image of theVariant as alias
sorted_trash.applescript