views:

28

answers:

1

I am fairly new with Xcode and Interface builder. I am running into a bit of trouble while trying to make a simple app that will create an email with several properties. All I want it to do is to take the email entered in the form and put it in the "TO:" field. Everything else in my code seems to work fine, it's just getting what is entered in the text field to transfer over. I created a subclass of NSObject called AppController and I believe I properly linked everything as outlets and actions go. I have been trying to solve this on my own for hours, any help is greatly appreciated!

For reference, this is what the app looks like:

link text

script AppController 

property parent : class "NSObject"

 property textForm : missing value

 on sendInfo_(sender)

  tell application "Mail"
   set newMessage to make new outgoing message with properties {visible:true, subject:"subject goes here", content:"hello world"}
   tell newMessage
    make new to recipient with properties {address:textForm}
   end tell
  end tell

 end sendInfo_
end script
A: 

I don't use applescript-objective c so I don't know the proper syntax, however you need to get the stringValue from the text field. An NSTextField has many properties so you have to get the appropriate one and in this case you want the stringValue. In straight objective-c that command would look like this...

NSString *toAddress = [textForm stringValue];
make new to recipient with properties {address:toAddress}
regulus6633