Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Script to run a command in new Terminal window works un-reliably.



It almost work ... 
If Terminal does not do anything, it works most of the time
If Terminal is busy (for example you have window with "top" running), it works very very seldom
If Terminal very busy ( 3 windows with "top" ), it  never works.

This is what I have done to make it work 

tell application "Terminal" to activate
delay 0.1
tell application "System Events" to tell process "Terminal" to keystroke "k" using command down
delay 0.1
tell application "System Events" to tell process "Terminal" to keystroke "k" using command down
delay 0.1
tell application "System Events" to tell process "Terminal" to keystroke "k" using command down

I wonder if it is possible to test that "keystroke" actually been delivered to "Terminal"?  My concern is that on slower boxes even 3 attempts may not be enough.

Thanks,

Andrei Tchijov
Leaping Bytes, LLC

On Jul 27, 2006, at 1:34 PM, dev_sleidy wrote:

In response to 'Now, just one more thing left ... simulate ... (Clear Scrollback) command', as an alternative to 'click menu ...', you can use ...

tell application "Terminal" to activate
tell application "System Events" to tell process "Terminal" to keystroke "k" using command down

_______________________________________________
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

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-users/email@hidden

This email sent to email@hidden

References: 
 >Script to run a command in new Terminal window works un-reliably. (From: Andrei Tchijov <email@hidden>)
 >Re: Script to run a command in new Terminal window works un-reliably. (From: dev_sleidy <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.