idontknow989 Posted January 9, 2018 Posted January 9, 2018 I have a script that loops through a database in Allscripts PM and clears out patient information. It cycles through the list of patients by pressing the down arrow key and I am having trouble finding a way to have the script stop at the end of the list of patients. Is there a way track when the down arrow key hits the last person in the list?
Earthshine Posted January 9, 2018 Posted January 9, 2018 (edited) this is done in a browser, is it not? You will most likely need UIAutomation by junkew because I don't think you can know when you hit the bottom. if you could query the database yourself you could get a recordset and loop while not EOR (End Of Record) The UIAutomation UDF can make automating browsers a reality Edited January 9, 2018 by Earthshine My resources are limited. You must ask the right questions
idontknow989 Posted January 9, 2018 Author Posted January 9, 2018 @Earthshine Allscripts PM is not a browser but I separate program does UI automation only work for browsers?
Earthshine Posted January 9, 2018 Posted January 9, 2018 (edited) No UIAutomation can automate many apps and things that you just can't do with regular style AutoIt scripting. Do you know what that application is written in perhaps? in the SciTe editor, in the menu, under Tools there is Au3Info finder tool, use that to see if you can locate the elements you want to click on or automate using that spy tool and post your results here. I can usually tell what it is written in because the data will show what controls and forms are used. Edited January 9, 2018 by Earthshine My resources are limited. You must ask the right questions
Earthshine Posted January 9, 2018 Posted January 9, 2018 SQL is part of the database stuff for sure. My resources are limited. You must ask the right questions
idontknow989 Posted January 9, 2018 Author Posted January 9, 2018 (edited) I'm not sure what it is written in. Edited January 9, 2018 by idontknow989 grammar
Earthshine Posted January 9, 2018 Posted January 9, 2018 you can use the AU3Info tool to find the list you care about and capture what the tool finds and post it here My resources are limited. You must ask the right questions
idontknow989 Posted January 9, 2018 Author Posted January 9, 2018 What information about the list should I post?
Earthshine Posted January 9, 2018 Posted January 9, 2018 (edited) post your script. you need to learn how to use the AU3Info tool. Go read the help and figure that out. run your app and use that tool to point to the list you are automating. it will return you lots of information. screen capture and post that stuff. I need the Window and Control information to see what we can do. Edited January 9, 2018 by Earthshine My resources are limited. You must ask the right questions
idontknow989 Posted January 9, 2018 Author Posted January 9, 2018 Here is the script: #include <AutoItConstants.au3> #include <MsgBoxConstants.au3> ;Press Esc to terminate script, Pause/Break to "pause" Global $g_bPaused = False HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") HotKeySet("+!d", "ShowMessage") ; Shift-Alt-d While 1 ;This script works with Allscripts PM in fullscreen on a 1920x1080 monitor WinActivate ('Allscripts PM') ;Clicks the patient search button in Registration Sleep (2000) MouseClick ('Primary', 503, 200, 1, 0) ;Selects patient from list Send ('a') MouseClick ('Primary', 1050, 599, 1, 0) Send ('{ENTER}{ENTER}{DOWN}{ENTER}') Sleep (2000) ;If a error window pops up will close that window MouseClick ('Primary', 1177, 685, 1, 0) Sleep (2000) ;Clicks the policy tab MouseClick ('Primary', 490, 100, 1, 0) ;Clicks the Exp Date box MouseClick ('Primary', 528, 441, 1, 0) Send ('01/01/2020') ;Enters in Cert No. MouseClick ('Primary', 385, 252, 1, 0) MouseClick ('Primary', 362, 533, 1, 0) Send ('1234') MouseClick ('Primary', 388, 268, 1, 0) MouseClick ('Primary', 362, 533, 1, 0) Send ('1234') ;Clicks the account tab MouseClick ('Primary', 412, 104, 1, 0) ;Changes contact birthdate for multiple contacts Sleep (2000) MouseClick ('Primary', 703, 476, 1, 0) Send ('01/01/1970') ;Changes contacts gender MouseClick ('Primary', 801, 455, 1, 0) MouseClick ('Primary', 802, 484, 1, 0) Sleep (2000) MouseClick ('Primary', 402, 311, 1, 0) Sleep (2000) MouseClick ('Primary', 703, 476, 1, 0) Sleep (2000) Send ('01/01/1970') ;Changes contacts gender MouseClick ('Primary', 801, 455, 1, 0) MouseClick ('Primary', 802, 484, 1, 0) Sleep (2000) ;Clicks ok if a message box pops up MouseClick ('Primary', 1033, 610, 1, 0) Sleep (2000) ;Clicks the patient tab MouseClick ('Primary', 343, 105, 1, 0) ;Clicks the home phone box MouseClick ('Primary', 714, 261, 1) Sleep (2000) Send ('8102300338') ;Clicks the last name box Sleep (2000) MouseClick ('Primary', 341, 285, 1) ;Replaces all the patient information Sleep (2000) Send ('x x') Send ('{TAB}') Send ('x') Send ('{TAB}') Send ('x') Send ('{TAB}') Send ('x') Send ('{TAB}') Sleep (2000) Send ('x') ;If a change address window pops up MouseClick ('Primary', 989, 616, 1) Send ('{TAB}') Send ('x') Sleep (2000) ;Clicks the city box MouseClick ('Primary', 342, 381, 1) Sleep (2000) Send ('Flint') Send ('{TAB}') Send ('{TAB}') Send ('48507') Send ('{Enter}') Send ('{Down}') Send ('{Down}') Send ('{Enter}') MouseClick ('Primary', 1047, 606, 1) Sleep (2000) ;Clicks the social security button MouseClick ('Primary', 576, 256, 1, 0) Send ('{BACKSPACE}') Send ('{BACKSPACE}') Send ('{BACKSPACE}') Send ('{BACKSPACE}') Send ('{BACKSPACE}') Send ('{BACKSPACE}') Send ('{BACKSPACE}') Send ('{BACKSPACE}') Send ('{BACKSPACE}') Send ('{BACKSPACE}') Send ('{BACKSPACE}') Send ('123456789') Sleep (2000) Send ('{ENTER}') ;Clicks the save button MouseClick ('Primary', 1813, 1010, 1, 0) ;Clicks the Summary tab MouseClick ('Primary', 269, 104, 1, 0) Sleep (2000) WEnd 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
Earthshine Posted January 9, 2018 Posted January 9, 2018 (edited) good. those are VB6 forms no doubt. We need to figure out how to manipulate the flexgrid. can you make the window bigger so I can see all the control text? you can manipulate that direct most likely. Edited January 9, 2018 by Earthshine My resources are limited. You must ask the right questions
Earthshine Posted January 9, 2018 Posted January 9, 2018 (edited) hey, I found this. Looks like that flexgrid does not expose itself to COM for automation. however, check this Send("^c") Sleep(250) Local $Value = ClipGet() MsgBox(0,"Value",$Value) see if that gets you the values from each row. then, when the values are null or not changing then you know you are at the bottom Edited January 9, 2018 by Earthshine My resources are limited. You must ask the right questions
idontknow989 Posted January 9, 2018 Author Posted January 9, 2018 I will take a look at this when I get back to my office.
idontknow989 Posted January 10, 2018 Author Posted January 10, 2018 I might be missing something but when I put that code in my script all it gives me is a text box with "("^c")" in it.
Earthshine Posted January 10, 2018 Posted January 10, 2018 That is supposed to Copy to clipboard. My resources are limited. You must ask the right questions
idontknow989 Posted January 10, 2018 Author Posted January 10, 2018 There is a part I forgot to mention that happens when all the patients are cleared out for a letter; there is some text that says "(no matching records). I tried using this bit of code: If ControlGetText ("[CLASS:MSFlexGridWndClass; INSTANCE:1]", "", "(no matching records)") Then ExitLoop EndIf to check if that text pops up to end the script but ControlGetText is not finding that specific string. I am including a picture of the window and the window info to see if I am possibly overlooking something.
Earthshine Posted January 10, 2018 Posted January 10, 2018 (edited) yes. because the VB6 FlexGrid from MS is not built to allow automation. You are relegated to keystrokes and mouse clicks If you manually click on the description box you have highlighted and press keys Ctrl-C can you then Ctrl-V to notepad with that text? if so, it's in the clipboard and we need to figure out how to get to it. that's where to insert that code snippet to see if it works. use the <> code tags to insert your program so it is readable please. like expandcollapse popup#include <AutoItConstants.au3> #include <MsgBoxConstants.au3> ;Press Esc to terminate script, Pause/Break to "pause" Global $g_bPaused = False HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") HotKeySet("+!d", "ShowMessage") ; Shift-Alt-d While 1 ;This script works with Allscripts PM in fullscreen on a 1920x1080 monitor WinActivate ('Allscripts PM') ;Clicks the patient search button in Registration Sleep (2000) MouseClick ('Primary', 503, 200, 1, 0) ;Selects patient from list Send ('a') MouseClick ('Primary', 1050, 599, 1, 0) Send ('{ENTER}{ENTER}{DOWN}{ENTER}') Sleep (2000) ;If a error window pops up will close that window MouseClick ('Primary', 1177, 685, 1, 0) Sleep (2000) ;Clicks the policy tab MouseClick ('Primary', 490, 100, 1, 0) ;Clicks the Exp Date box MouseClick ('Primary', 528, 441, 1, 0) Send ('01/01/2020') ;Enters in Cert No. MouseClick ('Primary', 385, 252, 1, 0) MouseClick ('Primary', 362, 533, 1, 0) Send ('1234') MouseClick ('Primary', 388, 268, 1, 0) MouseClick ('Primary', 362, 533, 1, 0) Send ('1234') ;Clicks the account tab MouseClick ('Primary', 412, 104, 1, 0) ;Changes contact birthdate for multiple contacts Sleep (2000) MouseClick ('Primary', 703, 476, 1, 0) Send ('01/01/1970') ;Changes contacts gender MouseClick ('Primary', 801, 455, 1, 0) MouseClick ('Primary', 802, 484, 1, 0) Sleep (2000) MouseClick ('Primary', 402, 311, 1, 0) Sleep (2000) MouseClick ('Primary', 703, 476, 1, 0) Sleep (2000) Send ('01/01/1970') ;Changes contacts gender MouseClick ('Primary', 801, 455, 1, 0) MouseClick ('Primary', 802, 484, 1, 0) Sleep (2000) ;Clicks ok if a message box pops up MouseClick ('Primary', 1033, 610, 1, 0) Sleep (2000) ;Clicks the patient tab MouseClick ('Primary', 343, 105, 1, 0) ;Clicks the home phone box MouseClick ('Primary', 714, 261, 1) Sleep (2000) Send ('8102300338') ;Clicks the last name box Sleep (2000) MouseClick ('Primary', 341, 285, 1) ;Replaces all the patient information Sleep (2000) Send ('x x') Send ('{TAB}') Send ('x') Send ('{TAB}') Send ('x') Send ('{TAB}') Send ('x') Send ('{TAB}') Sleep (2000) Send ('x') ;If a change address window pops up MouseClick ('Primary', 989, 616, 1) Send ('{TAB}') Send ('x') Sleep (2000) ;Clicks the city box MouseClick ('Primary', 342, 381, 1) Sleep (2000) Send ('Flint') Send ('{TAB}') Send ('{TAB}') Send ('48507') Send ('{Enter}') Send ('{Down}') Send ('{Down}') Send ('{Enter}') MouseClick ('Primary', 1047, 606, 1) Sleep (2000) ;Clicks the social security button MouseClick ('Primary', 576, 256, 1, 0) Send ('{BACKSPACE}') Send ('{BACKSPACE}') Send ('{BACKSPACE}') Send ('{BACKSPACE}') Send ('{BACKSPACE}') Send ('{BACKSPACE}') Send ('{BACKSPACE}') Send ('{BACKSPACE}') Send ('{BACKSPACE}') Send ('{BACKSPACE}') Send ('{BACKSPACE}') Send ('123456789') Sleep (2000) Send ('{ENTER}') ;Clicks the save button MouseClick ('Primary', 1813, 1010, 1, 0) ;Clicks the Summary tab MouseClick ('Primary', 269, 104, 1, 0) Sleep (2000) WEnd 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 Edited January 10, 2018 by Earthshine My resources are limited. You must ask the right questions
idontknow989 Posted January 10, 2018 Author Posted January 10, 2018 When the patients are listed after searching by a letter they are not select able with Ctrl-C only with the down, up and enter keys.
Earthshine Posted January 10, 2018 Posted January 10, 2018 (edited) If I were you, I would look into OCR autoit scripts so it can recognize the text when it happens. Edited January 10, 2018 by Earthshine My resources are limited. You must ask the right questions
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now