Tuesday, January 23, 2018

#1 2003-01-23 09:35:30 am

chaynes75
Member
Registered: 2003-01-23
Posts: 2

Applescript/Applescript Studio help

Hi all,

I'm a new Applescripter and am working on a small GUI interface to a Unix app.  I know some Perl but I'm still a little dumbfounded on how to get at data in AS.  I've built a GUI with three text input boxes (NSTextField according to "Show Info").  I've put these boxes inside a "NSTabViewItem".  The Applescript names I assigned are username, password, other.   I'm trying to get the value of the text field with the following AS code:

Applescript:

set theUserName to contents of text field "username" of "Unix App GUI" as text

Although the script compiles, I get errors when clicking the "Action" button in the "on clicked theObject" subroutine.

I'm also trying to check to see if a checkbox is checked with the following:

Applescript:


set useMotionEvents to contents of button "motion" as boolean

if (useMotionEvents) then <blah blah>...

I get an error that the value can't be of type boolean.

If anyone can point me in the right direction, I would really appreciate it.

Thanks,
Charles

Applescript:

Offline

 

#2 2003-01-23 11:17:15 am

julifos
Administrator
From:: Malasaña, Madrid
Registered: 2002-11-20
Posts: 2014

Re: Applescript/Applescript Studio help

Hmmm... Untested, but it should be anything such as:

Applescript:

set varName to contents of text field "whatever" of tab group "whatever" of window "whatever"

You can target these items by name or index.
And the same syntax may work for the checkbox... Untested, too, but "contents" of the checkbox property should be already a boolean, so you don't need re-coerce it.

Tell us!

Offline

 

#3 2003-01-23 04:04:42 pm

chaynes75
Member
Registered: 2003-01-23
Posts: 2

Re: Applescript/Applescript Studio help

I did finally get to the data in the text field.

Applescript:


tell window of theObject
set theVar to contents of text field "whatever" of tab view item "whatever" of tab view "tabs" as text
end tell

This is a big learning curve for me as it is nothing like Perl  smile

Thanks,
Charles

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)