Re: keystroke command
Re: keystroke command
- Subject: Re: keystroke command
- From: Robert Poland <email@hidden>
- Date: Mon, 29 May 2006 11:40:40 -0600
on 2006-05-29 1:03 PM, Robert Poland at email@hidden wrote:
In my quest to improve a script to set index labels I have hit a new snag...
tell application "Finder"
activate
if (keys pressed) contains "Option" then beep -- this line
breaks the following
-- the following assumes a window is open in the Finder
-- this is used as the command "Select all" doesn't seem to
work with a finder window
tell application "System Events"
keystroke "a" using {command down} -- select all
end tell
end tell
Why isn't the keystroke command allowed?
What Michelle said is the best solution.
But to answer the question you actually asked, you neglected to nest a 'tell
process "Finder"' block inside the 'tell application "System Events"' block.
You should do this whenever you use GUI Scripting, including the 'keystroke'
command.
Leaving out the 'keys pressed' test, this works:
activate application "Finder"
tell application "System Events"
tell process "Finder"
keystroke "a" using {command down} -- select all
end tell
end tell
--
Bill Cheeseman - email@hidden
Thanks Bill,
I have implemented Michelle's suggestion,
For me, your suggestion selects all of the DESKTOP items, even if I
do as follows;
activate application "Finder"
tell application "System Events"
tell process "Finder" to tell window 1
keystroke "a" using {command down} -- select all
end tell
end tell
--
Bob Poland - Fort Collins, CO
http://www.ibrb.org/
_______________________________________________
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