text
stringlengths
0
15.7k
source
stringlengths
6
112
set plutil to std's import("plutil")'s new()
log4as.applescript
set mapLib to std's import("map")
log4as.applescript
loadPlist()
log4as.applescript
end init
log4as.applescript
tell application "System Events" to set frontapp to name of first process whose frontmost is true
Close-All-Without-Saving.applescript
tell application frontapp to close every document without saving
Close-All-Without-Saving.applescript
on run
writeToScriptEditor.applescript
set fileName to "my new script"
writeToScriptEditor.applescript
set fileContent to "say \"hello world\""
writeToScriptEditor.applescript
writeToScriptDocument(fileName, fileContent)
writeToScriptEditor.applescript
on writeToScriptDocument(fileName, fileContent)
writeToScriptEditor.applescript
tell application "Script Editor"
writeToScriptEditor.applescript
make new document with properties {name:fileName, contents:fileContent}
writeToScriptEditor.applescript
end writeToScriptDocument
writeToScriptEditor.applescript
on encode(value)
json.applescript
set type to class of value
json.applescript
if type = integer or type = boolean
json.applescript
return value as text
json.applescript
else if type = text
json.applescript
return encodeString(value)
json.applescript
else if type = list
json.applescript
return encodeList(value)
json.applescript
else if type = script
json.applescript
return value's toJson()
json.applescript
error "Unknown type " & type
json.applescript
end
json.applescript
on encodeList(value_list)
json.applescript
set out_list to {}
json.applescript
repeat with value in value_list
json.applescript
copy encode(value) to end of out_list
json.applescript
return "[" & join(out_list, ", ") & "]"
json.applescript
on encodeString(value)
json.applescript
set rv to ""
json.applescript
set codepoints to id of value
json.applescript
if (class of codepoints) is not list
json.applescript
set codepoints to {codepoints}
json.applescript
repeat with codepoint in codepoints
json.applescript
set codepoint to codepoint as integer
json.applescript
if codepoint = 34
json.applescript
set quoted_ch to "\\\""
json.applescript
else if codepoint = 92 then
json.applescript
set quoted_ch to "\\\\"
json.applescript
else if codepoint >= 32 and codepoint < 127
json.applescript
set quoted_ch to character id codepoint
json.applescript
set quoted_ch to "\\u" & hex4(codepoint)
json.applescript
set rv to rv & quoted_ch
json.applescript
return "\"" & rv & "\""
json.applescript
on join(value_list, delimiter)
json.applescript
set original_delimiter to AppleScript's text item delimiters
json.applescript
set AppleScript's text item delimiters to delimiter
json.applescript
set rv to value_list as text
json.applescript
set AppleScript's text item delimiters to original_delimiter
json.applescript
return rv
json.applescript
on hex4(n)
json.applescript
set digit_list to "0123456789abcdef"
json.applescript
repeat until length of rv = 4
json.applescript
set digit to (n mod 16)
json.applescript
set n to (n - digit) / 16 as integer
json.applescript
set rv to (character (1+digit) of digit_list) & rv
json.applescript
on createDictWith(item_pairs)
json.applescript
set item_list to {}
json.applescript
script Dict
json.applescript
on setkv(key, value)
json.applescript
copy {key, value} to end of item_list
json.applescript
on toJson()
json.applescript
set item_strings to {}
json.applescript
repeat with kv in item_list
json.applescript
set key_str to encodeString(item 1 of kv)
json.applescript
set value_str to encode(item 2 of kv)
json.applescript
copy key_str & ": " & value_str to end of item_strings
json.applescript
return "{" & join(item_strings, ", ") & "}"
json.applescript
repeat with pair in item_pairs
json.applescript
Dict's setkv(item 1 of pair, item 2 of pair)
json.applescript
return Dict
json.applescript
on createDict()
json.applescript
return createDictWith({})
json.applescript
global frontmost_message_viewer
mail2pdfandprint.scpt
set mymailboxpath to (path to documents folder) & "Buchfuehrung:2013 Buchfuehrung:2013 Kreditoren NSAH:" as text
mail2pdfandprint.scpt
set loopCounter to 0
mail2pdfandprint.scpt
tell application "Mail"
mail2pdfandprint.scpt
set myselection to my check_message_viewer_and_return_selection()
mail2pdfandprint.scpt
repeat with currentMail in myselection
mail2pdfandprint.scpt
set loopCounter to loopCounter + 1 -- Workaround for Gmail E-Mails with multible Labels
mail2pdfandprint.scpt
if loopCounter = 1 then
mail2pdfandprint.scpt
open currentMail
mail2pdfandprint.scpt
set currentSender to my (getEmail(sender of currentMail))
mail2pdfandprint.scpt
set currentDateSent to my getDatestring(date sent of currentMail)
mail2pdfandprint.scpt
set currentSubject to my replace_chars(my replace_chars(my replace_chars(my replace_chars(my replace_chars(my replace_chars(subject of currentMail, ":", "_"), "/", "_"), " ", "_"), "(", ""), ")", ""), ".", "") --Doppelpunkte kommen bei Dateinamen nicht so gut
mail2pdfandprint.scpt
set currentFolder2Store to mymailboxpath
mail2pdfandprint.scpt
set attachCount to count of (mail attachments of currentMail)
mail2pdfandprint.scpt
if attachCount is not equal to 0 then
mail2pdfandprint.scpt
repeat with a in (every mail attachment of currentMail)
mail2pdfandprint.scpt
set current_a_name to name of a
mail2pdfandprint.scpt
set current_a_name to my checkname_with_pdf_suffix(current_a_name, currentFolder2Store, false)
mail2pdfandprint.scpt
if current_a_name contains "pdf" then -- Only for PDF attachments
mail2pdfandprint.scpt
set current_a_name to currentDateSent & "_" & current_a_name
mail2pdfandprint.scpt
display dialog "Name der Datei:" default answer current_a_name with icon note
mail2pdfandprint.scpt
set current_a_name to text returned of the result
mail2pdfandprint.scpt
save a in (currentFolder2Store & current_a_name as rich text)
mail2pdfandprint.scpt
do shell script "lp -d Brother_MFC_J5910DW -o PageSize=A4 -o fit-to-page -o BRMonoColor=Mono " & quoted form of POSIX path of (currentFolder2Store & current_a_name as rich text)
mail2pdfandprint.scpt