Send keystroke to terminal
Send keystroke to terminal
- Subject: Send keystroke to terminal
- From: John Masters <email@hidden>
- Date: Sun, 11 Jul 2010 13:04:58 +0100
Hi,
I need to regularly send a keystroke to a program running in the terminal. So far I have got it to save the frontmost app to a variable, switch to the terminal, send the keystroke and then switch back. This works but causes a momentary 'blink' in the frontmost app. Is there any way to send a keystroke to a terminal application without bringing the terminal to the foreground? Basic code is as follows.
tell application "System Events"
set frontProc to name of the first process whose frontmost is true
set theproc to do shell script "ps ux | awk '/slrn/ &&!/awk/ {print $2}' &"
if theproc is not equal to "" then
tell application "Terminal" to activate
keystroke "G" using shift down
end if
set frontmost of process frontProc to true
end tell
--
Regards, John K Masters
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:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden