Re: Move and resize the window
Re: Move and resize the window
- Subject: Re: Move and resize the window
- From: Graff <email@hidden>
- Date: Wed, 10 Mar 2004 12:36:40 -0500
Well, to open a window just run a "do script" command. It can even be
a blank one:
----------
tell application "Terminal"
do script ""
end tell
----------
As far as identifying open windows that is a lot tougher. You can get
a list of windows and you can go through them but as far as identifying
them that is much harder. If you have Terminal->Window Settings,
select "window" from the pop-up menu, and check "active process name"
then the currently running process will be part of the window title.
Then maybe you can filter each window by its name, if you are running a
different process in each.
-Ken
On Mar 10, 2004, at 6:34 AM, Juguang Xiao wrote:
Thanks Ken, your tips work!
However my question seems not to be answered straightly.
How can I activate/open another instance of Terminal after once there
are some Terminal windows on? The below one can open one terminal
window only if there is nothing on before.
---
tell application "Terminal"
activate
end tell
-------
Also, how to identify Terminal windows which are not 'front window'?
Thanks in advance.
Juguang
To open a new Terminal window all you have to do is run a command.
You do it like this:
----------
tell application "Terminal"
do script ""
end tell
---------
The blank command will just cause a window to open. To run a command
instead of just doing nothing you would do something like this:
---------
tell application "Terminal"
do script "cd ~/Documents/"
end tell
---------
This will execute the command "cd ~/Documents/" in a new Terminal
window.
To do more shell commands in the same window without combining them
into one "do script" command you could combine them with a semicolon
like this:
---------
tell application "Terminal"
do script "cd ~/Documents/; ls -l"
end tell
---------
This is exactly how you would combine commands if you wanted to do
this in the shell.
If you can't combine them then you will have to save what window you
are working in so that you can do each command in that window. Since
the last window opened is the front one this is easy:
---------
tell application "Terminal"
do script "cd ~/Documents/"
set theWindow to front window
delay 1
do script "ls -l" in theWindow
end tell
---------
You need to have a little delay in there because for some reason if
the commands are entered too quickly they don't get executed
properly. I did a delay of 1 second to prevent this
-Ken
On Mar 4, 2004, at 10:35 PM, Juguang Xiao wrote:
I am very new to AppleScript, so my this question may be quite
naive. I cannot find a right reference to answer it.
How to open a new Terminal, rather than activate it? And how to move
and resize the window of it?
One general question is how to find the method set of one specific
Application? Such as what are methods available for/in/from
Terminal.
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Juguang Xiao
_______________________________________________
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.