Applescript result not passing to automator

Discussion in 'AppleScript' started by M McErlean, Aug 21, 2015.

  1. M McErlean

    M McErlean New Member

    Joined:
    Aug 21, 2015
    Messages:
    1
    Likes Received:
    0
    I have an automator workflow that takes an image file, and uses the name without the extension to create a folder. The workflow functions properly if I manually add the file in the applescript via dialogue, but won't return the required name if the picture is used as input to the applescript step in the workflow. I have received results that pass the entire path and file name as the new folder name.
    The workflow part in question ;
    1. Create a folder called 'Destination';
    2. Uses the find finder items to get the image in question (this works)
    3. Uses the input for an applescript that extracts the name and does the conversion, then
    4. passes the result to a text variable.
    5. changes the name 'Destination' to the text variable value

    the workflow says the applescript (listed below) doesn't return any value. I'm very new at applescript and automator. Any suggestions why I'm having issues?


    ------- the Run Applescript step in Automator------------
    on run {input}
    --set this_file to choose file ( this works when I swap the line and the next)
    set this_file to input
    --set this_file to storage
    try
    tell
    application "Image Events"
    -- start the Image Events application
    launch
    -- open the image file
    set this_image to openthis_file
    -- set this_image to open image
    -- extract the property value
    copy the name of this_image to the_name
    set thePrefix to text 1 thru ((offsetof "." inthe_name) - 1) of the_name
    -- purge the open image data
    close
    end
    tell
    return
    thePrefix as string
    end try
    end
    run
    ------ end applescript-----
     
    M McErlean, Aug 21, 2015
    #1
    1. Advertisements

  2. M McErlean

    Cory Cooper Moderator

    Joined:
    May 19, 2004
    Messages:
    4,742
    Likes Received:
    128
    Hello and welcome.

    A few members here have a little experience with Automator and AppleScript. However, it may be best to post this question at the following link, as they have a lot of folks with experience scripting on the Mac:

    MacScripter

    C
     
    Cory Cooper, Aug 22, 2015
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. Switcher-Steve

    Automator vs Applescript

    Switcher-Steve, May 29, 2007, in forum: AppleScript
    Replies:
    4
    Views:
    3,283
  2. shortcuts

    Applescript/Automator. NEED HELP!

    shortcuts, Feb 8, 2011, in forum: AppleScript
    Replies:
    0
    Views:
    1,588
    shortcuts
    Feb 8, 2011
  3. Keep it to Usenet please

    Terminal.app not passing $TERM?

    Keep it to Usenet please, Jan 13, 2005, in forum: Communication
    Replies:
    8
    Views:
    261
    Keep it to Usenet please
    Jan 17, 2005
  4. Jos
    Replies:
    10
    Views:
    290
    Benjamin Riefenstahl
    Oct 21, 2005
  5. Keep it to Usenet please

    Terminal.app not passing $TERM?

    Keep it to Usenet please, Jan 13, 2005, in forum: Mac
    Replies:
    8
    Views:
    236
    Keep it to Usenet please
    Jan 17, 2005
  6. Alan Munn
    Replies:
    2
    Views:
    458
    Alan Munn
    Jul 10, 2009
  7. Michelle Steiner

    Making money is the result, not the goal

    Michelle Steiner, Aug 26, 2011, in forum: Mac
    Replies:
    35
    Views:
    380
    Michelle Steiner
    Sep 1, 2011
  8. wiredcharlie

    Passing variables between applescript frames

    wiredcharlie, Oct 10, 2013, in forum: Automator
    Replies:
    0
    Views:
    373
    wiredcharlie
    Oct 10, 2013
Loading...