kjcdude Posted November 28, 2009 Share Posted November 28, 2009 (edited) I'm running into a very strange issue. It looks like a bug, but I'm not entirely sure. Here's the code with the error. while 1 local $ct = WinGetTitle("Steam - Updating -", "") sleep(30000) SplashTextOn("", "$CT = " & $ct & @CRLF & "Wingettitle = " & WinGetTitle("Steam - Updating -", ""), 300, 100, -1, -1, 16, "Veranda", 9) Select Case WinGetTitle("Steam - Updating -", "") = $ct if WinGetTitle("Steam - Updating -", "") = $ct Then MsgBox(0, "TRUE", "$CT = " & $ct & @CRLF & "Wingettitle = " & WinGetTitle("Steam - Updating -", "")) Else MsgBox(0, "FALSE", "$CT = " & $ct & @CRLF & "Wingettitle = " & WinGetTitle("Steam - Updating -", "")) EndIf ProcessClose("steam.exe") FileDelete("C:\Program Files\Steam\ClientRegistry.blob") FileDelete("C:\Program Files\Steam\AppUpdateStats.blob") ShellExecuteWait("SteamService.exe", "/repair", "C:\Program Files\Steam\bin") run($gsteamlauncher) ExitLoop Case WinExists("Steam - Updating -", "") = 0 ExitLoop EndSelect WEnd What will occur is it will provide a false positive. If the window is no longer open it will output 0 like it should, but case and the if statements return a TRUE result meaning "Steam - Updating - 81%" = "0" which it obviously doesn't. When there is an active title it will react correctly and provide a false statement as it should. As a temporary fix I changed the Case line to. Case WinGetTitle("Steam - Updating -", "") = $ct and WinGetTitle("Steam - Updating -", "") <> 0 See the attached screenshot for an example of the error. Edited November 28, 2009 by kjcdude Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 28, 2009 Moderators Share Posted November 28, 2009 kjcdude,I feel that it is a logic problem in your code rather then a bug. For example:Case WinGetTitle("Steam - Updating -", "") = $ct If WinGetTitle("Steam - Updating -", "") = $ct ThenIf we get ito the Case code, it is because WinGetTitle("Steam - Updating -", "") = $ct, so why the identical If which follows? I have written a new loop and tested it against a window that updates the title on a regular basis (actually every second and with the Sleep reduced to 3 secs). It identified all 3 states correctly (updating, stalled, ended):While 1 ; Store current window title Local $ct = WinGetTitle("Steam - Updating -", "") ; Wait for 30 secs Sleep(30000) ; Deal with the exit case first If Not WinExists("Steam - Updating -", "") Then ExitLoop ; We know window exists if we get here ; See if title has changed If WinGetTitle("Steam - Updating -", "") = $ct Then ; No change - so I assume you are going to run the /repair code here ConsoleWrite("Stuck - Valve has failed!" & @CRLF) Else ; Change - so you could either update your Splashtext or just contimue ConsoleWrite("Steaming away! " & $ct & @CRLF) EndIf WEnd ConsoleWrite("No more Steam - fire the stoker!" & @CRLF)I hope that it helps in your project. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
kjcdude Posted November 29, 2009 Author Share Posted November 29, 2009 The reason for the extra if statement was to confirm twice for debugging out to the msgbox. The actual code is this: while 1 local $ct = WinGetTitle("Steam - Updating -", "") sleep(30000) Select Case WinGetTitle("Steam - Updating -", "") = $ct ProcessClose("steam.exe") FileDelete("C:\Program Files\Steam\ClientRegistry.blob") FileDelete("C:\Program Files\Steam\AppUpdateStats.blob") ShellExecuteWait("SteamService.exe", "/repair", "C:\Program Files\Steam\bin") run($gsteamlauncher) ExitLoop Case WinExists("Steam - Updating -", "") = 0 ExitLoop EndSelect WEnd I'll definitely try your suggestion, it looks to be a lot cleaner and more efficient than mine. 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