Apple Script / Automator crew: Help me out please :wtc:

Discussion in 'OT Technology' started by Ricky, Aug 3, 2008.

  1. Ricky

    Ricky █▄ █▄█ █▄ ▀█▄

    Joined:
    Jun 17, 2005
    Messages:
    38,767
    Likes Received:
    6
    Im in the middle of making a pretty kickass script but im having a llittle trouble on this one part.

    I basically want this one part to grab the text from an email, create a new text file and paste the contents in there.

    the contents will then become the variable for lets say

    set VARIABLE to "contentshere".

    Any help please :x:
     
  2. Ricky

    Ricky █▄ █▄█ █▄ ▀█▄

    Joined:
    Jun 17, 2005
    Messages:
    38,767
    Likes Received:
    6
    im guessing i have to use the property tag instead of set in this case for the applescript part?

    :o

    i suck at this shit:o
     
  3. mobbarley

    mobbarley Active Member

    Joined:
    Mar 4, 2005
    Messages:
    9,256
    Likes Received:
    2
    Location:
    Sydney
    um, explain the process again?
    grab all text from an email, then?
     
  4. Ricky

    Ricky █▄ █▄█ █▄ ▀█▄

    Joined:
    Jun 17, 2005
    Messages:
    38,767
    Likes Received:
    6
    then post the text into a new text file and save that.

    Then i want my apple script to create a variable with that text.
     
  5. Ricky

    Ricky █▄ █▄█ █▄ ▀█▄

    Joined:
    Jun 17, 2005
    Messages:
    38,767
    Likes Received:
    6
    you can even skip the create new text file if possible. i just figured that'd be a required step in order to make it create a variable :dunno:
     
  6. gui3

    gui3 all the dude ever wanted was his rug back

    Joined:
    May 6, 2000
    Messages:
    9,498
    Likes Received:
    2
    i couldnt figure out how to get it to grab text from anything easily, so i did a crappy workaround:

    i used "watch me do" to have it bring a window into focus, select text, then hit "COMMAND C"

    then later i had it do "COMMAND V"
     
  7. Ricky

    Ricky █▄ █▄█ █▄ ▀█▄

    Joined:
    Jun 17, 2005
    Messages:
    38,767
    Likes Received:
    6
    i dont htink that'll work for what im going to do :o:hs:
     
  8. JCrev

    JCrev Where is your god now? OT Supporter

    Joined:
    Jul 18, 2004
    Messages:
    3,852
    Likes Received:
    11
    Location:
    Montreal, Quebec
    I'd need more details about what you actually wanted to do with the text from the email to finish it but this should get you headed in the right direction.
    Code:
    using terms from application "Mail"
    	on perform mail action with messages selectedMessages
    		repeat with eachMessage in selectedMessages
    			tell application "Mail"
    				set MyVariable to content
    				(*All the shit you want to do with the content I don't really know what to do without more details*)
    			end tell
    			do shell script "MyVariable >> $HOME/Desktop/messages.txt"
    		end repeat
    	end perform mail action with messages
    end using terms from
    
     
  9. JCrev

    JCrev Where is your god now? OT Supporter

    Joined:
    Jul 18, 2004
    Messages:
    3,852
    Likes Received:
    11
    Location:
    Montreal, Quebec
    If your stuck when writing an applescript, you can drag and drop the application you want to script, over the script editor icon and it will open the applescript library for that program.
     
  10. Ricky

    Ricky █▄ █▄█ █▄ ▀█▄

    Joined:
    Jun 17, 2005
    Messages:
    38,767
    Likes Received:
    6
    really?

    thanks a lot for the script and advice.
     

Share This Page