Jump to content

Validate steps in non standard applications


 Share

Recommended Posts

Hi All,

Just recently started to explore AutoIt features, and I started to develop some scripts. After running some of them I face with the following problem: after clicking, for example on custom client application or in browser applet, I can't validate the step. I mean was it successful or not, when I click or hit enter next I am in the appropriate window or not? In other tools we can save a part of the screen than we can compare with the "recorded" hash.

These windows not standard windows, so I can't use the Window Info tool neither the built in functions.

Do you have any idea? How do you test non standard applications?

Link to comment
Share on other sites

  • Moderators

joco5582,

Welcome to the AutoIt forum. :D

In other tools we can save a part of the screen than we can compare with the "recorded" hash

You can also do this in Autoit with PixelCheckSum. :oops:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

HI Melba,

Thanks for this tipp, however I couldn't make it work. This function generate different checksum value by time, so I can't use to validate current window. Here is my simple code:

#Recorded checksum for the screen position

#422, 453, 500, 471

#1333829387

#Check out Current checksum with the recorded value

Sleep(3000)

#Wait for syncronization custom command would be instead of Sleep

$checksum = PixelChecksum(422, 453, 500, 471)

ConsoleWrite($checksum & @CRLF)

if ($checksum<>1333829387) Then

ConsoleWrite("Ni Search link not available")

Exit

endIf

Finally for me thats not enought to make sure something has changed, but I would like to compare "recorded - tested screen part with the current-"not sure" part the same or not.

Am I miss something?

Could you recommend to do something different?

Thanks,

Jozsef

Link to comment
Share on other sites

  • Moderators

joco5582,

I would do it something like this: ;)

; Get a checksum when the area is in its original state
$iOriginal_Checksum = PixelChecksum(422, 453, 500, 471)

; Start an infinite loop
While 1
    ; Now get the current checksum of the area
    $iNew_Checksum = PixelChecksum(422, 453, 500, 471)
    If $iNew_Checksum <> $iOriginal_Checksum Then
        ; The area has changed
        ExitLoop
    EndIf
    
    Sleep(10) ; Important to keep the CPU unloaded
    
WEnd

; When we get here the area has changed
ConsoleWrite("The area has changed in some way" & @CRLF)

If you have several possibilites than you could get a checksum for each and then do a comparison in the loop like this:

; First we get checksums of the various states
; This would need to be done beforehand - I would use a HotKey to trigger the function when the app was in the correct state
$iOriginal_Checksum_#n = PixelChecksum(422, 453, 500, 471)


; Now when we are testing

; Start an infinite loop
While 1
    ; Now get the current checksum of the area
    $iNew_Checksum = PixelChecksum(422, 453, 500, 471)
    Switch $iNew_Checksum
        Case $iOriginal_Checksum_1
            ; We have found this state so do something
        Case $iOriginal_Checksum_2
            ; We have found this state so do something else
        Case.....
    EndSwitch
    
    Sleep(10) ; Important to keep the CPU unloaded
    
WEnd

Any help? Please ask if you have any questions. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

I would double check that no Autoit3 functions can detect the window. I have seen a lot of cases of

some functions having problems with non standard controls, but don't recall an example of them

not even detecting a gui.

I think this might be important so you can use PixelCoordMode Option 0, to keep the areas

or controls of the gui relative to their parent window.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

  • Moderators

joco5582,

You originally stated:

In other tools we can save a part of the screen than we can compare with the "recorded" hash

and this is the AutoIt equivalent of that. You fill the array in advance with checksums of the possible occurences and then compare the current checksum to those stored in the array. ;)

The only difference is by time what entry will be in the first index?

Your OP spoke of "after clicking" and "when I click or hit enter" - where does this "only difference is by time" bit come in? :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

Hi All,

Thanks the help, but I really think to give up. Today I tried to play with AutoIt, but its worse and worse. Lets say not really worth to invest lot energy to it.

I know this is my fault.

Anyway as a last chance, here is the code:

$checksum = PixelChecksum(466, 378, 538, 456)
$maxSize=UBound($checksum)
ConsoleWrite($maxSize & @CRLF)
For $i = 0 to $maxSize-1 Step +1
ConsoleWrite($i & ". item:  " & $checksum[$i] & @CRLF)
Next

And here is the output:

>"C:Program FilesAutoIt3SciTE..autoit3.exe" /ErrorStdOut "C:Documents and SettingsRendszergazdaAsztalMy first Auto IT scriptCheckSumTry.au3"   
0
>Exit code: 0    Time: 55.825

Can someone explain why is the PixelChecksum results 0. According to the documentation its Failure. What kind of failure happens?

Thanks

Edited by joco5582
Link to comment
Share on other sites

  • Moderators

joco5582,

According to the documentation its Failure. What kind of failure happens?

The failure is in the chair-keyboard interface. :)

If you read the documentation you will also see that PixelChecksum returns a number, not an array. So you are asking UBound to size a non-existent array - and it returns 0 as an error. You assign $maxsize to that value - which is what you see on the screen.

Today I tried to play with AutoIt, but its worse and worse. Lets say not really worth to invest lot energy to it. I know this is my fault.

I think you are giving up far too easily. You have a wealth of experience here - why not try and explain more fully what you are trying to do with a couple of screenshots to show what you are expecting to detect? Many of us have done this sort of thing and can offer advice and code. At the moment all we get from you is small snippets of code which are so flawed as to be virtually useless as an indication of what you are trying to do.

Anyway it is up to you: Start afresh in a new topic with full details and some screenshots...or drop the whole thing. Your choice. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

Hi Melba,

