Results 1 to 2 of 2

Thread: AppleScript Automation

  1. #1
    Join Date
    Jul 2010
    Posts
    1

    AppleScript Automation

    I have a desire to use applescript and CUPS to solve a data conversion problem. The input to this process will be single EML files, sometimes numbering in the 10s of 1000s. These would reside in a directory named INPUT. I would use Automator to accept files from this folder at the time the workflow was initiated. The workflow would contain two steps. First would be to select the location of INPUT. Second would be to run a piece of applescript. This applescript would use Mail to open each EML file and print to CUPS. Within the CUPS configuration, I can specify the destination of all things printed to the CUPS printer. Mail is the only application that will open EML files on Mac out of the box. I found this script that uses Mail to open a message, then uses AppleScript to grab specific parts of the message, like headers and content, then writes these to a temporary text file, then prints the text file to the default printer (set in the interface to be CUPS). This script may work the way it is. I would not know. The minute I drop a Custom AppleScript step into my workflow and drop this script in the workflow does not accept input and asks me to debug line by line. I’m unable to do this. I don’t know how to write applescript and I’m not a programmer.

    AppleScript

    on run {input, parameters}

    tell application “Mail”
    set selectedMessages to |SelectedMessages| of input
    repeat with eachMessage in selectedMessages
    set theEmail to (headers of eachMessage as text) & return & return ¬
    & (content of eachMessage as text)
    set theTextFile to open for access “:MailText” with write permission
    set theTempFile to (“:MailText” as alias)
    write theEmail to theTextFile
    close access theTextFile
    do shell script “lpr /MailText”
    tell application “Finder”
    delete theTempFile
    end tell
    end repeat
    end tell

    return input
    end run


    Thanks
    Last edited by brickwork; 24-07-2010 at 02:32 AM.

  2. #2
    Join Date
    Dec 2007
    Posts
    2,291

    Re: AppleScript Automation

    Applescripts are usually very conservative and therefore you can try and download the automator from here and it might be easier to help with your issue if we knew what data conversion problem you're trying to solve. Offhand, processing tens of thousands of eml files with Automator, Applescript, Mail, and CUPS sounds downright unpleasant. Someone here may have a simpler solution.

Similar Threads

  1. Changes to Photoshop CS5 and Applescript
    By Narragansett in forum Windows Software
    Replies: 6
    Last Post: 14-07-2010, 06:12 AM
  2. Need Applescript to lock computer
    By Mulan in forum Operating Systems
    Replies: 6
    Last Post: 01-06-2010, 10:21 PM
  3. Help to delete Trojan.AppleScript.THT.A
    By Carley in forum Networking & Security
    Replies: 5
    Last Post: 19-02-2010, 12:41 PM
  4. APPLEScript for Wiretap Pro
    By christheart in forum Operating Systems
    Replies: 2
    Last Post: 01-05-2009, 03:20 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,998,707.63609 seconds with 17 queries