Re: A number can't go after this identifier.
Re: A number can't go after this identifier.
- Subject: Re: A number can't go after this identifier.
- From: Christopher Nebel <email@hidden>
- Date: Sat, 22 Nov 2003 11:34:16 -0800
So, the original script ('window "info" (1)') won't compile because
that's syntactically illegal -- you can have a name, or an index, but
not both. Not having used PUIB myself, I'm guessing a bit, but I think
what it's trying to tell you is that, say, the window is named
"Macintosh HD" and its index is 1. In general, names are more durable
than indices, so the index is in parentheses. The idea is that you
could get at that window by saying 'window "Macintosh HD"' or 'window
1', but you're not supposed to type the whole thing.
As for the second script, the problem there is that you're telling the
wrong application. All UI Scripting commands should be directed to
'application "System Events"', or they probably won't even compile, let
alone work.
You probably ought to read some introductory scripts or documentation
before going much further -- if you don't understand AppleScript
syntax, you're just going to cause yourself more grief. Go to
<
http://applescript.apple.com> for a bunch of links to various things.
The other obvious question is, what are you trying to do? Using the
actual scripting model of an application will usually produce shorter
and more comprehensible scripts than using UI Scripting.
--Chris Nebel
AppleScript Engineering
On Nov 22, 2003, at 10:43 AM, Chris Rock wrote:
If you want an example, how about entering text into the search field
of a finder window, by accessing it as it's text field. It is easy to
see using PreFab UI Browser what that is called:
Here is the path to element:
application "Finder"
window "Macintosh HD" (1)
toolbar 1
button "Search" (1)
unknown 1
text field 1
Here is what PreFab UI Browser says to do to set that value:
set value of text field 1 of UI element 1 of button "Search" of tool
bar 1 of window "Macintosh HD" of application process "Finder" to
"<string>"
A simple apple script I would think I would have to do would be:
tell application finder
set value of text field 1 of UI element 1 of button "Search" of
tool bar 1 of window "Macintosh HD" of application process "Finder" to
"<string>"
end tell
But this apple script will not compile, I am curious why, I am a new
user so I am probably screwing something up...
- Rock
On Nov 22, 2003, at 6:48 AM, Graff wrote:
What program are you attempting to script? What are you trying to do?
If we know that then we can try it ourselves and work on a solution.
I'm not sure what the problem is there. One thing that I just found
was a program called PreFab UI Browser, it acts like the normal UI
Browser but it also will form the System Events statements for you so
there is little possibility of error. It's shareware but it has a
trial period, you can find it at:
<http://www.prefab.com/uibrowser/index.html>
It looks like a cool application, especially if you are serious about
using AppleScript. Maybe using it will help to point out what the
problems are with your set value statement.
- Ken
On Nov 22, 2003, at 4:15 AM, Chris Rock wrote:
I am using UI Browser to locate text fields and the like, and I get
the following:
The Path to said field:
application "blah"
window "info" (1)
text field 1
The Set Value command from this app:
set value of text field 1 of window "info" of application process
"blah" to "<string>"
Yet when I try to compile my SIMPLE script I get the following error:
A number can't go after this identifier.
No matter how I try, I can't get it to compile, let along being able
to write anything into this field, nor can I read from it, as I keep
getting the same Syntax Error all nite.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.