You are not logged in.
Pages: 1
Hello, I'm getting back into scripting. Right now I have a couple questions that have stumped me and cant seem to find help on google, though its probably out there...
1.) I want to create a scrollable textfield with sliders...
2.) How can I input text from a textfield to a given program, such as input to text edit. Either upon a button or just pressing enter.
I'm creating a game like program for a game, which contains lots of macro's etc.
Thank you for any help!
-Happy scripting ![]()
Last edited by Domminust (2012-03-05 02:55:13 pm)
Offline
Domminust wrote:
1.) I want to create a scrollable textfield with sliders...
You need to use an NSTextView, not an NSTextField.
2.) How can I input text from a textfield to a given program, such as input to text edit. Either upon a button or just pressing enter.
You get the text from the text field (or text view), and then use normal scripting to put it into your application.
Online
Shane Stanley wrote:
You need to use an NSTextView, not an NSTextField.
Yes I have tried to use NSTextView, however it does not let me edit the text in Xcode, when I double click it to highlight the text field, there is no curser and am not able to type. However I can type there when I launch my program but I want text to be saved there on the application permanently.
You get the text from the text field (or text view), and then use normal scripting to put it into your application.
What would the script be? ![]()
Last edited by Domminust (2012-03-06 12:19:57 am)
Offline
Domminust wrote:
Yes I have tried to use NSTextView, however it does not let me edit the text in Xcode, when I double click it to highlight the text field, there is no curser and am not able to type. However I can type there when I launch my program but I want text to be saved there on the application permanently.
Text views don't work like that. You will have add the text in code at launch, or somewhere else convenient. You can probably just use insertText_.
What would the script be?
That depends on the application in question -- there's no single script that suits all.
Online
Shane Stanley wrote:
Text views don't work like that. You will have add the text in code at launch, or somewhere else convenient. You can probably just use insertText_.
Ok, where is this "Code Launch" to add the text.... or how do I use insertText_
That depends on the application in question -- there's no single script that suits all.
Ok.. back in the day I would use a script like this:
tell application "system events"
tell application "textedit"
on mybuttonhandler_(sender)
set mytext to the contents of text field "textfield"
keystroke mytext
So say I want to input text from a text field to some application?
Thanks again for your help, like I said its been a while since I played with scripting since xcode 2.4
Last edited by Domminust (2012-03-06 12:47:29 am)
Offline
Domminust wrote:
Ok, where is this "Code Launch" to add the text....
There'll be an applicationWillFinishLaunching_() handler in the app delegate class; put it in there.
Ok.. back in the day I would use a script like this:
tell application "system events"
tell application "textedit"
on mybuttonhandler_(sender)
set mytext to the contents of text field "textfield"
keystroke mytextSo say I want to input text from a text field to some application?
Thanks again for your help, like I said its been a while since I played with scripting since xcode 2.4
It's all changed somewhat since then; AppleScriptObjC is nothing like AppleScript Studio. Unfortunately there's no official Apple documentation, but you might want to look around here at the various discussions. The short story is that you're going to have to learn some of the basics if you're going to get anywhere with it.
Online
*shrug* cocoa-applescript program.. no idea how to open app delegate class.... or you mean connection inspector?
Thank you for trying to help, I don't want to keep bothering you with my noobyness ![]()
Offline
So let's start at the top. What version of OS and Xcode are you running?
Online
OK, the default script that opens is the app delegate class.
You're going to have to look at the tutorials around here or elsewhere on the Web, or stump up for my book, I'm afraid -- it's reasonably complex to get started. It's not the sort of thing that can be answered in one simple post here.
Online
Pages: 1