Wednesday, November 22, 2017

#1 2009-09-03 09:14:09 pm

bfulton
Member
Registered: 2008-04-10
Posts: 6

Frustrated but optimistic

I have been a grateful user of applescript only recently finding the gem that is applescript studio to build awesome applications with little knowledge of code writing. I am really excited about what I believe will come from this "first class" treatment inside of x-code. But right now I can't help but vent my frustration where it seems most appropriate. I couldn't figure out how to change a label through code. I figured it would be a good first "try" especially having the first tutorial that is posted in the unscripted forum. All this to say, "I can't wait till we get some good books written that break it down the way we've had applescript books up till now."

Offline

 

#2 2009-09-04 12:51:28 am

Kevin Bradley
Administrator
From:: Independence, MO
Registered: 2006-03-13
Posts: 548
Website

Re: Frustrated but optimistic

What kind of "label" are you wanting to change?  If you are talking about a button's title, you change the title:

Applescript:

set title of button "whatever" to "whatnot"

Is this what you mean?


Nitewing '98
--
I distrust morning people, largely because I suspect them of getting together early one day while the rest of us were asleep and setting up the rules of civilization.

Offline

 

#3 2009-09-04 07:03:06 pm

Craig Williams
Administrator
From:: Ft. Smith, AR
Registered: 2006-12-07
Posts: 888

Re: Frustrated but optimistic

Another way.

Applescript:


on onButtonClick_(sender)
set title of sender to "New Title"
end onButtonClick_

You can also "bind" the button to a property in your app.
The ScreenCast in Part 2 demonstrates how to create
bindings and Part 4 covers how "setMyButtonTitle" works.

Applescript:


property myButtonTitle : "Click Me" -- Initial title

on onButtonClick(sender)
   -- changes the value of myButtonTitle
   -- which the button is bound to so the
   -- button title is changed
   my setMyButtonTitle_("My Title")
end onButtonClick_

There are many very cool things we can do with AppleScriptObjC but most require us to learn *some* Objective-C. There are a lot of things you can accomplish with bindings but at some point learning some Objective-C will still be necessary.

If you have specific questions about any of the tutorials don't hesitate to ask.

hth,

Craig Williams

Offline

 

#4 2009-09-10 05:18:12 pm

bfulton
Member
Registered: 2008-04-10
Posts: 6

Re: Frustrated but optimistic

Thank you both for your responses. I was venting and left out some details as to what I was attempting to do. My only goal was to change the text inside a text field.

Offline

 

#5 2009-09-11 07:48:04 am

Craig Williams
Administrator
From:: Ft. Smith, AR
Registered: 2006-12-07
Posts: 888

Re: Frustrated but optimistic

This is covered in AppleScriptObjC in Xcode Part 1.

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)