Jump to content
SyedHamza

Set time for loading bar and run some program during loading bar - (Moved)

Recommended Posts

I'm very beginner in autoit. I need to make loading bar like as this source code and run for 10 seconds.

$Form1 = GUICreate("test", 650, 250, -1, -1)
$progress = GUICtrlCreateProgress(50, 176, 550, 33, $PBS_MARQUEE)
GUISetIcon("C:\Users\Hamza\Desktop\1.ico", 1)

GUISetState(@SW_SHOW)

GUICtrlSendMsg(-1, $PBM_SETMARQUEE, True, 20)

While 1
$nMsg = GUIGetMsg()
Switch $nMsg

Case $GUI_EVENT_CLOSE
Exit

EndSwitch
WEnd

And after 5 seconds of loading bar and open notepad while loading bar is running, it should show message box like this

MsgBox(32,"Message Box 1")

and when progress bar will finished, it show msg box again

MsgBox(32,"Message box 2")

Please help me to make such program. I tried it from many days but not succeed yet. HELP!

Share this post


Link to post
Share on other sites

Moved to the appropriate forum, as the Developer General Discussion forum very clearly states:

Quote

General development and scripting discussions.


Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums.

Moderation Team


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

 

I get the example code in the help file:

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <ProgressConstants.au3>

GUICreate("My GUI Progressbar", 220, 100, 100, 200)
Local $idProgressbar1 = GUICtrlCreateProgress(10, 10, 200, 20)
GUICtrlSetColor(-1, 32250)        ; not working with Windows XP Style
Local $idButton = GUICtrlCreateButton("Start", 75, 70, 70, 20)
GUISetState(@SW_SHOW)

Local $iWait = 20        ; wait 20ms for next progressstep
Local $iSavPos = 0        ; progressbar-saveposition

Local $idMsg, $idM
; Loop until the user exits.
While 1
    $idMsg = GUIGetMsg()
    Switch $idMsg
        Case $GUI_EVENT_CLOSE
            ExitLoop

        Case $idButton
            GUICtrlSetData($idButton, "Stop")
            For $i = $iSavPos To 100
                If GUICtrlRead($idProgressbar1) = 5 Then Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(4096, ''Info'', ''Progress Started 5%'',3)"') ;MsgBox($MB_SYSTEMMODAL, "Info", "Progressbar 5%", 2)

                $idM = GUIGetMsg()
                If $idM = $GUI_EVENT_CLOSE Then ExitLoop

                If $idM = $idButton Then
                    GUICtrlSetData($idButton, "Next")
                    $iSavPos = $i                    ;save the current bar-position to $iSavPos
                    ExitLoop
                Else
                    $iSavPos = 0
                    GUICtrlSetData($idProgressbar1, $i)
                    Sleep($iWait)
                EndIf
            Next
            If $i > 100 Then
                GUICtrlSetData($idButton, "Start")
                MsgBox($MB_SYSTEMMODAL, "Info", "All done 100%", 5)
            EndIf
    EndSwitch

WEnd

 


Regards,
 

Share this post


Link to post
Share on other sites

You should show us something that will reproduce your issue. 

 I can say from the actual shared code

GUICtrlSendMsg(-1, $PBM_SETMARQUEE, True, 20)

The -1 parameter is targeting your precedent targetable item which is actually your GUI.  


My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...