App switching for exhibition

Hello there,
first post, how exiting!

I’m trying to set up an exhibition that will run all day, for 5 days, that switches between applications after a given time.

eg
launch Tweetdeck, Quicktime, Safari.
show Tweetdeck for XX minutes
switch to Quicktime movie fullscreen for 17 seconds
switch to Safari showing webpage for XX minutes
and repeat.

is automator the best bet for this? I’ve already assigned the apps to their own space (1, 2, 3, 4)

help will be warmly received!

(using snow leopard)

Rich

This seemed like an interesting exercise so I wrote it for you! :smiley:

You just need to setup the first 5 variables in the applescript. Then save it as an application and in the “save” window check the box to make it a “stay open” application. Now you have an application that will do what you asked. It will show up in your dock when run so you can quit it like any normal application. Good luck!

-- values to adjust
property safariWebsite : "http://www.apple.com"
property safariRunTime : 10 -- seconds
property quicktimeRunTime : 17 -- seconds
property tweetdeckRunTime : 5 -- seconds
-- NOTE: also adjust quicktimeMoviePath in the "on run" handler


property currentApp : missing value
global quicktimeMoviePath

on run
	set quicktimeMoviePath to (path to desktop folder as text) & "test.avi"
	tell application "TweetDeck" to launch
	tell application "QuickTime Player" to launch
	tell application "Safari" to launch
end run

on idle
	if currentApp is missing value then
		set currentApp to "TweetDeck"
		set runTime to tweetdeckRunTime
		tell application "TweetDeck" to activate
		
	else if currentApp is "TweetDeck" then
		set currentApp to "QuickTime Player"
		set runTime to quicktimeRunTime
		tell application "QuickTime Player"
			activate
			set theMovie to open file quicktimeMoviePath
			tell theMovie
				present
				play
			end tell
		end tell
		
	else if currentApp is "QuickTime Player" then
		tell application "QuickTime Player"
			tell document 1
				stop
				set presenting to false
				close
			end tell
		end tell
		
		set currentApp to "Safari"
		set runTime to safariRunTime
		tell application "Safari"
			activate
			try
				set theURL to URL of front document
				if theURL does not contain safariWebsite then open location safariWebsite
			on error
				open location safariWebsite
			end try
		end tell
		
	else if currentApp is "Safari" then
		set currentApp to "TweetDeck"
		set runTime to tweetdeckRunTime
		tell application "TweetDeck" to activate
	end if
	
	return runTime
end idle

on quit
	set currentApp to missing value
	tell application "TweetDeck" to quit
	tell application "Safari" to quit
	tell application "QuickTime Player" to quit
	continue quit
end quit

Wow…
I didn’t imagine such a perfect response, thanks!!

small problem tho…

I haven’t used applescript much… not sure what values I should put in one gap you left, sorry.

set quicktimeMoviePath to (path to desktop folder as text) & "test.avi"

what format should the path be in? and is it path in (brackets) with the filename following where “test.avi” is?

Thanks again, you’ve really saved my day

Glad you like it! Run this script, select the movie, and copy/paste the result into the variable.

(choose file) as text

You should end up with something like this…

set quicktimeMoviePath to "Macintosh HD:Users:username:whatever.mov"

all done, works like a charm.

thank you so much.

Hope I can add to this valuable forum some day soon.

for the record.
the final script I used was this.

on run {input, parameters}
tell application “Firefox” to launch
tell application “QuickTime Player” to launch
tell application “TweetDeck” to launch
set quicktimeMoviePath to “Macintosh HD:Users:Richbate:Desktop:necdp7.mp4”

repeat
tell application “Firefox” to activate

delay 4.0

tell application “QuickTime Player” to activate
tell application “QuickTime Player” to open file quicktimeMoviePath

delay 17

tell application “QuickTime Player” to quit
tell application “TweetDeck” to activate
delay 4.0

end repeat

return input
end run