How would I make something in cocoa, where the user would type in "open" (space) "www.google.com" and it would open up a page that was directed to google. If the user didn't type open as the first word it would give an error. Also www.google.com could be whatever the user wants it to be. I know it may seem complicated, but it's similar to terminal.
+6
A:
You could use componentsSeparatedByString: on the string the user enters to get an array of words (just pass in @" " as your argument), check to see if "open" is the first word, and handle the rest from there.
Yanik Magnan
2009-09-05 16:46:55
A:
If you use an NSSearchField, the NSSearchFieldCell can be configured to send the search string immediately, and you can look for when the search string matches @"open "
and if not, throw an error (this is if you want it to check as you are typing).
Scott G
2009-09-05 17:18:25