Scripting software installations

Hi all,

I am new to AppleScript and am trying to create automated installation scripts of the software we install on a daily basis at my work.

So far I have come up with the following script for Adobe Photoshop CS5 Extended. It mounts the dmg and completes the install perfectly but there are a few methods I have used don’t seem quite correct!

At present I have set a couple of long delays which allow for the software to install before the script clicks on ‘Done’ to complete the installation. This is the same for the Adobe updates also. Secondly, I have used a lot of keystrokes and have coded them in individually. Is there a way to input these better?

Any other tips and comments greatly appreciated.

Thanks

Will

tell application "Finder"
	if not (exists "Adobe Photoshop CS5 Extended") then
		do shell script "hdiutil attach '/Users/TS/Desktop/Installed with keyboard/Adobe Photoshop CS5 Extended/installer/Adobe Photoshop CS5 Extended.dmg'"
	end if
end tell

tell application "Finder"
	make new Finder window to disk "Adobe Photoshop CS5"
	open folder "Adobe Photoshop CS5" of disk "Adobe Photoshop CS5"
	open application file "Adobe Photoshop CS5:Install.app" of disk "Adobe Photoshop CS5"
	delay 30
	tell application "System Events"
		keystroke (ASCII character 9) -- TAB
		delay 1
		keystroke (ASCII character 13) -- RETURN
		delay 5
		keystroke (ASCII character 9) -- TAB
		delay 0.5
		keystroke (ASCII character 9) -- TAB
		delay 0.5
		keystroke (ASCII character 9) -- TAB
		delay 0.5
		keystroke (ASCII character 9) -- TAB
		delay 0.5
		keystroke (ASCII character 9) -- TAB
		delay 0.5
		keystroke (ASCII character 9) -- TAB
		delay 0.5
		keystroke (ASCII character 9) -- TAB
		delay 0.5
		keystroke (ASCII character 31) -- DOWN ARROW
		delay 0.5
		keystroke (ASCII character 9) -- TAB
		delay 0.5
		keystroke (ASCII character 31) -- DOWN ARROW
		delay 0.5
		keystroke (ASCII character 9) -- TAB
		delay 0.5
		keystroke (ASCII character 9) -- TAB
		delay 0.5
		keystroke (ASCII character 13) -- RETURN
		delay 1
		keystroke (ASCII character 13) -- RETURN
		delay 5
		keystroke (ASCII character 116) -- t
		delay 0.5
		keystroke (ASCII character 101) -- e
		delay 0.5
		keystroke (ASCII character 115) -- s
		delay 0.5
		keystroke (ASCII character 116) -- t
		delay 0.5
		keystroke (ASCII character 13) -- RETURN
		delay 360
		keystroke (ASCII character 13) -- RETURN
	end tell
	tell application "Adobe Application Manager.app" to activate
	delay 10
	tell application "System Events"
		keystroke (ASCII character 13) -- RETURN
		delay 3
		keystroke (ASCII character 116) -- t
		delay 0.5
		keystroke (ASCII character 101) -- e
		delay 0.5
		keystroke (ASCII character 115) -- s
		delay 0.5
		keystroke (ASCII character 116) -- t
		delay 0.5
		keystroke (ASCII character 13) -- RETURN
		delay 360
		keystroke (ASCII character 13) -- RETURN
	end tell
	tell application "Finder"
		make new alias to file "Adobe Photoshop CS5" of folder "Adobe Photoshop CS5" of folder "Applications" of startup disk
	end tell
end tell

-- KNOWN ISSUES/THINGS TO UPDATE --

-- MORE FLUID WAY TO WRITE KEYSTROKES
-- DELAY TIME (CURRENTLY SET TO 360 SECONDS) ISN'T IDEA AND COULD FAIL ON SLOW MACHINES
-- AN IF AND REPEAT COULD BE USED IN CONJUNCTION WITH WINDOW 1 (IF APPLICABLE)

Is there an pkg or mpkg installer available for adobe? Then you can use the command line utility ‘installer’.

Edit: Sorry, it’s a .app contained within the dmg.

I did a search through Terminal and there is not a pkg/mpkg available.

Edited my reply above as I put the wrong information in there!