Hello,
I am trying to change the text of a label in my window
The applescript name is “StatusLabel” and is located in the main window.
I am using this
set contents of text field “StatusLabel” of window “Main” to “Checking for new mail”
But getting this:
"Can’t set window “Main” to “Checking for new mail” (-10006)
I have tried to search everywhere, and they all(as far as i can tell) use the same syntax,
so what am i doing wrong?
I am doing all this i Xcode…
All tips/tricks are more thank welcome…
Best…Jklarsen
Hi,
first of all: please post Xcode topics in the Xcode forum.
Are all elements named correctly in Interface Builder?
The error message implies that it doesn’t know anything about the text field
Hi Stefan,
And thanks for the swift reply, and sorry for being in the wrong forum.
As far as i can tell i have named it correctly in the applescript section of the inspector.
I have also choosen a script for it to refer to, should i click some of the event handler boxes?
best…Jklarsen
You need to specify the script only, if you want to use event handlers.
Just to set or get the contents of an element the naming is sufficient
the window is not named and the text field is too narrow
To find out some more i now tried this.
set labeltekst to get contents of text field "lablen"
Which gives me :
Cant get <> “lablen” (-1728)
It looks like there is no connection between the script and the interface?
Best…jklarsen
I have now named the window, and widened the label…
Same result?
Best…jklarsen
I have also named the window “Main” (not the view!) in the AppleScript tab and it works
That is very strange…
Still no luck here, but the “debug test” project works fine, so i will try so see if i can somehow transfer some of that.
Thanks…Jklarsen
load your working project here
ok - that is just strange.
your zip project works, but i dont know why…
One thing though, is that i cannot see that you have name your window anywhere,
so where do you name your window?
Best…jklarsen
in window MainMenu.xib click Window, then look at Inspector > AppleScript > Name
I am afraid that it is not named anything?
But nevertheless i know have a some code working, which i can move forward with.
Thank you very much for your help.
Best…jklarsen
Sorry my bad!
I thought i should click on the window and then name it in the applescript area.
Now everything works!
Thanks once again…
Best…jklarsen