Jump to content

uscmeche

Member
  • Posts

    3
  • Joined

  • Last visited

Everything posted by uscmeche

  1. Amazing script! Thank you. I was just about to code this myself, but thought I would search first.
  2. Was browsing and really appreciate the script. Added a bit to it for enumerating the files listed. Hopefully this code works for others. set filelist to "{query}" set oldDelimiters to AppleScript's text item delimiters set AppleScript's text item delimiters to " " set theArray to every text item of filelist set AppleScript's text item delimiters to oldDelimiters set itemList to "Attachments" & return set theCount to 0 if length of theArray is greater than 1 then repeat with eachitem in theArray set theCount to theCount + 1 try set oldDelims to AppleScript's text item delimiters -- save their current state set AppleScript's text item delimiters to {"/"} -- declare new delimiters set itemList to itemList & theCount & ". " & the last text item of eachitem & return set AppleScript's text item delimiters to oldDelims -- restore them on error set AppleScript's text item delimiters to oldDelims -- restore them in case something went wrong end try end repeat else set eachitem to item 1 of theArray set theCount to theCount + 1 try set oldDelims to AppleScript's text item delimiters -- save their current state set AppleScript's text item delimiters to {"/"} -- declare new delimiters set itemList to itemList & theCount & ". " & the last text item of eachitem set AppleScript's text item delimiters to oldDelims -- restore them on error set AppleScript's text item delimiters to oldDelims -- restore them in case something went wrong end try end if tell application "Mail" activate tell (make new outgoing message at end of outgoing messages with properties {visible:true, subject:"- - ATTACHMENT(S) ENCLOSED ", content:itemList & return}) repeat with eachitem in theArray set t to POSIX file eachitem make new attachment with properties {file name:t as alias} at after last paragraph end repeat end tell end tell
  3. Absolutely love this! I expanded a use case as well (possibly it is only a feature I would request), but the ability to append notes. I am not a great coder, so it is cobbled together on your front end (I am sure someone could optimize my code). Below is the look (used your clip.png) and then added a line calling the applescript. on run argv try my addNoteTask(item 1 of argv) on error errmsg return errmsg end try end run on addNoteTask(theTaskId) tell application "OmniFocus" tell default document set taskList to flattened tasks where id = theTaskId set theTask to item 1 of taskList set theNote to note of theTask --add in updated date set theUpdateDate to (current date) tell application "System Events" display dialog "What's Happening?" default answer "" set theNewText to (text returned of result) end tell set theText to return & "_______________________________________________________________________________________________________________________ #" & theUpdateDate & return & theNewText --append note to selection set theNote to theNote & theText set note of theTask to theNote set thisName to name of theTask end tell end tell --notify on success set successNotify to "You Added the text " & theNewText & " to the project " & thisName return successNotify end addNoteTask
×
×
  • Create New...