|
|
#1 |
|
XCode - Cocoa-applescript question
Hi All,
I am trying to create a simple Cocoa-applescript, however I am having issues with getting a Text Field or Label to display the output from a shell command. I know this probably basic stuff but an help would be most grateful Thanks |
|
|
|
0
|
|
|
#2 |
|
Is this an Xcode or AppleScript Editor project? Usually you would get the result from your shell script and put it into the text field using its setStringValue: method, although bindings can also be used. What have you done so far?
__________________
MacBook Pro / OS X Mountain Lion (10.8.3) / Xcode 4.6 / [various (much) older stuff keeping dust off the shelves] |
|
|
|
0
|
|
|
#3 |
|
Thank you very much for the quick response.
Last edited by djjasonsa; Feb 22, 2013 at 11:08 AM. |
|
|
|
0
|
|
|
#4 |
|
The text field you're trying to populate, have you changed it's behaviour from editable to selectable or none?
Your posted code works fine for me if the text field behaviour is set to editable. To make it work when the text field behaviour is set to selectable or none I had to put your code into the awakeFromNib method rather than an IBAction method, like so: Code:
on awakeFromNib()
set ipAddress to (do shell script "ifconfig | grep -B 2 active | grep -E \"inet \" | awk {'print $2'}")
label's setStringValue_(ipAddress)
end awakeFromNib
|
|
|
|
0
|
![]() |
|
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
All times are GMT -5. The time now is 03:38 PM.






Linear Mode
