Jump to content

1 post in this topic

Recommended Posts

I'm new to applescript and as a start I tried a simple app that will execute a terminal command (extract a tarball) on a selected file

The script: 

tell application "Finder"
set theSel to selection as text
set thePet to POSIX path of theSel
set theFol to POSIX path of (do shell script "dirname " & thePet)
do shell script "tar -xf " & thePet & " -C " & theFol
end tell

works file if I run while the file is selected in the Finder.

However, when the script is turned to an app (say, my_extractor.app) and then from the right-click menu of a tarball file I select "open with" >>>  "my_extractor", it fails :-?

I assume this is because the command "set theSel to selection as text" fails, but I can not figure why.

I have search this forum and googled extensively but could not find any solution.

Any hints, pointers, links?


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.