Re: GUI screen capture?
Re: GUI screen capture?
- Subject: Re: GUI screen capture?
- From: kai <email@hidden>
- Date: Wed, 29 Sep 2004 07:10:51 +0100
On Mon, 27 Sep 2004 15:01:13 -0400, Bill White wrote:
Any idea on why the following doesn't work?
tell application "Finder" to activate
tell application "System Events"
tell process "Finder"
keystroke "3" using {command down, shift down}
end tell
end tell
It compiles and runs without error, but doesn't produce a screenshot.
I must
be missing something very simple.
On Mon, 27 Sep 2004 18:25:17 -0400, Bill White wrote:
Thanks Paul and Steve. I know about "screencapture" but just wondered
why
System Events' "keystroke" doesn't work for such a simple thing. Seems
counterintuitive to me.
I sympathise, Bill - although some context might be relevant here.
When using the keystroke command, we're essentially specifying a
character, rather than a particular key. This works pretty much as
expected for many characters:
--------------------------
keystroke "abcdefghijklmnopqrstuvwxyz`,;'[]\\" using shift down
--> "ABCDEFGHIJKLMNOPQRSTUVWXYZ~<:"{}|"
--------------------------
Passing a bunch of pre-shifted characters has (unsurprisingly) little
effect:
--------------------------
keystroke "ABCDEFGHIJKLMNOPQRSTUVWXYZ~<:\"{}|" using shift down
--> "ABCDEFGHIJKLMNOPQRSTUVWXYZ~<:"{}|"
--------------------------
In addition, the use of a numeric keypad is evidently assumed for
certain characters:
--------------------------
keystroke "0123456789.+-*/=()" using shift down
--> "0123456789.+-*/=()"
--------------------------
To work around this in your screen capture script, you could try
something like:
--------------------------
tell application "System Events" to keystroke "#" using command down
--------------------------
This approach is keyboard-dependent and might need "£" on a British
keyboard layout, for example. You should also find that the above
one-line statement is sufficient without additional calls to the Finder.
---
kai
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden