Sign in to follow this  
Followers 0
B540glenn

Help With Detecting When Window Changes - Info the same

11 posts in this topic

#1 ·  Posted (edited)

We have an account management system.  I have to change about 20,000 accounts from History to Active.

I have a process that works for a small number of records, 50 records or less.

The current process is:

...
While $readstat = 0
    $Account = $line_text
    MouseClick("Left",60,480,1,0)
    Send($Account)
    Send("{ENTER}")
    Sleep($SleepM)

; Check for Error Message on Account
    $x = WinExists("Retrieve Error")
    If $x Then
;ConsoleWrite("there was a retreive Error - " & $Account & @lf)
        $writestat = FileWriteLine($File2Handle, "Account Err|" & $line_text & @CRLF)
        if $writestat <> 1 then
            MsgBox(0, "Error", "Unable to write to output file. " & $file2 & $File2Handle & $writestat)
           EndIf
        Send("{ENTER}")
        Sleep($SleepL)
        MouseClick("Left",60,480,1,0)
    Else
;ConsoleWrite("going to the Update - " & $Account & @lf)
        Send("{ENTER}")
        Sleep($SleepL)
;ConsoleWrite("sending B - " & $Account & @lf)
        Send("B")
        Sleep($SleepS)
        $x = WinExists("Visit Maintenance")
        If $x Then
;ConsoleWrite("Visit maint exists pressing Y - " & $Account & @lf)
            Send("Y")
            Sleep($SleepS)
        Endif
    EndIf
    Sleep($SleepS)
    $line_text = FileReadLine($File1Handle)
    $readstat = @error
WEnd
...

I am using Sleep() to wait for the screen to change from Inquiry to Maintenance then back to Inquiry. With all the sleep statements it may take 6 to 8 seconds per account, depending on the system response time. For a small set of records this is fine.  For my 20,000 accounts it's unacceptable.

I'd like to change the way I wait for the screen to change and eliminate the Sleep() statements.  I used the window info tool to get the info for the Inquiry and Maintenance screens.  The results are identical:

Title:    Account Management    Current User: GLENN     - \\Remote
Class:    Transparent Windows Client
Position:    -4, -4
Size:    1288, 968
Style:    0x960F0000
ExStyle:    0x00000104
Handle:    0x0014043C

There is no data for Controls, StatusBar, ToolsBar, Visible Text nor Hidden Text.  The colors are also identical.

I've downloaded and tried a few scripts that show all current handles but there is no change in the lists when the Inquiry or Maintenance screens are active.

How can I determine when the screen changes to and from Inquiry to Maintenance?

Thanks for any help,

Glenn

Edited by B540glenn

Share this post


Link to post
Share on other sites



B540glenn,

Something must change between the Inquiry or Maintenance screens - how do you know which is active? :huh:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

B540glenn,

Something must change between the Inquiry or Maintenance screens - how do you know which is active? :huh:

M23

 

Of course, the fields change on the screen.  I can see that, but the Window Info tool doesn't.  The Window Info tool displays the same title, class, handle, etc. in both the Inquiry and Maintenance screens.  It reports no info for controls.  It reports no text. 

What can I inspect via the autoit functions to detect the change?

 

Share this post


Link to post
Share on other sites

B540glenn,

 

Of course, the fields change on the screen

So you should be able to use PixelChecksum to detect the window changing. :)

If you could post a couple of screenshots we could easily see which section of the GUI you should look at. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

WinWait

WinActive

WinActivate

WinWaitActive

 

Wait for what?  I'm not leaving the application so isn't  $Title always active?  If I'm in the Inquiry screen $Title is active.  If I'm in Maintenance, $Title is active.

Sorry if I'm not catching on.

Glenn

Share this post


Link to post
Share on other sites

B540glenn,

 

So you should be able to use PixelChecksum to detect the window changing. :)

If you could post a couple of screenshots we could easily see which section of the GUI you should look at. ;)

M23

 

Yes, of course, the colours for parts of the screens change. 

Thanks for the subtle "shove" in the right direction. 

I appreciate your help.

Thank you,

Glenn

Share this post


Link to post
Share on other sites

B540glenn,

the colours for parts of the screens change

Then PixelGetColor is probbaly all you need. ;)

Come back if you run into any problems. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

...Then PixelGetColor is probbaly all you need. ;)...

PixelGetColor did the trick. Now there is no sleep time waiting for the screen changes.

This change will possibly save 20% off the run time.

Thanks again,

Glenn

Share this post


Link to post
Share on other sites

Just to go the silly route...and I am curious.

I would assume you don't have the Windows Info Tool set to freeze thus giving you the same information for both instances.

Glad you found a solution!


[u]Forum Rules[/u]

Follow the rules or be b*t**slapped into next week.

Share this post


Link to post
Share on other sites

B540glenn,

Glad to hear you got it sorted. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0