Jump to content
About Just Joined group Read more... ×

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

  • Recently Browsing   0 members

    No registered users viewing this page.