Can AppleScript do two things at the same time?

Just wondering.

Example: Display dialog box while speaking the contents of it.

No.

However, for your example, you might be able to do something like this:

set example to "Can AppleScript do two things at the same time?"

do shell script "/usr/bin/say " & quoted form of example & " &> /dev/null &"
display dialog example

This doesn’t quite fit the example, but I’ve had it in my collection for a while. Works well in Tiger. :wink:

on showError(msg)
	set b to {"¢", ""}
	repeat 6 times
		do shell script "osascript -e 'say \"Error\" using \"Zarvox\"' -e 'tell application \"System Events\" to keystroke return' &> /dev/null &"
		display dialog msg buttons b default button "" with title "OH NO! WE'RE ALL GOING TO DIE!" cancel button "¢" with icon caution
		delay 0.1
		set b to reverse of b
	end repeat
	say "Ah ha ha" using "Hysterical"
	error number -128
end showError

try
	set fire to my trousers
on error msg
	showError(msg)
end try

Edit: Works in Tiger but posted from Jaguar. Small typo now corrected. :rolleyes:

Haha great script, thanks! :lol: