user1171048
user1171048

Reputation: 49

AppleScript code

The below code is throwing a syntax error in AppleScript (when using Automator). Any suggestions what may be causing it as the code runs fine when running in Terminal?

on run {input, parameters}

    tell application "Terminal"

        activate (do script with command "perl -mURI -lne 'print ((URI->new(/([\S]+) \z/msx)->path_segments)[-1])' < testfile.txt > testfile1.txt")
    end tell

    return input
end run

Upvotes: 1

Views: 376

Answers (1)

Paul R
Paul R

Reputation: 213200

I think you may need a line break after activate, i.e.

on run
    tell application "Terminal"
        activate
        do script "perl -mURI -lne 'print ((URI->new(/([\\S]+) \\z/msx)->path_segments)[-1])' < testfile.txt > testfile1.txt"
    end tell
end run

I've also taken out some redundant stuff and tested this on OS X 10.6.

Upvotes: 2

Related Questions