Aqui está um script AutoHotkey que emula as seguintes etapas do usuário:
- Abra a janela principal, se ainda não estiver aberta
- Envie Ctrl - Q para que o pidgin seja encerrado
.
pidginMainWindowTitle := "Buddy List"
process, exist, pidgin.exe
if(ErrorLevel!=0) {
; Pidgin process is running -> close it
if(!winExist(pidginMainWindowTitle)) {
; ..but main window is not.
; determine full pidgin path
winGet, pidginPath, ProcessPath, ahk_exe pidgin.exe
if(pidginPath=="") {
msgbox, Process path empty?
exitapp
}
; run pidgin again: will open main window
run %pidginProcessPath%
; wait for the window max. 2 seconds
winWait, %pidginMainWindowTitle%,, 2
if(ErrorLevel==1) {
msgbox, Couldn't start main window
exitapp
}
; send exit key combo to pidgin main window
controlSend,, ^q, %pidginMainWindowTitle%
; wait for the process to close max. 2 seconds
process, WaitClose, pidgin.exe, 2
if(ErrorLevel) {
msgbox, Couldn't exit pidgin gracefully
exitapp
}
}
}