Jump to content
Sign in to follow this  
Followers 0
psunak99

save messages as text automatically in mail application

1 post in this topic

Recommended Posts

Hi everyone,

 

I get an email every 4 hours about certain data and I would like to save this email as text to a specified folder as soon as it arrives. The messages always comes from 1 sender (saydata.reporter@gmail.com). Is there a way to automatically save this message as text with some unique name (the name doesn't really matter) as soon as it is recieved? I tried creating a rule in mac mail application but it doesnt have an option to save to text. Also, i would like the date and time it was recieved to also be a part of the text file if possible.

 

Can this be done using an applescipt because i see an option to run applescript in the Rules tab in mail?

 

Thank you in advance

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By foolgladly
      Hello, everyone.  Long time listener, first time caller.
       
      Here's what I'm setting out to do:  because I can no longer reliably receive a delivery of the New York Times for my daily crossword obsession, I'm now a subscriber to their digital crossword.  I still prefer to do the puzzle on paper, and fortunately the NYT offers a scale PDF of the puzzle each day.  I'm hoping to write a script (I'm incredibly new to this) to download the file and print it every day so that I can feel like I live in a future where magic robots deliver my crossword puzzle to my printer each morning.
       
      The file naming scheme is simplistic and consistent.  As an example, here's today's PDF location:
       
      https://www.nytimes.com/svc/crosswords/v2/puzzle/print/Nov1017.pdf
       
      Obviously, the only thing changing here daily is the file name.  I'm hoping I can use today's date to scrape the relevant information and generate the correct filename on a daily basis.
       
      From there I assume it should be trivial to download the file to a specific location and automatically send it to the printer.  I've been poking around, and I have some level of confidence that I can pull off the downloading and printing parts.  I don't, however, have any idea how to get started generating the daily file name.
       
      Any assistance you can provide would be hugely helpful.  I know the basic answer is "learn to code, it's really helpful."  I'm willing to put some time and effort in here, but I figured this would be a great place to start.
       
      Thanks in advance, and happy Veteran's Day!
    • By midi-sama
      Hi, I'm back again with another tool. As you may have seen in my thread, there is a Automator + AppleScript (thanks to @thanh) to make the reinstall/fix for UPDD, so I decided to make one application for everything with no hassle, however, since I'm not a programer, I'm just using AppleScript (for its fairly easy use and scripting).
      I want you to help me out to fix (also optimize and clean) this script to make it better.
       
      Here is the script:
      -- Start with a welcome screen + password set pwd to text returned of (display dialog ¬ "Hello there This is an AppleScript utility that will help you fix UPDD. First I need your password to continue working of this:" with title ¬ "UPDD Fix Script" with icon note ¬ default answer ¬ "" buttons {"Nope", "Continue ..."} ¬ default button 2 cancel button 1 ¬ with hidden answer) -- Now show dialog for choice set choice to (display dialog ¬ "Hello there, what do you wanna do?" buttons {"Reinstall UPDD", "Start UPDD with time fix", "Exit"} ¬ with title "What do you want to do?" cancel button 3) -- Choice selection if choice = {button returned:"Reinstall UPDD"} then -- Reinscall UPDD case display dialog ¬ "Are you sure you want to reinstall UPDD?" buttons {"No", "Sure"} ¬ default button 2 cancel button 1 set sure_inst to button returned of result -- Starting the install -- TODO: If Nope is selected, loop back to the dialog of choices if sure_inst = "Sure" then -- Install UPDD -- TODO: Add a "Working..." window WHILE it's installing set install_result to do shell script "installer -pkg /Library/UPDD_*.pkg -target /" password pwd with administrator privileges -- Show Install results + updd fix prompt display dialog install_result with title "Install Results" buttons {"OK, now UPDD fix", "OK, I'm done here"} cancel button 2 default button 1 -- UPDD Fix -- TODO: Same as the previous one tell application "UPDD Gestures" to quit saving no do shell script "/usr/sbin/systemsetup -setusingnetworktime off " password pwd with administrator privileges delay 2 do shell script "/usr/sbin/systemsetup -setdate '04:05:15'" password pwd with administrator privileges delay 2 tell application "UPDD Gestures" activate end tell delay 2 -- ERROR: for some reason, it may give an error. do shell script "/usr/sbin/systemsetup -setdate '10:12:16' " password pwd with administrator privileges delay 2 do shell script "/usr/sbin/systemsetup -setusingnetworktime on " password pwd with administrator privileges display notification "We're done." with title "We're all set." end if -- Done with UPPD Reinstall -- TODO: loop back to the choice menu else if choice = {button returned:"Start UPDD with time fix"} then -- UPDD Fix display dialog ¬ "This will bring back your maching clock back in 2015 then back to the actual internet time, this will momentally break some apps/connections (like synergy and maybe even some websites), make sure there are no active time-sensitive apps running if this can damage it or ruin your work" buttons {"Nope, stop", "OK, continue..."} default button 2 cancel button 1 with title "UPDD Rewind" set reupdd to button returned of result if reupdd = "OK, continue..." then -- TODO: Show a "Working..." window tell application "UPDD Gestures" to quit saving no do shell script "/usr/sbin/systemsetup -setusingnetworktime off " password pwd with administrator privileges delay 2 do shell script "/usr/sbin/systemsetup -setdate '04:05:15'" password pwd with administrator privileges delay 2 tell application "UPDD Gestures" activate end tell delay 2 do shell script "/usr/sbin/systemsetup -setdate '10:12:16' " password pwd with administrator privileges delay 2 do shell script "/usr/sbin/systemsetup -setusingnetworktime on " password pwd with administrator privileges display notification "We're done." with title "We're all set." -- TODO: loop back to the choice menu end if end if display dialog "Thank you for using this utility, please check insanleymac.com for more goodies!" buttons {"Thanks", "Get me to InsanelyMac"} with title "Thank you. We're done here." default button 1 cancel button 1 set done to button returned of result if done = "Get me to InsanelyMac" then open location "http://www.insanelymac.com/forum/" delay 1 end if Thanks for any help and feedback
    • By cloneryan02
      So i've been trying to refine my code, and I wanted to do this,
      set recipientName to "Me" set recipientAddress to "cloneryan61002@gmail.com" set theSubject to "Type your subject here!" set theContent to "Type your message content here!" (*This will send the message.*) set codeSet2 to (tell application "Mail" ##Create the message set theMessage to make new outgoing message with properties {subject:theSubject, content:theContent, visible:true} ##Set a recipient tell theMessage make new to recipient with properties {name:recipientName, address:recipientAddress} ##Send the Message send end tell end tell) I just typed up this code, but I can't the chunk of code into a variable (codeSet1)
      I want it in a variable so it's easier to manipulate, so if I change one thing, it basically changes it once, instead of the twenty times it takes to retype everything.
      Does anyone know how to turn this code into a variable?
    • By cloneryan02
      display dialog "*Welcome to ISpammer! - Version 1.1.3*" & return & "--Note-- This version only works with AT&T Phone Numbers." & return & return & "Before we begin, We need to know if you want to spam anybody, or somebody specific. Phone Numbers ONLY." buttons {"Cancel Actions", "Spam Anyone", "I have a specific number."} default button 1 set the button_pressed to the button returned of the result if the button_pressed is "Cancel Actions" then return else if the button_pressed is "Spam Anyone" then display dialog "What will the message say?" default answer "Congrats! You just won a new IPhone! Enter the following code to collect your prize! 1jfjq19r929488dj" buttons {"Cancel", "Next"} default button 2 copy the result as list to {text_returned2, button_pressed2} set x to button_pressed2 if x is "" then display dialog "Sorry, but message content is required to continue. The app will now restart." buttons {"Ok"} default button 1 return end if set recipientName to "Victim" set theSubject to "." set theContent to x display dialog "How many messages will be sent?" default answer "10" buttons {"Cancel", "Next"} default button 2 copy the result as list to {text_returned_NU, button_pressed3} set y to button_pressed3 if y > 5 then display dialog "Sorry, but for testing purposes only, this option has been restricted to a maximum message load if 5. This restriction will be removed in the future." & return & return & "The application will now quit. Sorry, but this application cannot restart itself. I will try to fix this in the future." buttons {"Quit"} default button 1 return else if y < 1 then display dialog "Sorry, but " & y & " is not a valid message load. You must send a message load of atleast 1." & return & "The application will now quit. Sorry, but this application cannot restart itself. I will try to fix this in the future." buttons {"Quit"} default button 1 with icon 2 return end if display dialog "Review the spam information." & return & theContent & return & return & "This will be done " & y & " times." buttons {"This isnt right.", "This looks good. Lets start it."} copy the result as list to {text_returned3} if the text_returned3 is "This isnt right." then else if the text_returned3 is "This looks good. Lets start it." then display dialog "Ok. If your messaging serverice doesn't deliver the messages, its probably because the Phone Number Generator isn't exactly top of the line. Just hit OK to continue, or hit CANCEL to stop actions." repeat y times tell application "Mail" set recipientAddress to "719" & (random number from 0 to 9) & (random number from 0 to 9) & (random number from 0 to 9) & (random number from 0 to 9) & (random number from 0 to 9) & (random number from 0 to 9) & (random number from 0 to 9) & "@txt.att.net" as rich text ##Create the message set theMessage to make new outgoing message with properties {subject:theSubject, content:theContent, visible:true} ##Set a recipient tell theMessage make new to recipient with properties {name:recipientName, address:recipientAddress} ##Send the Message send end tell end tell end repeat end if else if the button_pressed is "I have a specific number." then display dialog "What is the phone number you want to spam?" default answer "Ex; 1234567890" buttons {"Cancel", "Next"} default button 2 copy the result as list to {text_returned1, button_pressed1} display dialog "The phone number recieving the message is " & button_pressed1 & "@txt.att.net" set recipientAddress to the button_pressed1 & "@txt.att.net" display dialog "What will the message say?" default answer "Congrats! You just won a new IPhone! Enter the following code to collect your prize! 1jfjq19r929488dj" buttons {"Cancel", "Next"} default button 2 copy the result as list to {text_returned2, button_pressed2} set x to button_pressed2 if x is "" then display dialog "Sorry, but message content is required to continue. The app will now restart." buttons {"Ok"} default button 1 return end if set recipientName to "Victim" set theSubject to "." set theContent to x display dialog "How many messages will be sent?" default answer "10" buttons {"Cancel", "Next"} default button 2 copy the result as list to {text_returned_NU, button_pressed3} set y to button_pressed3 if y > 3 then display dialog "Sorry, but for testing purposes only, this option has been restricted to a maximum message load if 3. This restriction will be removed in the future." & return & return & "The application will now quit. Sorry, but this application cannot restart itself. I will try to fix this in the future." buttons {"Quit"} default button 1 return else if y < 1 then display dialog "Sorry, but " & y & " is not a valid message load. You must send a message load of atleast 1." buttons {"Quit"} default button 1 with icon 2 return end if display dialog "Review the spam information." & recipientAddress & return & theContent & return & "This will be sent " & y & " times." buttons {"This isnt right.", "This looks good. Lets start it."} copy the result as list to {text_returned3} if the text_returned3 is "This isnt right." then else if the text_returned3 is "This looks good. Lets start it." then display dialog "Ok. If your messaging serverice doesn't deliver the messages, its probably because the Phone Number Generator isn't exactly top of the line. Just hit OK to continue, or hit CANCEL to stop actions." repeat y times tell application "Mail" ##Create the message set theMessage to make new outgoing message with properties {subject:theSubject, content:theContent, visible:true} ##Set a recipient tell theMessage make new to recipient with properties {name:recipientName, address:recipientAddress} ##Send the Message send end tell end tell end repeat end if end if end end   Alright, so I created a large amount of code in AppleScript and its very messy. If I could get someone to help me out by neatening it up, that would be absolutely amazing. Good luck! I've been told its a biiiiiiiiit long. Also, i'd like it to do EXACTLY THE SAME THING. I like it working like this.
    • By Shmexytaco
      Note: This thread could belong under the Applescript section, but it's more of a stand alone app than a script for anything.
       
      This is beta software. I am not responsible for any issues you make encounter!
       
       
      Hey guys,
       
      About two days ago, an idea popped into my head: files are just groups of 1's and 0's put together, and I can read them as raw data and output them as text with XXD. Then I remembered that Google Docs files within Google Drive don't count against your storage... And then I remembered there was a command-line interface for Google Drive.
       
      With the news of OneDrive changing their storage limits, it reminded me of how much stuff I actually store in the cloud, and how impractical it would be to keep paying for more and more space. Sure, there are some gimmicky tricks using shared folders and multiple accounts, but that's just too complicated. I suppose you could argue that this project is a bit gimmicky as well, but I digress...
       
      So a few days and a few all nighters later, I present to you FullSpeed for drive: https://www.dropbox.com/s/ymc218mx8opmdcc/FullSpeed.tar?dl=0 I'm still updating it very frequently, which is why I linked to it rather than uploading them with this post.
       
      Normal files can coexist peacefully with FullSpeed files, as long as there aren't any instances of the phrase "█FullSpeed" in any of the file names except ones uploaded by FullSpeed.
       
      Anyway, I'd love your feedback! I'm still working on updates for it, so check back regularly for new versions!
×