Re: Sending Control-T to Terminal
Re: Sending Control-T to Terminal
- Subject: Re: Sending Control-T to Terminal
- From: John W Baxter <email@hidden>
- Date: Fri, 27 Sep 2002 13:02:05 -0700
At 22:24 -0700 9/26/2002, bill fancher wrote:
>
On Wednesday, September 25, 2002, at 02:14 PM, Jeffrey Berman wrote:
>
>
> On Wed, 25 Sep 2002, bill fancher <email@hidden> wrote:
>
> However, I do
>
> not want these unattended key sequences to trigger a line feed or it
>
> could
>
> cause the text on the command line to be inadvertently executed. What
>
> made
>
> an AppleScript solution so appealing is that the command can be issued
>
> even
>
> when Terminal is not the frontmost application.
>
>
>
> So the problem is how to have the "do script" command of Terminal send
>
> the
>
> Control-T sequence (which is ASCII character 20) without also issuing
>
> a line
>
> feed.
>
>
About the only thing I can think of: if the last line of the contents
>
of the window matches the prompt string, don't send the "do script"
>
command. It's a slovenly hack, but it might be serviceable.
The -n flag given to the echo command suppresses the line ending which echo
otherwise supplies. This may or may not be helpful in solving this
problem, but it seems to "work"
This foolish script:
tell application "Terminal"
do script "echo bar" in window 1
do script "echo -n foo" in window 1
do script "echo baz" in window 1
do script "echo -n ham ; echo eggs" in window 1
end tell
produces this mess in the Terminal window (bash shell, so things aren't
what you'll see):
[john@Zeus john]$echo bar
bar
[john@Zeus john]$echo -n foo
foo[john@Zeus john]$echo baz
baz
[john@Zeus john]$echo -n ham ; echo eggs
hameggs
[john@Zeus john]$
>
_______________________________________________
>
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.
--
John Baxter email@hidden Port Ludlow, WA, USA
_______________________________________________
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.