text
stringlengths
0
15.7k
source
stringlengths
6
112
else -- Save email as PDF and print it
mail2pdfandprint.scpt
set desktop_pdf_name to my checkname_with_pdf_suffix("1.pdf", path to desktop, false)
mail2pdfandprint.scpt
set the clipboard to desktop_pdf_name
mail2pdfandprint.scpt
tell process "Mail"
mail2pdfandprint.scpt
set wc to count of every window
mail2pdfandprint.scpt
my print_current_mail_as_pdf()
mail2pdfandprint.scpt
repeat until (count of every window) is wc
mail2pdfandprint.scpt
if currentSender contains "partner-abrechnung@amazon.de" then
mail2pdfandprint.scpt
set pdfDateiName to currentDateSent & "_Amazon_Gutschrift_" & (rich text 57 through end of currentSubject) & ".pdf"
mail2pdfandprint.scpt
set pdfDateiName to currentDateSent & "_" & currentSender & "_" & currentSubject
mail2pdfandprint.scpt
display dialog "Name der Datei:" default answer pdfDateiName with icon note
mail2pdfandprint.scpt
set pdfDateiName to text returned of the result & ".pdf"
mail2pdfandprint.scpt
my move_desktop_pdf(desktop_pdf_name, currentFolder2Store, pdfDateiName)
mail2pdfandprint.scpt
keystroke "w" using command down
mail2pdfandprint.scpt
to move_desktop_pdf(desktop_pdf_name, currentFolder2Store, pdfDateiName)
mail2pdfandprint.scpt
set finalname to checkname_with_pdf_suffix("__message.pdf", currentFolder2Store, false)
mail2pdfandprint.scpt
do shell script "mv " & quoted form of (POSIX path of (path to "desk") & desktop_pdf_name) & " " & quoted form of (POSIX path of currentFolder2Store & pdfDateiName)
mail2pdfandprint.scpt
on error msg
mail2pdfandprint.scpt
error "Fehler beim Bewegen der gedruckten Nachricht: " & msg as text
mail2pdfandprint.scpt
end move_desktop_pdf
mail2pdfandprint.scpt
to getEmail(mailstring)
mail2pdfandprint.scpt
if mailstring contains "<" then
mail2pdfandprint.scpt
return (characters ((offset of "<" in mailstring) + 1) through ((offset of ">" in mailstring) - 1) of mailstring) as text
mail2pdfandprint.scpt
return mailstring
mail2pdfandprint.scpt
end getEmail
mail2pdfandprint.scpt
to getDatestring(thedate)
mail2pdfandprint.scpt
set monthnum to characters -2 through -1 of ("0" & ((month of thedate) as integer)) as text
mail2pdfandprint.scpt
set daynum to characters -2 through -1 of ("0" & ((day of thedate) as integer)) as text
mail2pdfandprint.scpt
set yearnum to year of the thedate
mail2pdfandprint.scpt
return yearnum & "-" & monthnum & "-" & daynum as text
mail2pdfandprint.scpt
end getDatestring
mail2pdfandprint.scpt
to create_messagefolder(thepath)
mail2pdfandprint.scpt
do shell script "mkdir -p " & quoted form of POSIX path of thepath
mail2pdfandprint.scpt
error msg
mail2pdfandprint.scpt
end create_messagefolder
mail2pdfandprint.scpt
to replace_chars(this_text, search_string, replacement_string)
mail2pdfandprint.scpt
if this_text contains the search_string then
mail2pdfandprint.scpt
set AppleScript's text item delimiters to the search_string
mail2pdfandprint.scpt
set the item_list to every text item of this_text
mail2pdfandprint.scpt
set AppleScript's text item delimiters to the replacement_string
mail2pdfandprint.scpt
set this_text to the item_list as string
mail2pdfandprint.scpt
set AppleScript's text item delimiters to ""
mail2pdfandprint.scpt
return this_text
mail2pdfandprint.scpt
end replace_chars
mail2pdfandprint.scpt
to checkname_with_pdf_suffix(n, D, looped)
mail2pdfandprint.scpt
set thefiles to name of every item of (D as alias)
mail2pdfandprint.scpt
if thefiles contains n then
mail2pdfandprint.scpt
if looped = false then
mail2pdfandprint.scpt
set n to ((characters 1 through -5 of n) & " 1" & (characters -4 through -1 of n)) as text
mail2pdfandprint.scpt
my checkname_with_pdf_suffix(n, D, true)
mail2pdfandprint.scpt
set tmp to (last word of ((characters 1 through -5 of n) as text) as integer)
mail2pdfandprint.scpt
set tmpcount to (count of characters of (tmp as text)) + 5
mail2pdfandprint.scpt
set tmp to tmp + 1
mail2pdfandprint.scpt
set n to ((characters 1 through (-1 * tmpcount) of n) & tmp & (characters -4 through -1 of n)) as text
mail2pdfandprint.scpt
return n
mail2pdfandprint.scpt
end checkname_with_pdf_suffix
mail2pdfandprint.scpt
to print_current_mail_as_pdf()
mail2pdfandprint.scpt
keystroke "p" using command down
mail2pdfandprint.scpt
set p to "false"
mail2pdfandprint.scpt
repeat until 0 = 1
mail2pdfandprint.scpt
if (count of every sheet of window 1) > 0 then
mail2pdfandprint.scpt
set p to "ready"
mail2pdfandprint.scpt
exit repeat
mail2pdfandprint.scpt
if p = "ready" then
mail2pdfandprint.scpt
click menu button 1 of sheet 1 of window 1
mail2pdfandprint.scpt
delay 0.25
mail2pdfandprint.scpt
key code 125
mail2pdfandprint.scpt
set cwc to count of every window
mail2pdfandprint.scpt
keystroke return
mail2pdfandprint.scpt
repeat until 1 = 0
mail2pdfandprint.scpt
if (cwc + 1) = (count of every window) then
mail2pdfandprint.scpt
click text field 1 of window 1
mail2pdfandprint.scpt
keystroke "a" using command down
mail2pdfandprint.scpt
keystroke "v" using command down
mail2pdfandprint.scpt
keystroke "d" using command down
mail2pdfandprint.scpt
error "timeout"
mail2pdfandprint.scpt
end print_current_mail_as_pdf
mail2pdfandprint.scpt
to check_message_viewer_and_return_selection()
mail2pdfandprint.scpt
set frontmost_message_viewer to {}
mail2pdfandprint.scpt
repeat with i from 1 to count of every message viewer
mail2pdfandprint.scpt
if index of window of message viewer i = 1 then
mail2pdfandprint.scpt
set frontmost_message_viewer to message viewer i
mail2pdfandprint.scpt
if frontmost_message_viewer = {} then
mail2pdfandprint.scpt
error "Ist ja gar kein Message Viewer im Vordergrund, so kann ich einfach nicht arbeiten!"
mail2pdfandprint.scpt
return selection
mail2pdfandprint.scpt
end check_message_viewer_and_return_selection
mail2pdfandprint.scpt
set the_finds to {space & space, return & space, return & return}
Script 26-8.applescript
set the_changes to {space, return, return}
Script 26-8.applescript
tell application "Adobe InDesign CS4"
Script 26-8.applescript
set user interaction level of script preferences to interact with all
Script 26-8.applescript
set selections_list to selection
Script 26-8.applescript
if length of selections_list ≠ 1 then
Script 26-8.applescript
display dialog "Please select some text or a text frame." buttons {"Cancel"}
Script 26-8.applescript
error number -128
Script 26-8.applescript
set the_selection to item 1 of selections_list
Script 26-8.applescript
set item_class to class of the_selection
Script 26-8.applescript
if item_class is in {insertion point, character} then
Script 26-8.applescript
set the_selection to parent of the_selection
Script 26-8.applescript
else if item_class is text frame then
Script 26-8.applescript
set the_selection to parent story of the_selection
Script 26-8.applescript