RobertH Posted February 1, 2010 Share Posted February 1, 2010 Can someone tell me what I am doing wrong? I need help understanding why the "ReStart" progress bar only displays the first time it is run and not any other time (lines 79-91). It used to run perfectly until I decided to get fancy and put in the countdown. expandcollapse popup; Launch Citrix Application and wait for it to timeout after 8 hours then relaunch it repeat process three times then reboot computer. ; AutoIt Version: 3.0 ; Language: English ; Set the Username and Password to variables $MilleUsername = "username" $MillePassword = "password" ;Citrix Application Variables: $ProgramFiles = @ProgramFilesDir $PNAgent = "\Citrix\ICA Client\pnagent.exe" $QLaunchSwitch = "/QLaunch" $QLaunchArgument = "BH45D:Emergency Room Monitor" ;Published Application Name $QuoteCharacter = Chr(34) ;Progress bar time variables: $InitialProgressBarTimeOut = 10 ;Seconds $RestartProgressBarTimeOut = 5 ;Seconds $InitialProgressBarStep = (100 / $InitialProgressBarTimeOut) $SecondProgressBarStep = (100 / $RestartProgressBarTimeOut) $CountDown1 = $InitialProgressBarTimeOut $CountDown2 = $RestartProgressBarTimeOut ; Establish the counter and Set number of times to loop $count = 0 $loop_length = 3 ;Loop three times to restart the timed out Citrix Application then reboot computer. While $Countdown1 > 0 ProgressOn("", "ER Monitor Starting in " & $InitialProgressBarTimeOut & " Seconds", "") For $i = 1 to 100 step $InitialProgressBarStep ProgressSet( $i, "Please Wait!", " ER Monitor Starting in " & $Countdown1 & " Seconds") sleep(1000) $Countdown1 = $Countdown1 - 1 Next WEnd ProgressSet(100 , "Done", "Complete") sleep(500) ProgressOff() ;Execute the loop "While" the $count is less than zero While $count < $loop_length ; Increase the count by one $count = $count + 1 ;Launch Citrix from the program files folder. : Run($ProgramFiles & $PNAgent & " " & $QLaunchSwitch & " " & $QuoteCharacter & $QLaunchArgument & $QuoteCharacter) ;MsgBox(8192, "Citrix path:", $ProgramFiles & $PNAgent & " " & $QLaunchSwitch & " " & $QuoteCharacter & $QLaunchArgument & $QuoteCharacter) If @error Then ; A message box that lets the user know the script failed when launching the application and Exit Script. MsgBox(16, "AutoIt ER Monitor Script", "Failed when launching ER Monitor application. Script Closed") Exit EndIf ; Wait for the Log On to become active WinWaitActive("ER Logon - \\Remote") ; Log On with Username and Password set above Send( $MilleUsername & @TAB & $MillePassword & @TAB & @CR ) ; Wait for the ER Application and Available Provider window to become active WinWaitActive("ER Monitorview, Emergency", "", 1) ;Wait 5 Seconds for Application to fully load Sleep(5000) ;Press the ALT key on the keyboard and then choose List which is the second (L) on menubar and Show Board which is the second (S) in the dropdown menu. Send( "{ALT}" & "L" & "L" ) Sleep(2000) Send("{ENTER}") Send( "S" & "S" ) Sleep(1000) Send("{ENTER}") ;Wait until the ER Monitor is closed WinWaitClose("ER Monitorview, Emergency") ; If the loop is going to continue then wait If $count < $loop_length Then While $Countdown2 > 0 ProgressOn("", "ER Monitor Restarting in " & $RestartProgressBarTimeOut & " Seconds", "") For $i = 1 to 100 step $SecondProgressBarStep ProgressSet( $i, "Please Wait!", "ER Monitor Restarting in " & $Countdown2 & " Seconds") sleep(1000) $Countdown2 = $Countdown2 - 1 Next WEnd ProgressSet(100 , "Done", "Complete") sleep(500) ProgressOff() EndIf Wend ; End While ;Force a reboot Shutdown(6) ;Finished Exit Link to comment Share on other sites More sharing options...
kaotkbliss Posted February 1, 2010 Share Posted February 1, 2010 I would say try adding in a line between the wend and endif to reset the $CountDown2 variable. My assumption is that because it is global, once it reaches 0 it stays recorded as 0 because there is nothing else to tell it otherwise. 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
RobertH Posted February 1, 2010 Author Share Posted February 1, 2010 kaotkbliss, that worked! Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now