Zoom Keystrokes in a Script

Hi all,

the following code doesn’t result in a Zoom action from the Universal Access pane. The key combo works fine when sent manually. All other keystrokes sent to apps like TextEdit work fine.

tell application "System Events"
	tell process "System Events"
		keystroke "+" using {command down, option down}
	end tell
end tell

What am I doing wrong? It doesn’t seem to matter what one puts in the “tell process” argument, as the command-option-“+” key combo is systemwide. Is there a special target to use with systemwide key combos?

Thanks so much if anyone can assist.

-Johnny

UI scripting technology seems fairly restricted to what you really see in the interface.
So, beyond sending key events to those applications that present a user interface, it has little to offer
(the zooming sequence is captured somewhere more deeply in the graphics subsystem)

A macro editor such as Quickeys, will help you do this.

Yep, I guessed that it might be too high-level to script.

I’ll use QuicKeys, thanks!


tell application "System Events"
	tell process "UniversalAccess"
		keystroke "+" using {command down, option down}
	end tell
end tell

“-” also.

I selected “UniversalAccess” from ps awx | grep Universal; it showed a process named that with no spaces.

10.4.2

Model: Powerbook G4/867
AppleScript: 1.10
Browser: Safari 412.2
Operating System: Mac OS X (10.4)

I wrote it in QuicKeys, and it works fine, with a variable to keep track of the current state of the zoom.

The script targeting UniversalAccess, however, does not work for me, even after quitting QuicKeys.

If anyone would like the QK sequence I can post it.

How bizarre - it still works for me here. Oh well. Glad to hear that QuicKeys works :slight_smile: Now if only I could bind Zoom to button 3 and the scroll wheel.

  • R.