Skip to content

Instantly share code, notes, and snippets.

@rohinomiya
Created June 21, 2012 16:31
Show Gist options
  • Save rohinomiya/2966860 to your computer and use it in GitHub Desktop.
Save rohinomiya/2966860 to your computer and use it in GitHub Desktop.
プロセス名を元に、そのアプリのウィンドウを操作する ref: http://qiita.com/items/198feae9488edc25c5d9
; Sample: Send key stroke to the window from process name.
NotFound = 0
ProgramFileName = cmd.exe
Process, Exist, %ProgramFileName%
PID = %ErrorLevel%
If(PID == NotFound)
{
MsgBox, Process"%ProgramFileName%" not found.
ExitApp
}
; activate command prompt.
WinActivate, ahk_pid %PID%
WinWaitActive, ahk_pid %PID%
sleep, 500
; send key stroke to command prompt
ControlSend, , echo message, ahk_pid %PID%
Send, {ALT DOWN}{TAB}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment