Jump to content

Recommended Posts

Posted

I will look into that; I also rewrote my script and decided to try using ImageSearch to see if I could match the text with a picture of the text:

#include <AutoItConstants.au3>
#include <MsgBoxConstants.au3>
#include <ImageSearch.au3>

;Press Esc to terminate script, Pause/Break to "pause"
Global $g_bPaused = False
;Coordinates for Image Search
Global $y = 0, $x = 0

HotKeySet("{INSERT}", "TogglePause") ; Pauses loop
HotKeySet("{ESC}", "Terminate") ; Ends loop
HotKeySet("+!d", "ShowMessage") ; Shift-Alt-d

;Clears out patient information for each letter of the alphabet
While 1
;This script works with Allscripts PM in fullscreen on a 1920x1080 monitor with the taskbar set at top of window
WinActivate ("Allscripts PM")

;Searches for patients by first letter of last name
ControlClick ("Allscripts PM", "", "[CLASS:msvb_lib_toolbar; INSTANCE:19]", "Left", 1, 32, 11)
ControlSend ("Patient Lookup", "", "[CLASS:ThunderRT6TextBox; INSTANCE:14]", "c")
Send ("{ENTER}")
Local $search = _ImageSearch('nomatchingrecord.PNG', 0, $x, $y, 0)
   If $search = 1 Then
      ExitLoop
   EndIf
Send ("{DOWN}{ENTER}")

;Clicks Patient tab
ControlClick ("Allscripts PM", "", "[CLASS:AfxOleControl42; INSTANCE:1]", "Left", 1, 112, 6)
Sleep (1500)

;Clears patient information
;Clears Last Name
ControlSetText ("Allscripts PM", "", "[CLASS:ThunderRT6TextBox; INSTANCE:63]", "")
ControlSend ("Allscripts PM", "", "[CLASS:ThunderRT6TextBox; INSTANCE:63]", "x")
;Clears First Name
ControlSetText ("Allscripts PM", "", "[CLASS:ThunderRT6TextBox; INSTANCE:62]", "")
ControlSend ("Allscripts PM", "", "[CLASS:ThunderRT6TextBox; INSTANCE:62]", "x")
;Clears Middle Initial
ControlSetText ("Allscripts PM", "", "[CLASS:ThunderRT6TextBox; INSTANCE:61]", "")
ControlSend ("Allscripts PM", "", "[CLASS:ThunderRT6TextBox; INSTANCE:61]", "x")
;Clears Suffix
ControlSetText ("Allscripts PM", "", "[CLASS:ThunderRT6TextBox; INSTANCE:50]", "")
ControlSend ("Allscripts PM", "", "[CLASS:ThunderRT6TextBox; INSTANCE:50]", "x")
;Clears Address 1
ControlSetText ("Allscripts PM", "", "[CLASS:ThunderRT6TextBox; INSTANCE:60]", "")
ControlSend ("Allscripts PM", "", "[CLASS:ThunderRT6TextBox; INSTANCE:60]", "x")
;Changes City to Flint
ControlSetText ("Allscripts PM", "", "[CLASS:ThunderRT6TextBox; INSTANCE:54]", "")
ControlSend ("Allscripts PM", "", "[CLASS:ThunderRT6TextBox; INSTANCE:54]", "Flint")
;Changes state to MI
ControlSetText ("Allscripts PM", "", "[CLASS:ThunderRT6TextBox; INSTANCE:68]", "")
ControlClick ("Allscripts PM", "", "[CLASS:Edit; INSTANCE:14]", "Left", 1, 16, 6)
ControlSend ("Allscripts PM", "", "[CLASS:Edit; INSTANCE:14]", "MI")
;Changes Zip to 48507
ControlSetText ("Allscripts PM", "", "[CLASS:ThunderRT6TextBox; INSTANCE:68]", "")
ControlSend ("Allscripts PM", "", "[CLASS:ThunderRT6TextBox; INSTANCE:68]", "48507")
;Changes Phone to 8102300338
ControlSetText ("Allscripts PM", "", "[CLASS:ThunderRT6TextBox; INSTANCE:65]", "")
ControlSend ("Allscripts PM", "", "[CLASS:ThunderRT6TextBox; INSTANCE:65]", "8102300338")
;Changes Social Security to 123456789
ControlClick ("Allscripts PM", "", "[CLASS:msvb_lib_toolbar; INSTANCE:18]", "Left", 1, 9, 9)
ControlSetText ("Access SSN", "", "[CLASS:ThunderRT6TextBox; INSTANCE:2]", "")
ControlSend ("Access SSN", "", "[CLASS:ThunderRT6TextBox; INSTANCE:2]", "123456789")
Send ("{ENTER}")
;Clicks Save
MouseClick ('Primary', 1802, 1052, 1, 0)

;Clicks Summary Tab
ControlClick ("Allscripts PM", "", "[CLASS:AfxOleControl42; INSTANCE:1]", "Left", 1, 38, 8)
Sleep (1500)
WEnd

;Func checkForImage()
;   Local $search = _ImageSearch('nomatchingrecord.PNG', 0, $x, $y, 0)
;   If $search = 1 Then
;     ExitLoop
;   EndIf
;EndFunc

Func TogglePause()
    $g_bPaused = Not $g_bPaused
    While $g_bPaused
        Sleep(100)
        ToolTip('Script is "Paused"', 0, 0)
    WEnd
    ToolTip("")
EndFunc   ;==>TogglePause

Func Terminate()
    Exit
EndFunc   ;==>Terminate

Func ShowMessage()
    MsgBox($MB_SYSTEMMODAL, "", "This is a message.")
EndFunc   ;==>ShowMessage

However I am receiving an error which I will attach. I am not sure if I am using _ImageSearch correctly or not.

error.PNG

Posted (edited)

I am no ImageSearch expert. I hope others will help. I would use Tesseract OCR

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...