Jump to content

[Near Totally Solved] Help with Until function


Recommended Posts

Hi I try to automate and monitor my ghost sessions.

I created a gui with progress bar and time remaining which work ok except that I can't exit a Do loop.

I want to exit the loop when the selected pc are installed. but the installed pc are not always the same and not always used.

I mean on 10 pc sometimes I'll install 10 pc, sometime only pc 2 and 5 etc...

String $Rooms is here for the sample, but in reality it's updated in another way.

so this is my code:

$Rooms = "101,"
$Rooms = Rooms & "102"
$Split = StringSplit ($Rooms,",")
$Last = $Split[0]


while $Last > 1
$All = $All & "$Progress_" & $Split[$Last] & " = 100 And "
$Last = $Last - 1
WEnd

$All = $All & "$Progress_" & $Split[1] & " = 100 "
ConsoleWrite($All)

Do
if WinExists("S101 - Symantec GhostCast Server") Then
$Progress_101 = ControlGetText("S101 - Symantec GhostCast Server","", "Edit10")
$101_Remains = ControlGetText("S101 - Symantec GhostCast Server","", "Edit14")
GUICtrlSetData($Progress_bar_101, $Progress_101)
GUICtrlSetData($101_Remains_Lab, $101_Remains)
EndIf

if WinExists("S102 - Symantec GhostCast Server") Then
$Progress_102 = ControlGetText("S102 - Symantec GhostCast Server","", "Edit10")
$102_Remains = ControlGetText("S102 - Symantec GhostCast Server","", "Edit14")
GUICtrlSetData($Progress_bar_102, $Progress_102)
GUICtrlSetData($102_Remains_Lab, $102_Remains)
EndIf

Sleep(1000)

Until $All

Like this I can't the progress if the installation on my PCs, it's like the loop is exited at startup.

but like this it works :

Do
if WinExists("S101 - Symantec GhostCast Server") Then
$Progress_101 = ControlGetText("S101 - Symantec GhostCast Server","", "Edit10")
$101_Remains = ControlGetText("S101 - Symantec GhostCast Server","", "Edit14")
GUICtrlSetData($Progress_bar_101, $Progress_101)
GUICtrlSetData($101_Remains_Lab, $101_Remains)
EndIf

if WinExists("S102 - Symantec GhostCast Server") Then
$Progress_102 = ControlGetText("S102 - Symantec GhostCast Server","", "Edit10")
$102_Remains = ControlGetText("S102 - Symantec GhostCast Server","", "Edit14")
GUICtrlSetData($Progress_bar_102, $Progress_102)
GUICtrlSetData($102_Remains_Lab, $102_Remains)
EndIf

Sleep(1000)

Until $Progress_102 = 100 and $Progress_101 = 100

what it's strange it's that in the first code $All give :

$Progress_102 = 100 and $Progress_101 = 100
in consolewrite

So I supposed that the syntax is ok.

My problem as I already told is that I won't install always the same PCs, and not always all PCs, so I can't monitor progress on all PCs because this way I'll nearly never leave the loop.

Many thx for your future help.

Processor.

Edited by Processor
Link to comment
Share on other sites

while $Last > 1

$All = $All & "$Progress_" & $Split[$Last] & " = 100 And "

Right now $All has content so in the scope of a do until loop is equal to true or 1

So your do loop will exit after first iteration.

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

Hi John thx for replying,

Sorry I don't understand your answer

;Value for Rooms
$Rooms = "101,"
$Rooms = Rooms & "102"
;Split String Rooms with ","
$Split = StringSplit ($Rooms,",")
; Get the number of parts in the $Split
$Last = $Split[0]


; While $Last is more than one update $All
while $Last > 1
$All = $All & "$Progress_" & $Split[$Last] & " = 100 And "
$Last = $Last - 1
WEnd

;Update $All for the last time
$All = $All & "$Progress_" & $Split[1] & " = 100 "

$All = "$Progress_102 = 100 And $Progress_101 = 100" that's it?

"Right now $All has content so in the scope of a do until loop is equal to true or 1"

What does this mean?
Link to comment
Share on other sites

See this code...

while $Last > 1
$All = $All & "$Progress_" & $Split[$Last] & " = 100 And "
$Last = $Last - 1
WEnd

Well the variable $All has in it a string, so when you test in in your Do Until loop, it equates to 1, or true, so as soon as the first test on it is made, your Do Until Loop will exit.

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

I don't really know what your code is supposed to do or what you are working with but something like this.

$Rooms = "101,"
$Rooms = Rooms & "102"
$Split = StringSplit($Rooms, ",")
$Last = $Split[0]
Local $All = 0


While $Last > 1
    ;$All = $All & "$Progress_" & $Split[$Last] & " = 100 And "
    $Last = $Last - 1
WEnd

;$All = $All & "$Progress_" & $Split[1] & " = 100 "
ConsoleWrite($All)

Do
    If WinExists("S101 - Symantec GhostCast Server") Then
        $Progress_101 = ControlGetText("S101 - Symantec GhostCast Server", "", "Edit10")
        $101_Remains = ControlGetText("S101 - Symantec GhostCast Server", "", "Edit14")
        GUICtrlSetData($Progress_bar_101, $Progress_101)
        GUICtrlSetData($101_Remains_Lab, $101_Remains)
    EndIf

    If WinExists("S102 - Symantec GhostCast Server") Then
        $Progress_102 = ControlGetText("S102 - Symantec GhostCast Server", "", "Edit10")
        $102_Remains = ControlGetText("S102 - Symantec GhostCast Server", "", "Edit14")
        GUICtrlSetData($Progress_bar_102, $Progress_102)
        GUICtrlSetData($102_Remains_Lab, $102_Remains)
    EndIf
    
    $All = Int($Progress_101) + Int($Progress_102)

    Sleep(1000)

Until $All = 203

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

Done!!!

I choose another way

if $Room_101_Select = 1 then
$Rooms = $Rooms + 1
$Run_101 = 1
endif


if $Room_102_Select = 1 then
$Rooms = $Rooms + 1
$Run_102 = 1
endif


Do
If $Run_101 = 1 Then
if WinExists("S101 - Symantec GhostCast Server") Then
$Progress_101 = ControlGetText("S101 - Symantec GhostCast Server","", "Edit10")
$101_Remains = ControlGetText("S101 - Symantec GhostCast Server","", "Edit14")
GUICtrlSetData($Progress_bar_101, $Progress_101)
GUICtrlSetData($101_Remains_Lab, $101_Remains)

if $Progress_101 = 100 Then
$Rooms = $Rooms - 1
$Run_101 = $Run_101 - 1
EndIf

EndIf

EndIf

If $Run_102 = 1 Then
if WinExists("S102 - Symantec GhostCast Server") Then
$Progress_102 = ControlGetText("S102 - Symantec GhostCast Server","", "Edit10")
$102_Remains = ControlGetText("S102 - Symantec GhostCast Server","", "Edit14")
GUICtrlSetData($Progress_bar_102, $Progress_102)
GUICtrlSetData($102_Remains_Lab, $102_Remains)

if $Progress_102 = 100 Then
$Rooms = $Rooms - 1
$Run_102 = $Run_102 - 1
EndIf

EndIf

EndIf


if $msg = $Finish Then ExitLoop
Sleep(1000)

Until $Rooms = 0

Now I'm searching a way to leave the loop if need because this in the loop does not work:

if $msg = $Finish Then ExitLoop
Edited by Processor
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...