Re: Send Terminal window crtl-c
Re: Send Terminal window crtl-c
- Subject: Re: Send Terminal window crtl-c
- From: Philip Aker <email@hidden>
- Date: Mon, 04 Sep 2006 08:06:46 -0700
On 2006-09-04, at 06:51:18, Gnarlodious wrote:
How would one send an open Terminal window a ctrl-c to stop a process?
For example:
tell application "Terminal"
do script "top" in front window
delay 10
do script "^c" in front window
end tell
In this example, the ctrl-c doesn't quit the top window.
tell application "Terminal" to activate
tell application "System Events"
tell process "Terminal"
tell menu "File" of menu bar item "File" of menu bar 1
click menu item "Send Break (Ctrl-c)"
end tell
end tell
end tell
BTW, I think you've exposed the soft underbelly of a potential DOS-
like security issue. Namely that:
tell application "Terminal" to activate
tell application "System Events"
tell process "Terminal"
keystroke "c" using {control key down}
end tell
end tell
Can really gum up the works. (yes, I found out the hard way).
Philip Aker
email@hidden
_______________________________________________
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