text
stringlengths
0
15.7k
source
stringlengths
6
112
on zettelFromDate:aDate
zettel.applescript
set theFormatter to current application's NSDateFormatter's new()
zettel.applescript
theFormatter's setLocale:(current application's NSLocale's localeWithLocaleIdentifier:"en_US_POSIX")
zettel.applescript
theFormatter's setDateFormat:"yyyyMMddHHmmss"
zettel.applescript
return (theFormatter's stringFromDate:aDate) as text
zettel.applescript
end zettelFromDate:
zettel.applescript
use framework "OSAKit"
00 Import scripts as links.applescript
set scriptFiles to choose file with prompt "Please select the scripts to import" of type {"applescript"} with multiple selections allowed
00 Import scripts as links.applescript
repeat with eachScript in scriptFiles
00 Import scripts as links.applescript
set aURL to (current application's |NSURL|'s fileURLWithPath:(POSIX path of eachScript))
00 Import scripts as links.applescript
set destinationURL to (aURL's URLByDeletingPathExtension()'s URLByAppendingPathExtension:"scpt")
00 Import scripts as links.applescript
set eachScriptContents to paragraphs of (read eachScript)
00 Import scripts as links.applescript
set scriptContents to ""
00 Import scripts as links.applescript
log "-----------"
00 Import scripts as links.applescript
set userDefinedVariables to false
00 Import scripts as links.applescript
repeat with eachLine in eachScriptContents
00 Import scripts as links.applescript
if eachLine contains "@description" then
00 Import scripts as links.applescript
set eachScriptDescription to trimLine(eachLine, "-- @description ", 0)
00 Import scripts as links.applescript
log "Description: " & eachScriptDescription
00 Import scripts as links.applescript
else if eachLine contains "@author" then
00 Import scripts as links.applescript
set eachScriptAuthor to trimLine(eachLine, "-- @author ", 0)
00 Import scripts as links.applescript
log "Author: " & eachScriptAuthor
00 Import scripts as links.applescript
else if eachLine contains "@source" then
00 Import scripts as links.applescript
set eachScriptSource to trimLine(eachLine, "-- @source ", 0)
00 Import scripts as links.applescript
log "Source: " & eachScriptSource
00 Import scripts as links.applescript
else if eachLine contains "@version" then
00 Import scripts as links.applescript
set eachScriptVersion to trimLine(eachLine, "-- @version ", 0)
00 Import scripts as links.applescript
log "Version: " & eachScriptVersion
00 Import scripts as links.applescript
else if eachLine contains "@testedmacos" then
00 Import scripts as links.applescript
set eachScriptMacOS to trimLine(eachLine, "-- @testedmacos ", 0)
00 Import scripts as links.applescript
log "MacOS: " & eachScriptMacOS
00 Import scripts as links.applescript
else if eachLine contains "@testedqlab" then
00 Import scripts as links.applescript
set eachScriptQlab to trimLine(eachLine, "-- @testedqlab ", 0)
00 Import scripts as links.applescript
log "Qlab: " & eachScriptQlab
00 Import scripts as links.applescript
else if eachLine contains "@about" then
00 Import scripts as links.applescript
set eachScriptAbout to trimLine(eachLine, "-- @about ", 0)
00 Import scripts as links.applescript
log "About: " & eachScriptAbout
00 Import scripts as links.applescript
else if eachLine contains "@separateprocess" then
00 Import scripts as links.applescript
set eachScriptSeparateProcess to trimLine(eachLine, "-- @separateprocess ", 0)
00 Import scripts as links.applescript
log "Separate Process: " & eachScriptSeparateProcess
00 Import scripts as links.applescript
if eachLine contains "USER DEFINED VARIABLES ---" then
00 Import scripts as links.applescript
set userDefinedVariables to true
00 Import scripts as links.applescript
set userDefinedVariablesContent to ""
00 Import scripts as links.applescript
else if eachLine contains "--- END OF USER DEFINED VARIABLES" then
00 Import scripts as links.applescript
set userDefinedVariablesContent to userDefinedVariablesContent & "
00 Import scripts as links.applescript
" & eachLine
00 Import scripts as links.applescript
if userDefinedVariables is true then
00 Import scripts as links.applescript
set eachLine to ""
00 Import scripts as links.applescript
if eachLine does not contain "-- @" and eachLine does not contain "-- " then
00 Import scripts as links.applescript
set scriptContents to scriptContents & "
00 Import scripts as links.applescript
set scriptContents to my trimLine(scriptContents, "
00 Import scripts as links.applescript
", 0)
00 Import scripts as links.applescript
if eachScriptSeparateProcess is "FALSE" then return -- scripts need to work as a separate process for this method
00 Import scripts as links.applescript
set {theScript, theError} to (current application's OSAScript's alloc()'s initWithContentsOfURL:aURL |error|:(reference))
00 Import scripts as links.applescript
if theScript is missing value then error theError's |description|() as text
00 Import scripts as links.applescript
set {theResult, theError} to (theScript's compileAndReturnError:(reference))
00 Import scripts as links.applescript
if theResult as boolean is false then return theError's |description|() as text
00 Import scripts as links.applescript
set {theResult, theError} to (theScript's writeToURL:destinationURL ofType:"scpt" usingStorageOptions:0 |error|:(reference))
00 Import scripts as links.applescript
set newPathAlias to destinationURL as alias
00 Import scripts as links.applescript
set newPath to POSIX path of newPathAlias
00 Import scripts as links.applescript
log newPath
00 Import scripts as links.applescript
if (length of scriptFiles is 1) and (length of selectedCues is 1) and (q type of item 1 of selectedCues is "Script") then
00 Import scripts as links.applescript
set scriptCue to last item of (selected as list)
00 Import scripts as links.applescript
make type "Script"
00 Import scripts as links.applescript
set q name of scriptCue to eachScriptDescription
00 Import scripts as links.applescript
set cueName to name of eachScript
00 Import scripts as links.applescript
set cueName to my trimLine(cueName, ".applescript", 1)
00 Import scripts as links.applescript
set q name of scriptCue to cueName
00 Import scripts as links.applescript
set cueNote to eachScriptAbout
00 Import scripts as links.applescript
set cueNote to cueNote & " (" & eachScriptAuthor
00 Import scripts as links.applescript
set cueNote to cueNote & " // " & eachScriptSource & ")"
00 Import scripts as links.applescript
set cueNote to cueNote & ")"
00 Import scripts as links.applescript
set notes of scriptCue to cueNote
00 Import scripts as links.applescript
set newScriptSource to "set theScript to load script \"" & (newPath) & "\"
00 Import scripts as links.applescript
run theScript"
00 Import scripts as links.applescript
set script source of scriptCue to "-- @version " & eachScriptVersion & "
00 Import scripts as links.applescript
set script source of scriptCue to ""
00 Import scripts as links.applescript
set script source of scriptCue to script source of scriptCue & userDefinedVariablesContent & "
00 Import scripts as links.applescript
" & newScriptSource
00 Import scripts as links.applescript
on trimLine(theText, trimChars, trimIndicator)
00 Import scripts as links.applescript
set x to the length of the trimChars
00 Import scripts as links.applescript
if the trimIndicator is in {0, 2} then
00 Import scripts as links.applescript
repeat while theText begins with the trimChars
00 Import scripts as links.applescript
set theText to characters (x + 1) thru -1 of theText as string
00 Import scripts as links.applescript
if the trimIndicator is in {1, 2} then
00 Import scripts as links.applescript
repeat while theText ends with the trimChars
00 Import scripts as links.applescript
set theText to characters 1 thru -(x + 1) of theText as string
00 Import scripts as links.applescript
end trimLine
00 Import scripts as links.applescript
set recipientAddress to item 1 of argv
jasenmaksut_2015.applescript
set refNumber to item 2 of argv
jasenmaksut_2015.applescript
set theSubject to "HWC Jäsen- ja lautapaikkamaksut 2015"
jasenmaksut_2015.applescript
set theContent to "Hei,
jasenmaksut_2015.applescript
Helsinki Windsurfing Clubin maksut kaudelta 2015 ovat:
jasenmaksut_2015.applescript
* Jäsenmaksu 20€
jasenmaksut_2015.applescript
* Lautapaikkavuokra 30€
jasenmaksut_2015.applescript
* Liittymismaksu 20€
jasenmaksut_2015.applescript
Ole hyvä ja maksa jäsenmaksusi ja mahdollinen lautapaikkavuokrasi,
jasenmaksut_2015.applescript
sekä liittymismaksusi tilille FI41 5800 1320 2592 02 (OKOYFIHH)
jasenmaksut_2015.applescript
käyttäen henkilökohtaista viitenumeroasi " & refNumber & ".
jasenmaksut_2015.applescript
Surffiterveisin,
jasenmaksut_2015.applescript