Pathologic Posted June 19, 2017 Posted June 19, 2017 I want to create a much larger status bar that tracks the progress of a very small status bar in an application so that I can see it from far away. I cannot for the life of me work out why this isn't working, I must be missing something obvious. #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <ProgressConstants.au3> #include <WindowsConstants.au3> #include <Math.au3> $pix = 0 $pixel = 0 $progress = 100 $state = "" GUICreate("bar", 300, 30, 810, 715,$WS_POPUP+$WS_DISABLED+$GUI_NOFOCUS,$WS_EX_TOPMOST) GUISetState(@SW_SHOWNOACTIVATE) Local $idProgressbar1 = GUICtrlCreateProgress(0, 0, 300, 30) GUICtrlSetColor(-1, 32250) While 1 $pixel = PixelSearch(1724,601,1607,602,0xFFFFFF,0,1) if not @error then $pix = $pixel[0] - 1607 $progress = Round(($pix/117)*100-1,0) $state = "" Else $state = "ERROR" EndIf GUICtrlSetData($idProgressbar1, $progress) Tooltip($state & $pixel[0] & " - " & $pix & " - " & $progress,1920,500) Sleep(100) WEnd Basically, there is a white progress bar stretching from ~1607,600 to ~1724,605. I am trying to pixelsearch for the right-most pixel in the range specified that remains white, work out what percentage of the bar remains, and translate that into a new progress bar. If I comment out the pixelsearch stuff and set the $progress variable with a straight counter ($pixel = $pixel+1 or -1), the progress bar moves just fine, meaning the while loop is looping and the progress bar functions fine. If I start the script with the tooltip in place it shows correct initial numbers (the first pixel found is at 1724, the bar is 117 pixels long which is 100% of the bar). However, then nothing happens. The tooltip never updates again, it doesn't show me that it errored, it doesn't do anything at all. Am I missing something obvious? I really hope so :s Even if the pixelsearch is wrong somehow, why is it not progressing to the @error tooltip?
Moderators JLogan3o13 Posted June 19, 2017 Moderators Posted June 19, 2017 @Pathologic sounds like a great Rube Goldberg script you got going there. If you already have a status bar and it is simply too small to see, have you looked into magnifying a portion of your screen? As you can see, it has been discussed a lot: https://www.google.com/search?q=site%3Aautoitscript.com+magnify&oq=site%3Aautoitscript.com+magnify&aqs=chrome..69i57j69i58.9695j0j8&sourceid=chrome&ie=UTF-8 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
water Posted June 19, 2017 Posted June 19, 2017 There is an UDF available for a custom progress bar. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Pathologic Posted June 21, 2017 Author Posted June 21, 2017 On 6/19/2017 at 10:16 PM, JLogan3o13 said: @Pathologic sounds like a great Rube Goldberg script you got going there. If you already have a status bar and it is simply too small to see, have you looked into magnifying a portion of your screen? As you can see, it has been discussed a lot: https://www.google.com/search?q=site%3Aautoitscript.com+magnify&oq=site%3Aautoitscript.com+magnify&aqs=chrome..69i57j69i58.9695j0j8&sourceid=chrome&ie=UTF-8 It seems to me that magnifying a section of the screen might be more resource-intensive than pixelsearching an area and creating a progress bar from that information? Maybe I'm wrong though, Ill look into it. Thanks. On 6/19/2017 at 10:26 PM, water said: There is an UDF available for a custom progress bar. I'll give it a go, thanks.
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