;Script to obtain the Patient's medical record number(MRN) from the Agfa PACS Display Window and enetr it in CPRS to select the patient. ;This script runs when the Wndows key and c are pressed simultaneously #c:: DetectHiddenText, on ; Let invisible text in a window be "seen" for the purpose of finding the window. SetTitleMatchMode 2 ;Winget Retrieves the unique ID numbers of all existing windows that match the specified class #32770 (agfa Dispaly Window) ; but exclude windows the Study information window and the Study list window WinGet, id, list,ahk_class #32770,,Study Information ,List ;This loop goes through all the windows detected on the prior step and ControlGetText retrieves text from the control "Static5" ;The control Static5 contains the patient MRN Loop, %id% { this_id := id%A_Index% ControlGetText cText, Static5, ahk_id %this_id% IfInString, cText, - {controlText = %cText% } } ;Check to see if a MRN as been retreived IfInString, controlText, - { ; Check for CPRS if the CPRS window is not open, open CPRS and wait for user to log-in IfWinNotExist, ahk_class TfrmFrame { ;Need to change server location and port Run, "C:\Program Files\vista\cprs\CPRSCH~1.EXE" S="enter your vista server" P="19210" winWait, VistA CPRS in use by:, } ; If CPRS is not currently active (foremost), activate CPRS (bring to front). IfWinNotActive, VistA CPRS in use by: , , WinActivate, VistA CPRS in use by:, ;Wait for CPRS to be activated WinWaitActive, VistA CPRS in use by: , ; Open the menu File -> Select New Patient WinMenuSelectItem, VistA CPRS in use by:, ,File, Select New Patient... ; Wait for the Select New Patient Windows to open and enter the medical record number in the selection box WinWait, Patient Selection, IfWinNotActive, Patient Selection, , WinActivate, Patient Selection, WinWaitActive, Patient Selection, Sendinput %controlText% Sleep, 1000 ; 1 second endInput {Enter} } ;if a SSN was not retreived, ask the user to open the PACS display window else { MsgBox ,16, PACS Display Window not open. Open PACS display window! } return