osx script opens pps in classic

I have seen other posts with similar problems, but i haven’t been able to apply the fixes to my situation…

i am using this code to launch a powerpoint file (pps) from a cd. it works great locally (launches in osx), but when i burn it to cd and run it, it tries to open classic…

here’s the sript:

do shell script "open /Volumes/GlobalPresentation/assets/Amsterdam/amsterdam.pps"

the pps doesn’t seem to be an application, but it does run by itself without powerpoint installed… so Tell Application “PowerPoint.app” doesn’t apply…

i am too much of a newbie to figure out how to fix this problem…

thanks for any help!

hi paul,

you can give the ‘open’ command a ‘-a’ flag to tell it what application to use. try this:


do shell script "/usr/bin/open -a \"Microsoft PowerPoint\" /Volumes/GlobalPresentation/assets/Amsterdam/amsterdam.pps"

also, you should always specify the path (as i did for ‘open’) when using command line utilities. you can find the path by opening a Terminal window and typing ‘which xxx’, where xxx is you utility, such as ‘open’.

HTH

thank you for the help!

that worked great!

hi paul,

excellent! i should also point out to you that if you ever need to look up what a command utility can do, just open a Terminal window and type ‘man xxx’ where xxx is the utility you want to know more about. try this with the ‘open’ utility so you can see how i found this. it makes things easier.

cheers.

If you do much man page reading, this effort by Nigel Garvey (with some small additions by me) is very handy. It converts the man page to a PDF and saves it so the next time you want to look at it, it’s there and you don’t have to convert again.

on main()
	set theCommand to ""
	
	repeat while theCommand is ""
		display dialog "View man page for this command:" default answer theCommand
		set theCommand to text returned of result
	end repeat
	
	try
		set manFolderPath to (path to documents folder as Unicode text) & "Unix 'man' Pages (PDFs):"
		set manFile to manFolderPath & theCommand & "-ManPage.pdf"
		tell application "Finder"
			if exists manFile then
				open manFile
				return
			end if
		end tell
		do shell script ("mkdir -p " & quoted form of POSIX path of manFolderPath)
		set manFilePath to quoted form of POSIX path of manFile
		do shell script "/usr/bin/man -t " & quoted form of theCommand & " | /usr/bin/pstopdf -i -o " & manFilePath & "; open -a /Applications/Preview.app " & manFilePath
	on error errorMsg number errorNum
		display alert "Error " & errorNum message errorMsg buttons "Cancel" default button 1
	end try
end main

main()
activate application "Preview"
tell application "System Events" to tell process "Preview"
	keystroke "++" using command down
	click button 2 of window 1
end tell
--tell application "Script Debugger 4" to activate -- or whatever you use; Smile, Script Editor