Key down at runtime

I’m wondering if its possible at script run time to operate differently if a key/keys are held while launching(double clicking) the script.
I know the logic behind it just not suer how to detect in the run handler the keys pressed.

Thanks!

You may have to resort to third-party software for something like this, myndcraft.

Requires Jon’s Commands:

set |keys down| to keys pressed
(* do something with |keys down| *)

Requires Extra Suites:

tell application "Extra Suites" to set |keys down| to ES keys down
(* do something with |keys down| *)

This does not appear to work on my Intel iMac under 10.4.7. I just get a syntax error when I try to use keys pressed.

Browser: Firefox 1.5
Operating System: Mac OS X (10.4)

Jon Pugh, the author of Jon’s Commands, says that he has not updated JC to run on Intel Macs because he doesn’t have one.

Even if he had one, I get the impression that Jon has quite a lot on his plate right now, anyway.

Fancy a crack at writing an osax? :wink:

Extra Suites works, however.

Just playing with a few of its features:

Getting out of a repeat…

delay 0.5
beep
repeat with k from 1 to 20
	tell application "Extra Suites" to set kd to ES keys down
	delay 0.1
	if kd = {"shift", "control"} then exit repeat
end repeat
display dialog k

A banner announcement (sort of)…

set tD to 0.1
set tMsg to words of "Now is the time for all good men to come to the aid of the party"
tell application "Extra Suites"
	ES display message item 1 of tMsg & space width 400
	repeat with k from 2 to count tMsg
		delay tD
		ES modify message item k of tMsg & space with appending
	end repeat
	delay tD
	repeat 2 times
		delay 3 * tD
		ES modify message "!" with appending
	end repeat
	delay 10 * tD
	ES close message
end tell

The ES progress bar is fairly programmable…

set tDelays to {0.3, 0.4, 0.5, 0.2, 0.5, 0.75, 0.8, 0.6, 0.2, 0.7, 0.25} -- eleven of them
tell application "Extra Suites"
	ES display progress counting to 0 with caption "Loading..."
	delay 1
	repeat with k from 1 to 11
		if k < 6 then
			set myCap to "Calculating...."
		else
			set myCap to "Assembling Answer..."
		end if
		ES display progress counting to 10 with caption myCap
		delay item k of tDelays
		if k = 6 then ES advance progress by 1
		ES advance progress by 1
	end repeat
	ES close progress
end tell

A lot of the rest of what it can do, I could already do other ways, though