Jump to content

Recommended Posts

Posted

I have little to no scripting experience but I am updating some company scripts because they do not work very well. The current script we have opens a program and navigates through it until a section appears showing necessary information. The issue is that the script, more often then not, keeps failing because the program that the script is keying into is slow and this causes parts of the script to run too soon which stops all progress. I would like to have the script restart if it doesn't reach the final stage, and the final stage is easily identifiable because it has a different title. The issue I am having is the title isnt being recognized. Below is an example of what ive tried to start with.

I used the AutoIT tool to confirm the exact Title of a window.

 image.png.da7ab12afd7df6fc04dd4219622bb25c.png

I then used that title in a test script and the title isnt detected. Here is the script:

If WinExists("EDM.COCCC (VARIRIS/VAA.LIVE.MIS/117/COCCC) - ED TRACKER ID") Then
    MsgBox(0, "", "Window exists")
 Else
    MsgBox(0, "", "Window doesnt exist")
EndIf

I tried the same script, with a different title of course, with notepad and it worked fine.

I believe if i can just find a way to have the script detect this specific stage/window of the program, then i can have it start over again until it completes successfully which will rule out us having to manually start the script 15 times until it runs perfectly.

 

Posted
  On 9/28/2020 at 7:34 PM, mikell said:

If it is a timing issue only you might try something like this (concept)

WinWait("EDM.COCCC (VARIRIS/VAA.LIVE.MIS/117/COCCC) - ED TRACKER ID", "", 10) ; timeout 10 sec

 

Expand  

Originally, each section of the script was set with WinWait, but neither WinWait or any other function will detect the title or text as specified. We now have the script set with Sleep in between each command, but this still is not ideal. Not only is the application in question slow sometimes, it is just old and faulty and this causes issues for the script. Ideally, the script should repeat until the correct section is reached.

I know that WinWait was used in most of the scripts when we were using Windows 7, so maybe it just stopped working when we went to Win 10. That could be why some of our scripts use Sleep.

Posted

The end goal is to do something like this, (Not a finished product): 

Do
   Send("{F11}{F11}{F11}{F11}") ; Exits previous meditech fully
   Sleep (10000)
   Run('C:\Program Files (x86)\MEDITECH\Workstation4.x\T.exe')
   WinWait("Magic Workstation","",10)
   If Not WinActive ("Magic Workstation","") Then WinActivate ("Magic Workstation","")
   Send("{ENTER}")
   WinWait("(VARIRIM/VAA.LIVE.MIS)","",5)
   Send("{ENTER}")
   WinWait("Network Authentication","",5)
   Send("{ENTER}")
   WinWait("Sign On","",5)
   Send("USERNAME{ENTER}PASSWORD{ENTER}")
   WinWait("Message", "",5)
   Send("{ENTER}")
   WinWait("Select Public Tracker", "",5)
   Send("JPUB.PT3{ENTER}")
   Sleep (5000)
Until WinExists("EDM.COCCC (VARIRIS/VAA.LIVE.MIS/117/COCCC) - ED TRACKER ID")
 

This wont fully work until I can find a way to make WinExist actually detect the window title.

Posted

Did you make sure to get the exact title from the AutoIt Info window. You can get it by right-clicking on the desired field and clicking Copy . You could also try to detect only a part of the title like "EDM.COCCC" if it doesn't conflict with another window (see WinTitleMarchMode for more information). 

Posted
  On 9/29/2020 at 1:21 AM, boom221 said:

Did you make sure to get the exact title from the AutoIt Info window. You can get it by right-clicking on the desired field and clicking Copy . You could also try to detect only a part of the title like "EDM.COCCC" if it doesn't conflict with another window (see WinTitleMarchMode for more information). 

Expand  

That works! I tried going that route yesterday but couldn't quite figure out how. I tried again and it works! 

Its still strange that copy and pasting the title didn't work, but oh well. I can make this work, thanks!

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...