the simplest of questions..

i’m embarrassed to tell you how long i’ve been trying to pull a value from a combo box.

i just can’t get the syntax right, and don’t know how to find out :frowning:

the text entries work fine with x
but the combo entries fail with y…

on clicked theObject
	tell window 1
		set x to contents of text field "FreeText" as text
		display dialog x
		set y to content of combo box "GreyDownTarget" as number
		display dialog y
	end tell
	(*Add your script here.*)
end clicked

please put me out of my misery!

set y to ((string value of combo box “GreyDownTarget”) as number)

Model: iMac Intel 10.5.8
Browser: Firefox 3.0.2
Operating System: Mac OS X (10.5)

That’s what I thought, but the syntax Kenjones99 posted actually works here, so there’s maybe something else going on.

What exactly do you mean by “it fails”?

hi, thanks for the reply - it works on a freshly added combo box but still not for the ones I have designed…

if i’ve got the combo box in a box do i need to refer to the box as well?



by name and after declaring it in the Applescript Inspector?

set y to (contents of combo box “GreyDownTarget” of box “Greyscale”) as number

still something missing…

Getting the reference to an interface element right can be a real struggle. One way around this is described in the last post of this thread.

Provided this is your problem of course. It would be helpful if you told us exactly what error you’re getting to establish the problem.

I’m trying to pull a range of values from a user before running a batch resampling to optimize images for InDesign. (The Applescript is all ready to go).

Have a window laid out like this but need to now access the values in the applescript…

Looks cool. I’ve been doing a lot of stuff with Illustrator. Very satisfying when it works.

Sorry to keep hammering on about this, but what is the error you’re getting?

yeah, i’m getting quite good with the script editor, but i just want to use ASStudio to make a better interface…

What’s about

 set y to float value of combo box "GreyDownTarget"

or integer value, if there are only integer numbers


the difference between ‘gray’ and ‘grey’ is small but important!!!

that’s what happens when you don’t take a break cos you’ve spent 8 hours straight trying to get something to work!!

it’s working now, and I may have to delete these posts to save my blushes, thanks for your help though mate :slight_smile:

We’ve all been there. These days I always copy and paste the names of interface elements between IB and Xcode or capture references as described in the link I gave you earlier.

By the way, the new AppleScriptObjC doesn’t use this system of referencing interface elements anymore.

yeah, i do too usually!

but my app created in 10.5 will work in 10.6 right? just become uneditable eventually

That’s my understanding, yes.

cool, i’ll be freelance by then so I can bill them for the upgrade! once i’ve learnt AppleScriptObjC that is!! :slight_smile:

thanks again. i’ll be back with my next question no doubt…