Applescript result not passing to automator

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

  1. M McErlean

    M McErlean New Member

    Aug 21, 2015
    Likes Received:
    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
    application "Image Events"
    -- start the Image Events application
    -- 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
    thePrefix as string
    end try
    ------ end applescript-----
    M McErlean, Aug 21, 2015
    1. Advertisements

  2. M McErlean

    Cory Cooper Moderator

    May 19, 2004
    Likes Received:
    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:


    Cory Cooper, Aug 22, 2015
    1. Advertisements

Ask a Question

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.