Script to unarchive .img and .iso files (not mount)

Is it possible to tell Finder to unarchive and .img (or .iso) file instead of mounting it?

Have theese files with VIDEO_TS content that I want to convert to movie files in a batch-flow. But cant get Hazel to do this :frowning:

You canā€™t ask the Finder to unarchive the iso file but you may use a simple scheme :

set theISO to choose file of type {"public.iso-image"}
set p2d to path to desktop as text
tell application "System Events"
	set theDisks to name of every disk
	set oldCnt to count theDisks
	set maybe to open file theISO
	repeat
		delay 0.5
		if (count (name of every disk)) > oldCnt then exit repeat
	end repeat
	set NewDisk to item -1 of (get name of every disk)
	set wanted to path of (first disk item of folder NewDisk whose visible is true)
	set nameOfWanted to name of disk item wanted
end tell
if wanted ends with ":" then set wanted to text 1 thru -2 of wanted
do shell script "cp -R " & quoted form of POSIX path of wanted & " " & quoted form of POSIX path of (p2d & nameOfWanted)
do shell script "umount " & quoted form of POSIX path of NewDisk

# now the item wanted is on the Desktop

The resulting item is exactly the same than what give the free application ā€œThe Unarchiverā€.

Yvan KOENIG running El Capitan 10.11.2 in French (VALLAURIS, France) samedi 16 janvier 2016 21:06:47

Great, thanks!

Would it be impossible to script that the contents of the diskimage should be copied to the same folder where the disk-image is located?

Maybe to much to ask, but if you could give me some directions or clues that would be nice !

I apologize for this late answer but I was not connected to the net during a week.

As I have many messages to answer I edited the original script but didnā€™t tested the new version.

set theISO to choose file of type {"public.iso-image"}

tell application "System Events"
	set destFolder to path of container of theISO # ADDED
	set theDisks to name of every disk
	set oldCnt to count theDisks
	set maybe to open file theISO
	repeat
		delay 0.5
		if (count (name of every disk)) > oldCnt then exit repeat
	end repeat
	set NewDisk to item -1 of (get name of every disk)
	set wanted to path of (first disk item of folder NewDisk whose visible is true)
	set nameOfWanted to name of disk item wanted
end tell
if wanted ends with ":" then set wanted to text 1 thru -2 of wanted
do shell script "cp -R " & quoted form of POSIX path of wanted & " " & quoted form of POSIX path of (destFolder & nameOfWanted) # EDITED
do shell script "umount " & quoted form of POSIX path of NewDisk

# now the item wanted is in the folder where the iso.image was stored.

Yvan KOENIG (VALLAURIS, France) dimanche 24 janvier 2016 19:20:20

Super! Thanks a lot!:):):slight_smile: