Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
Set variable to output of text field- xcode 4.5, applescript
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Mark FX" data-source="post: 1492892" data-attributes="member: 211556"><p>The problem you have is that the text returned by the NSTextField is of a class called NSCFString, this needs to be converted into an Applescript text class like this.</p><p></p><p>[CODE]</p><p> on test_(sender)</p><p> set theText to sender's stringValue() as text --see here</p><p> if theText is equal to "Hello World"</p><p> display dialog theText</p><p> end if</p><p> end test_</p><p>[/CODE]</p><p></p><p>See how i've converted the senders stringvalue() into type Applescript text</p><p></p><p>I mostly work in the Objective C language, so dont do much Applescript these days, so you have to make sure that you convert into a class that Applescript understands, to check the class of an object do this.</p><p></p><p>[CODE]</p><p> on test_(sender)</p><p> log class of sender's stringValue()</p><p> end test_</p><p>[/CODE]</p><p>That should do you.</p><p></p><p>Regards mark</p></blockquote><p></p>
[QUOTE="Mark FX, post: 1492892, member: 211556"] The problem you have is that the text returned by the NSTextField is of a class called NSCFString, this needs to be converted into an Applescript text class like this. [CODE] on test_(sender) set theText to sender's stringValue() as text --see here if theText is equal to "Hello World" display dialog theText end if end test_ [/CODE] See how i've converted the senders stringvalue() into type Applescript text I mostly work in the Objective C language, so dont do much Applescript these days, so you have to make sure that you convert into a class that Applescript understands, to check the class of an object do this. [CODE] on test_(sender) log class of sender's stringValue() end test_ [/CODE] That should do you. Regards mark [/QUOTE]
Verification
Name this item 🌈
Post reply
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
Set variable to output of text field- xcode 4.5, applescript
Top