Jump to content

Winwaitactive including $var


Recommended Posts

Hey =)

I have a window which contains the text:

"# Drivers, # Software, # Windows Updates".

The amount can be 0 or higher 0.

I want the window to get closed in case it is 0 for every value. Otherwise I want want my script to continue.

Case 1 ( Values = 0) is easy and works fine:

If WinWaitActive ("Program", "0 Drivers, 0 Software, 0 Windows Updates", 0) Then
WinClose ("DeskUpdate", "")
Exit
EndIf

Case 2 didn't work the way I tried it:

$var = <> 0 ;or $var <> 0
If WinWaitActive ("Program", $var $ " Drivers, 0 Software, 0 Windows Updates", 0)
Send("{TAB}")
Send("{TAB}")
Send("{ENTER}")

I guess the best way would be to distinguish between Case 1 and "not Case 1" but I don't know how to do that,

If my example would work I'd have to have 6 different Cases since the values can be 100, 010, 001, 110, 011, 111.

It would suffice though.

Thanks in advance =)

 

Link to comment
Share on other sites

  • Moderators

Eggsplorer,

Welcome to the AutoIt forum. :)

You will need to read and examine the text - I do not believe you are going to be able to use the "text" parameter to do it. ;)

Try using the AutoIt Window Info tool and see if you can get the required text in the "Visible/Hidden Text" tabs. If so then we can extract it and look at the values before determining what to do next. You find the tool at "...AutoIt3Au3Info.exe". Please post the contents of those tabs - see here how to do it. :)

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 lready used the AutoIt Windows Info tool and compared both windows. They are identical except for the values I mentioned.

Case 1: My update program found no updates and I want it to get closed:

Tab: "Visible Text"

[...]
Ergebnis Systemüberprüfung: 0 Treiber, 0 Software, 0 Windows Update(s), 0 BIOS Update(s) (Überprüfungszeit: 7 Sekunden)
[...]

Case 2: My update program found updates and I want my script to continue:
Tab: "Visible Text"

[...]
Ergebnis Systemüberprüfung: 3 Treiber, 0 Software, 9 Windows Update(s), 1 BIOS Update(s) (Überprüfungszeit: 4 Sekunden)
[...]

The rest of The "Visible Text"-tabs is identical. The tabs "Hidden Text" are completely identical.

Edited by Eggsplorer
Link to comment
Share on other sites

  • Moderators

Eggsplorer,

Excellent news. Now I suggest you use WinGetText to extract that text into a variable and then do this:

#include <Array.au3> ; Just for display

$sText = "Ergebnis Systemüberprüfung: 0 Treiber, 0 Software, 0 Windows Update(s), 0 BIOS Update(s) (Überprüfungszeit: 7 Sekunden)"

$aRet = StringRegExp($sText, "\s(\d+)\s", 3)

_ArrayDisplay($aRet) ; Just for display

; You may have to adjust these indices if there are more values than shown in your example
If $aRet[1] + $aRet[2] + $aRet[3] = 0 Then 
    ConsoleWrite("All zero" & @CRLF)
Else
    ConsoleWrite("Something" & @CRLF)
EndIf
Do come back if you run into problems. :)

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

Eggsplorer,

Glad I could help. :)

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...