. .

smalltalk

Recording a Stream with Smalltalk and Applescript

September 14, 2010 12:45:25.813

The Citilab folks are getting me copies of the recorded ESUG talks, so I don't really need this solution - but before I knew that was going to happen, I set up two Applescripts and a Smalltalk workspace script to start recording at 3 AM my time (9 AM in Barcelona). The Smalltalk looks like this:


isTime := false.
safariScript := '/Users/james/Documents/working_77/openSafari.scpt'.
castScript := '/Users/james/Documents/working_77/doRecord.scpt'.
test := Timestamp readFrom: '9/14/10 02:58:00' readStream.
block := [[isTime]
	whileFalse: [(Delay forSeconds: 60) wait.
				time := Timestamp now.
				time >= test
					ifTrue: [isTime := true.
						ExternalProcess cshOne: safariScript.
						(Delay forSeconds: 5) wait.
						ExternalProcess cshOne: castScript]]].

And the two AppleScripts:


#! /usr/bin/osascript
tell application "Safari"
open location "http://eventv.projectescitilab.eu/index.html"
end tell

#! /usr/bin/osascript
activate application "iShowU"
delay 2
tell application "System Events"
	tell process "iShowU"
		click button "Record" of window "iShowU"
	end tell
end tell

Pretty simple stuff, and it's easy enough to do. If I had to do this sort of thing often enough, I'd likely create a CRON job instead of the Smalltalk workspace, but for ad-hoc things, this works quite nicely.

Technorati Tags: ,

posted by James Robertson

 Share Tweet This