Saturday, 21 May 2011

More macros

Ah but of course it is never so simple...

If the patient has a Vision reminders (yellow box) open then this gets the focus when you do winactivate.

So, this is my solution though I am sure there must be a more elegant one...

;Send focus to Consultation Manager
Set_Focus_ConMan:
Process, Exist,conmgr.exe ; set the variable errorLevel to the PID of con man
if ErrorLevel ; If Errorlevel is not zero then it is the PID of conman so
IfWinActive, ahk_pid %ErrorLevel% ; if it already active do nothing!
{
ExitApp
}
else ;otherwise...
{
WinActivate, ahk_pid %ErrorLevel% ; activate conman
IfWinActive, Patient Reminders ; and if the reminders are there they get the focus! So, close them
{
WinClose, Patient Reminders
sendinput, !vr ; then reopen them and conman will now be properly activated and have the focus
}
}
IF NOT ErrorLevel ; if errorlevel is zero con man is not running.
MsgBox,,Macro Run Error!, Consultation Manager is not running!
ExitApp

No comments: