Couple of questions, Scrollable text window and input from textfield

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 :slight_smile:

You need to use an NSTextView, not an NSTextField.

You get the text from the text field (or text view), and then use normal scripting to put it into your application.

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.

What would the script be? :smiley:

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_.

That depends on the application in question – there’s no single script that suits all.

Ok, where is this “Code Launch” to add the text… or how do I use insertText_

Ok… back in the day I would use a script like this:

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

There’ll be an applicationWillFinishLaunching_() handler in the app delegate class; put it in there.

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.

shrug cocoa-applescript program… no idea how to open app delegate class… or you mean connection inspector?

:confused: Thank you for trying to help, I don’t want to keep bothering you with my noobyness :slight_smile:

So let’s start at the top. What version of OS and Xcode are you running?

OS : 10.6.8
xcode 4.2

cocoa-applescript application.

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.