AppleScript no longer works

Discussion in 'AppleScript' started by Ron Mittelman, Jun 26, 2015.

  1. Ron Mittelman

    Ron Mittelman New Member

    Joined:
    Jun 26, 2015
    Messages:
    2
    Likes Received:
    0
    I had a perfectly good automator script which has been working for a year or two, then it all of a sudden no longer works.
    The Automator script created a service so when I right-click on a file name, it copies it into a Backup folder off of whatever the current folder is, then renames it to include the date. This script was on my right-click context menu, but now it's gone.

    I know... there's an automator forum. But the automator script contains a step which runs AppleScript, so I thought this was a good place to start. This script now returns an error when I try to run it:
    Code:
    on run {input, parameters}
       
        tell application "Finder"
            set output to (container of item 1 of input) as alias
        end tell
        return output
    end run
    When I run this code, I get this error: "Can’t make «class ctnr» of item 1 into type alias."
    Item 1 of input was the file I right-clicked on, so I guess container is the folder.

    Can anybody suggest a better way to code this applescript part so it doesn't return a syntax error?
    Thanks...
     
    Ron Mittelman, Jun 26, 2015
    #1
    1. Advertisements

  2. Ron Mittelman

    Cory Cooper Moderator

    Joined:
    May 19, 2004
    Messages:
    6,048
    Likes Received:
    199
    Hello and welcome.

    We have a few folks here with some AppleScript/Automator knowledge, so hopefully they will chime in. You can also post this question at the following link - they have much more experience with all things Mac scripting:

    MacScripter

    C
     
    Cory Cooper, Jul 5, 2015
    #2
    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.