That's too much for a mac user ( ) so I made a tittle "pet_extractor" app to do that. Attached below (for other the "macpy" hybrids around here )
If you rather make your own app, open "Script Editor", paste this script:
Code: Select all
tell application "Finder" to set theSel to selection as text
if theSel is "" then display dialog "Nothing selected" buttons {"Cancel"} default button 1
open theSel
on open theSel
set thePet to POSIX path of theSel
set theFol to POSIX path of (do shell script "dirname " & thePet)
set isPet to (do shell script "echo " & thePet & "|rev|cut -c 1-3|rev")
if isPet is not "pet" then display dialog "This is not a pet file" buttons {"Cancel"} default button 1
do shell script "tar -xf " & thePet & " -C " & theFol
end open
Put it in your applications folder and instruct the OS to use it (from the "Get Info -> Open with:" of a pet file )