Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Fast trash emptying via Unix script turned into an app' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Fast trash emptying via Unix script turned into an app
Authored by: hypert on Jul 22, '09 09:08:37AM

The .command extension has to be the longest, dumbest, non-standard extension I've ever seen. Is there any way to modify Mac OS (or Terminal?) to recognize executable .sh scripts (or others, like .pl scripts!) as double-clickable apps?



[ Reply to This | # ]
Fast trash emptying via Unix script turned into an app
Authored by: tedw on Jul 22, '09 08:24:48PM
that would be a bad idea, even if it is possible. do you want every one of the hundreds upon hundreds of scripts tucked away in your system to suddenly become double-clickable? if you do this kind of thing frequently enough that typing the word 'command' becomes an annoyance, then use and applescript like this that converts the file through drag&drop.
property scriptFileExtensions : {"sh", "pl"} -- insert others as needed

on open theScriptFiles
	tell application "Finder"
		repeat with thisScript in the theScriptFiles
			if name extension of thisScript is in scriptFileExtensions or name extension of thisScript = "" then
				set cmd to "chmod +x " & quoted form of POSIX path of thisScript
				do shell script cmd
				set name extension of thisScript to "command"
			end if
		end repeat
	end tell
end open


[ Reply to This | # ]