I'm always curious about how people use AppleScript to facilitate their workflow. I've created a few small AppleScripts that I've found useful and thought I'd post them to this list. I also make heavy use of others' works - in particular, scripts for "Add Tags to Selected", "Create List From Selected Items", "Create Web Archive From Bookmarks", "Launch Selected", and (from Safari) "Save Selection to Yojimbo". What other AppleScripts do people have that they use on a regular basis to help them manage their information flow?
None of these are particular polished (as a professional programmer, AppleScript is such a foreign looking language to me) so if anyone has suggestions for improvements, I'm happy to take them. --- Combine Selected Items: --- tell application "Yojimbo" set theNewName to text returned of (display dialog "Name" default answer "Unnamed Combined Note")
set selectedItems to (selected items of browser window 1) as list set theNewContent to "Combined note from " & the (count of selectedItems) & " items" & return & return repeat with i from 1 to the count of selectedItems set theContent to contents of contents of item i of selectedItems set theDate to the modification date of item i of selectedItems set theName to the name of item i of selectedItems set theNewContent to theNewContent & "======" & return & theName & return & theDate & return & "------" & return & theContent & return end repeat make new note item with properties {name:theNewName} with contents theNewContent end tell --- Open Selected in Yojimbo: (This one I could definitely use some help with. If there's a way to wait for the file to be saved and closed, then read the file and insert it back into Yojimbo, this script would be much more useful. If someone knows how to do that, there are probably handful of other items that we could funnel through and take back. Or perhaps someone at BareBones would be so kind as to build in a "filter through program" function?) --- tell application "Yojimbo" set selectedItems to (selected items of browser window 1) as list set theContent to contents of contents of selectedItems end tell
set filename to random number from 1 to 10000
set the tempFile to ((path to the temporary items folder) as string) & filename & ".txt"
open for access tempFile write theContent to (tempFile as alias) as string close tempFile
set theFile to POSIX path of tempFile
tell application "TaskPaper" open theFile end tell --- Autocreate Tag Browser: (I've posted this previously.) --- tell application "Yojimbo"
set tc_names to (name of tag collections)
repeat with t in tags (* TODO - Check if there are any items for this tag and, if not, offer dialog to delete both the tag and tag collection *) set t_name to name of t if tc_names does not contain t_name then (* Create tag collection for missing tags *) set tc to (make new tag collection) set name of tc to t_name add tags t_name to tc end if end repeat
end tell --- FOR VOODOOPAD TO YOJIMBO: Export From VoodooPad to Yojimbo: --- tell application "VoodooPad Pro" tell front document repeat with thePage in pages set theName to display name of thePage set theCategories to categories of thePage set theText to text of thePage tell application "Yojimbo" set end of theCategories to "voodooexport" set newItem to make new note item set name of newItem to theName set contents of contents of newItem to theText add tags theCategories to newItem end tell end repeat end tell end tell --- FOR ENTOURAGE TO YOJIMBO: Save to Yojimbo: --- set newLine to " "
tell application "Microsoft Entourage" set theMsg to item 1 of (get current messages) set theSubject to subject of theMsg set theSender to sender of theMsg set theSenderAddress to address of theSender set theSenderDisplayName to display name of theSender set theContent to content of theMsg set theTimeRecieved to time received of theMsg tell application "Yojimbo" set yContents to "SUBJECT: " & theSubject & newLine set yContents to yContents & "FROM: " & theSenderDisplayName & "<" & theSenderAddress & ">" & newLine set yContents to yContents & "DATE: " & theTimeRecieved & newLine set yContents to yContents & newLine & theContent set newItem to make new note item with properties {name:theSubject, comments:theSenderDisplayName, contents:yContents} add tags {"email"} to newItem activate end tell end tell
-- ------------------------------------------------------------------ This message is sent to you because you are subscribed to the mailing list <yojimbo-talk@barebones.com>. To unsubscribe, send mail to: <yojimbo-talk-off@barebones.com> List archives: <http://www.listsearch.com/yojimbotalk.lasso> Have a feature request, or not sure if the software's working correctly? Please send mail to: <support@barebones.com>
Apr 02
Lorin Rivers Re: Fistful of Scripts
Apr 02, 2008; 12:57
Lorin Rivers
Re: Fistful of Scripts
Search
Lasso Programming
This site manages and broadcasts several email lists pertaining to Lasso Programming and technologies related and used by Lasso developers. Sign up today!