General-Purpose Applescript for Office Work
I would like to share my own developments of several Applescript solutions, for which literally everyone can find an application, and at the same time hear examples of other similar universal solutions of “general purpose”. I’ll make a reservation that I run scripts through hot keys, binding the buttons to launch the necessary scripts through Quicksilver, this binding takes 5 seconds.
So, from such general-purpose scripts that will suit literally everyone regardless of activity, I created the following.
1. Send the selected file by mail with the desired subject line, the desired body text and the right recipient:
2. Open the desired folder:
3. Make a reminder from the highlighted letter:
4. Paint the letter in, for example, red:
5. Get the path to the folder or file - for example, to insert in a letter or chat:
It seemed to me the most convenient way to launch hot keys through Alt - for “pansystem” calls it is actually free, while Cmd has a lot of basic functions inside applications, and Ctrl again creates a lot of custom functions inside applications. And here alt + r - sent mail to reminders for example.
I would be very glad to see in the comments any ideas for scripts that could be useful for routine operations, regardless of the type of activity.
So, from such general-purpose scripts that will suit literally everyone regardless of activity, I created the following.
1. Send the selected file by mail with the desired subject line, the desired body text and the right recipient:
property Myrecipient : "ОТПРАВИТЕЛЬ"
property mysubject : "ТЕМА"
property EmailBody : "ТЕКСТ"
on run
tell application "Finder"
set sel to (get selection)
end tell
new_mail(sel)
end run
on open droppedFiles
new_mail(droppedFiles)
end open
on new_mail(theFiles)
tell application "Mail"
set newMessage to make new outgoing message with properties {visible:true, subject:mysubject, content:EmailBody}
tell newMessage
make new to recipient with properties {address:Myrecipient}
tell content
repeat with oneFile in theFiles
make new attachment with properties {file name:oneFile as alias} at after the last paragraph
end repeat
end tell
end tell
activate
end tell
end new_mail
2. Open the desired folder:
tell application "Finder"
activate
open folder "ПАПКА" of folder "НАДПАПКА" of folder "ПОЛЬЗОВАТЕЛЬ" of folder "Users" of startup disk
end tell
3. Make a reminder from the highlighted letter:
tell application "Mail"
using terms from application "Mail"
set selectedMails to selection
set theMessage to first item of selectedMails
set theBody to "message:%3C" & message id of theMessage & "%3E"
set theSubject to the subject of theMessage & " (From " & the sender of theMessage & ")"
tell application "Reminders"
set theList to list "Inbox"
set newToDo to make new reminder with properties {name:theSubject, body:theBody, container:theList}
end tell
end using terms from
end tell
4. Paint the letter in, for example, red:
tell application "Mail"
set maillist to selection
repeat with i from 1 to number of items in maillist
set this_item to item i of maillist
if class of this_item is message then
set background color of this_item to red
-- other colors are
-- gray / green / orange / red
end if
end repeat
end tell
5. Get the path to the folder or file - for example, to insert in a letter or chat:
>tell application "Finder"
set sel to the selection as text
set the clipboard to POSIX path of sel
end tell
It seemed to me the most convenient way to launch hot keys through Alt - for “pansystem” calls it is actually free, while Cmd has a lot of basic functions inside applications, and Ctrl again creates a lot of custom functions inside applications. And here alt + r - sent mail to reminders for example.
I would be very glad to see in the comments any ideas for scripts that could be useful for routine operations, regardless of the type of activity.