Just review my script and I saw the same, just couldn't delete my post.

Back to my problem. Let suppose I could create script which perform actions on the desktop. I don't want to sit and watch weather its working or not, but I would like to check every steps was it success or not in code.

In this case if some unplanned window came up, the script can exit with error messages.

I used other tools, where we can select a part of the screen, we store it, than during the replay the script could compare the original value with the new one. If they equal, we are good. I mean the script perform the actions in the good window, etc.

For example:

$checksum = PixelChecksum(466, 378, 538, 456)

#846785739,1894293307

At first 846785739 generated, few minutes later 1894293307 they are obviously not equal, however I generated from the same rectangle.

What I am really lost if I use PixelCheckSum, I get every time different value, which I couldn't compare to anything. Its very good to check something has changed in the window or not, but for me its almost nothing, because the change can be expected or not.

Do you understand what I mean?

Anyway thanks your patience

Edited by joco5582
Link to comment
Share on other sites

  • Moderators

joco5582,

we can select a part of the screen, we store it, than during the replay the script could compare the original value with the new one.

And as I have explained above, that is exactly what PixelChecksum is designed to do. I have successfully used the function in several applications to detect things like: new entries in a list, changes to the app state as an area changes colour (think vitual LEDs on the screen), so I am having problems seeing what your difficulty is using it in a similar fashion.

How about doing what I suggested above - post a couple of screenshots (before and after) so we can see more clearly what it is you are trying to do. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

  • Moderators

joco5582,

Not a lot of help I am afraid. I do not understand what you are doing in the video. :)

Where is the browser page you are checksumming - it needs to be visible? Why are you selecting part of the code? What are the lines beginning with # supposed to be? :)

So let us try something else. :D

I ran the code below on a Google search page. I set the PixelCoordMode to 2 - then I can use coordinates relative to the client area of my browser GUI. The actual coordinates are those I got from the Window Info tool for the "G" of Google - after setting <Options - Coord Mode> to "Client".

You can see that the code takes an initial checksum of the area and then asks you to move the browser GUI somewhere else on screen. Once you clear the MsgBox it takes another checksum - for me the 2 are always the same regardless of where I put the browser onscreen:

11:08:31 - 3204881965
11:08:40 - 3204881965

Please run this script (suitably adjusting the coordinates for your browser) and see if it works: ;)

; Set client area mode
Opt("PixelCoordMode", 2)

; Activate the browser GUI
WinActivate("[CLASS:IEFrame]")
WinWaitActive("[CLASS:IEFrame]")

; Take the checksum
$iChkSum = PixelCheckSum(40, 100, 80, 150)
ConsoleWrite(@HOUR & ":" & @MIN & ":" & @SEC & " - " & $iChkSum & @CRLF)

; Activate the SciTE GUI
WinActivate("[CLASS:SciTEWindow]")
WinWaitActive("[CLASS:SciTEWindow]")

; Here you can move the browser GUI
MsgBox(0, "", "Now move your IE window" & @CRLF & "Close this when you have done so")

; We reactivate it
WinActivate("[CLASS:IEFrame]")
WinWaitActive("[CLASS:IEFrame]")

; And take another checksum
$iChkSum = PixelCheckSum(40, 100, 80, 150)
ConsoleWrite(@HOUR & ":" & @MIN & ":" & @SEC & " - " & $iChkSum & @CRLF)

What do you get? ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

Hi ,

I have really bad luck but, for me the checksum is different. Could you try me something?

If you generate checksum, no matter where in your desktop. Than close everything included the editor itself and generate again. Do you get the same value. Because me this is different as well.

Edited by joco5582
Link to comment
Share on other sites

  • Moderators

joco5582,

You ran my script with an open browser window and got different results without the content changing. I find that hard to believe as PixelChecksum has worked correctly for many people (including me) for many years. :)

As to your suggestion, I have no need to run it to know what will happen. Of course it will be different - the first checksum will probably include part of an open GUI while the second will be just the desktop. All PixelChecksum does is look at an area of the screen - if you change that area of the screen in some way you get a different result. Why would I therefore be surprised to get a different value if I close all the GUIs. ;)

I ask again (and for the last time): post a couple of screenshots showing the before and after states of the GUI you are trying to check so we can see what the difference is. :)

M23

Edit: Removed the garbage the editor added on its own! :D

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

Hi M,

I am sure this is PEBKAC problem, but what if we schedule an online screen sharing via joinme? You can see what I am and you can control my machine as well.

Anyway I attached the pictures:

Posted Image

Start browser:

Posted Image

Next:

Posted Image

Than select browser and resize it as it was full screen:

Posted Image

Then:

Posted Image

Click ok:

Posted Image

Finally all I can say I am too lame :)

Link to comment
Share on other sites

Hi again, I think it was really pebkac problem. After repeating the steps, with previously started explorer I got the same. And it seems if I close script editor and start it again it generate the same checksum as well. The difference beetween my scripts and your script is, you set client area mode, in this case the coordinates are "relative coords to the client area of the defined window". As I run Win Xp in virtual PC windows, the screen resolution can be affected somehow. I think I accidentally resized VPC window.

Edited by joco5582
Link to comment
Share on other sites

  • Moderators

joco5582,

The difference beetween my scripts and your script is, you set client area mode

If you want to get a PixelChecksum of a particular area within a GUI that is what you need to do. ;)

Do I understand you are now able to get the same checksum twice? If so, do you now understand what I was proposing as a strategy for checking your app somewhere a long time ago in the thread? :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

  • Moderators

joco5582,

My pleasure - and happy holidays to you too. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
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
 Share

  • Recently Browsing   0 members

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