Need Simple AppleScript Help

ABassCube

Registered
OK,

I've been starting to try and learn some AppleScript, but something that should be really simple I can't seem to find. How do you write a script to type text? If it makes any difference, I want to type something in the Terminal, but I don't want to just do a command in the terminal and quit. I want to keep the terminal open after it types the command.

Can anyone help me with this?

Thanks in advance.

Adam
 
Try:

Code:
tell application "Terminal"
do script with command "blah blah blah"

I dunno if it'll work, but that's what the Terminal dictionary says :p

If you want to just do a quick shell command, try do shell script "blah blah blah"
 
I've tried that. It doesn't work. I have the command in quotes at the end of the line, and when I check syntax it highlights the open quote and says "Expected end of line, etc. but found "

Thanks for the reply, though.

Any more help would be appreciated.

Adam
 
OK, this is kind of strange.

Now when I do it (the "do scrip with command"), it works! What the hell?

All I did was try to put it without the quotes, and when I checked syntax it was fine. But when I ran the script, it gave me an error saying the variable was not defined. So then I just put the quote back in, and the syntax was fine! I ran the script, and it worked! The line is exactly the same, so I don't know why checking syntax gave me an error one minute and was fine the next.

Whatever, it works now. :)

Adam
 
That "Expected end of line but found " error means that you forgot to put the "end tell" line in your script. I imagine that because it's working now, you put that line in.
 
Back
Top