Re: Make New Window in Terminal...
Re: Make New Window in Terminal...
- Subject: Re: Make New Window in Terminal...
- From: Johnny AppleScript <email@hidden>
- Date: Sat, 25 Sep 2004 11:27:23 -0600
Title: Re: Make New Window in Terminal...
David,
Like you, I have found a need to run actual items in Terminal; e.g., what good is running top in a shell script? Below I have included a badly-written example that works, and it demonstrates a few stupid workarounds that I had to create to get the effect I wanted, because of Terminal’s really pathetic dictionary and default behaviors; e.g., it insists on opening a window when it is launched, its refresh capabilities are limited; more.
This could be prettier, but it demonstrates, more or less, what you’re trying to do.
set openScript to "echo hello"
set superTOP to "/usr/bin/top -ocpu -R -F -s 2 -n44"
tell application "System Events"
if exists application process "Terminal" then
tell application "Terminal"
set winList to every window whose name is "top"
if winList is {} then
do script openScript
delay 2
my doTop(superTOP)
end if
end tell
else
tell application "Terminal"
close every window
do script openScript
my doTop(superTOP)
end tell
end if
end tell
on doTop(superTOP)
tell application "Terminal"
set topWin to item 1 of every window
-- set bounds of topWin to {1299, -1020, 1954, -244}
set bold text color of topWin to "black"
set background color of topWin to {-1, -1, -1, 3276}
do script superTOP in topWin
end tell
end doTop
HTH — JA
On 04/09/25 10:08 AM, "David Crowe" <email@hidden> wrote:
> I have found that running scripts in the background is difficult to
> make work with "do shell script". Besides, if you want to see the
> status of the process it's a lot easier to open the terminal window.
> Since my script can automatically hide the Terminal application I
> hardly know it's there.
>
> I think what I am going to do is to give the window for my particular
> application a particular name and then, when running the script,
> check to see if that window exists, and then use it. If not I will
> just run the script without specifying a window which will cause
> Terminal to create one. This also avoids me running ssh in a window
> where I was in the midst of doing something else.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden