• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Send Terminal window crtl-c
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >Send Terminal window crtl-c (From: Gnarlodious <email@hidden>)

  • Prev by Date: Re: Send Terminal window crtl-c
  • Next by Date: RE: question for sending multiple requests to iTunes
  • Previous by thread: Re: Send Terminal window crtl-c
  • Next by thread: Re: Send Terminal window crtl-c
  • Index(es):
    • Date
    • Thread