Re: Terminal Scripting
Re: Terminal Scripting
- Subject: Re: Terminal Scripting
- From: Martin Orpen <email@hidden>
- Date: Sat, 28 Feb 2004 00:31:55 +0000
on 27/2/04 10:25 pm, Kris Jensen at email@hidden wrote:
>
I'm trying to:
>
>
- make a new Terminal window
>
- change directories
>
- start a terminal-based application
>
>
Based on various things I've read in the mailing list archives, I've
>
tried this just to get a new window and change directories:
>
>
tell application "Finder"
>
set dname to POSIX path of ((folder of (path to me)) as string)
>
end tell
>
>
tell application "Terminal"
>
set scriptCommand to "cd " & dname
>
activate
>
do script "echo \"123\""
>
delay 2
>
do script scriptCommand in window 1
>
end tell
>
>
But it doesn't work. I don't get a new window.
>
>
The event log (for the Terminal section of the script) looks like:
>
>
tell application "Terminal"
>
activate
>
do script
>
do script in window 1
>
end tell
>
>
Do I have an obvious (or not so obvious) error?
I guess so, because Terminal is famous for producing new windows when you
don't want them :-)
You are asking Terminal to do the script in "window 1" so it is doing it in
the existing window. If you tell it to it to just "do script" it will make a
new window for you.
tell application "Terminal"
set scriptCommand to "cd " & " /"
activate
do script "echo \"123\""
delay 2
do script scriptCommand
do script "ls -al" in window 1
end tell
Regards
--
Martin Orpen
Idea Digital Imaging Ltd -- The Image Specialists
http://www.idea-digital.com
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.