Text fields

I’m getting this error with my script:
System Events got an error: NSReceiverEvaluationScriptError: 4
I’ve read that ii probably has to do with the nesting of the commands or the naming but I can’t seem to be able to figure this one out.
I have a picture of what’s hapening here:
http://stevenq1967.googlepages.com/grab.jpg
I currently have an autologin for Interactive Brokers that I wrote in RealBasic and Applescript using copy and paste that works fine. Now I want to do the same but by identifying the textfields and filling their values. It seems to me that I have the correct command and I can even fill the username through UI Browser, so I seem to be in the right place but nevertheles the script won’t work. I’ve tried <window 1> , <window “Login”> , I’ve tried it with and with out the window tell, to no avail. Does anyone have any sugestions?
Best regards,
Steven

Model: iMac g5
AppleScript: 1.9.3
Browser: Firefox 1.5.0.7
Operating System: Mac OS X (10.3.9)

Hi stevenq

I use something similar to this to return info about UI elements when GUI scripting.

tell application "System Events"
	tell process "Safari"
		activate
		set frontmost to true
		tell window 1
			get properties of every UI element
		end tell
	end tell
end tell

i use safari in this case cause i don’t have the app your trying to script…
from searching GUI scripting on the forum i have picked up that the line:

set frontmost to true

is very important!
I’m not the best at GUI scripting i gotta say! i struggle enough with the normal scripting stuff, however i do find
getting the properties this way very helpfull…

cheers

Thanks for the tip, but unfortunately it doesn’t work. I believe the problem is that this is a Java application and they do nonstandard stuff. If anyone has a java app that they can test that would be great. Otherwise I believe that’s the end of my aplescript carreer. If seemingly simple stuff like this can’t be done.
Thanks,
Steven

Does the User Interface allow TABing from one text field to the other?
If so you might try using System Event’s keystroke command with sth like “text field value 1” & tab & “text field value 2” & return - maybe some delay in between is necessary …

D.

Hi stevenq

I’m not to familiar with java apps as such, but i’m sure if its
got a user interface then GUI scripting will be able to help you,
Try not to give up! GUI scripting is very difficult
maybe more so than scripting an app that has applescript support…

Keep trying and keep posting theres some very clever and helpfull scriptors on here! i’m sure you will succeed!!

cheers

I’ve tried to set a text field value in LimeWire (Gnutella Client made with Java) - without success - i was able to read the text field’s value but had no success with setting it :-(.

You can tab fine, the problem is I don’t seem to have a way of getting the correct name of one of the windows. I have a working script that can do this by tab,cut,paste,tab… but once I log into the application the program has dozens of textfields for stocks, open price ,close price, etc,etc. So that wouldn’t work,I need to know the names and values of the stock textfields and then when an alert is triggered I need to be able to set tthe values of the text fields for the order ticket. Ultimately, I want to be able to say something like(simplistic pseudocode):

systemClose = study(closingPrice)
myTicker = ticker(name=appl)
currentClose = tickerClose(close=lastBar)
currentStock = row(myTicker)
if textfield currentClose from textfield currentStock is less than systemClose then sell(equity=currentStock,orderType=Market)

sell() would be an method/applescript that would fill the order ticket.
Steven