Sign in to follow this  
Followers 0
N340

Progress Bar for webpages

5 posts in this topic

Hi,

I'm trying to make an IE based web browser. I have managed the main things, forward, back button etc... But now I want to make a progress bar, and failed :)

CODE
$GUI_Progress=GUICtrlCreateProgress(835, 632, 120, 15)

$wait = 20; wait 20ms for next progressstep

$s = 0; progressbar-saveposition

Do

$msg = GUIGetMsg()

If $msg = $GUI_GO Then

GUICtrlSetData($GUI_GO, "Go")

For $i = $s To 100

$m = GUIGetMsg()

If $m = -3 Then ExitLoop

If $m = $GUI_GO Then

GUICtrlSetData($GUI_GO, "Go")

$s = $i;save the current bar-position to $s

ExitLoop

Else

$s = 0

GUICtrlSetData($GUI_Progress, $i)

EndIf

Next

If $i > 100 Then

; $s=0

GUICtrlSetData($GUI_GO, "Go")

EndIf

EndIf

Until $msg = $GUI_EVENT_CLOSE

Could someone help me, the progress bar doesn't work when I have entered the web address and clicked on "Go" It just stays the same as the web page loads. I want the progress bar to move in accordance to how much the web page has loaded.

Thanks,

NS340

Share this post


Link to post
Share on other sites



Hi,

I'm trying to make an IE based web browser. I have managed the main things, forward, back button etc... But now I want to make a progress bar, and failed :P

CODE
$GUI_Progress = GUICtrlCreateProgress(835, 632, 120, 15)

$wait = 20 ; wait 20ms for next progressstep

$s = 0 ; progressbar-saveposition

Do

$msg = GUIGetMsg()

If $msg = $GUI_GO Then

GUICtrlSetData($GUI_GO, "Go")

For $i = $s To 100

$m = GUIGetMsg()

If $m = -3 Then ExitLoop

If $m = $GUI_GO Then

GUICtrlSetData($GUI_GO, "Go")

$s = $i;save the current bar-position to $s

ExitLoop

Else

$s = 0

GUICtrlSetData($GUI_Progress, $i)

EndIf

Next

If $i > 100 Then

; $s=0

GUICtrlSetData($GUI_GO, "Go")

EndIf

EndIf

Until $msg = $GUI_EVENT_CLOSE

Could someone help me, the progress bar doesn't work when I have entered the web address and clicked on "Go" It just stays the same as the web page loads. I want the progress bar to move in accordance to how much the web page has loaded.

Thanks,

NS340

I don't understand your nested GUI message loops. What's the point of this? What triggers $GUI_GO?

To help you trace it yourself, put this at the top of your script:

Opt("TrayIconDebug", 1)
#AutoIt3Wrapper_Run_Debug_Mode=Y

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

By adding that at the top of my script I get this

0017: 0-0: $GUI_Button_Forward = GUICtrlCreateButton("Forward", 120, 10, 100, 30)
0018: 0-0: $GUI_Button_Home = GUICtrlCreateButton("Home", 220, 10, 100, 30)
0019: 0-0: $GUI_Button_Stop = GUICtrlCreateButton("Stop", 320, 10, 100, 30)
0020: 0-0: $GUI_Address_Box=GUICtrlCreateInput("http://", 425, 15, 450,20)
0021: 0-0: $GUI_GO=GUICtrlCreateButton ("Go", 920,15,30,20)
0022: 0-0: $GUI_Progress=GUICtrlCreateProgress(835, 632, 120, 15)
0023: 0-0:   $wait = 20; wait 20ms for next progressstep
0024: 0-0:   $s = 0; progressbar-saveposition
0025: 0-0:   Do
0026: 0-0:       $msg = GUIGetMsg()
0027: 0-0:       If $msg = $GUI_GO Then
0050: 0-0:   Until $msg = $GUI_EVENT_CLOSE
***A BUNCH OF REPEATED CODE***
0026: 0-0:       $msg = GUIGetMsg()
0027: 0-0:       If $msg = $GUI_GO Then
0050: 0-0:   Until $msg = $GUI_EVENT_CLOSE
0053: 0-0: GUISetState();Show GUI
0055: 0-0: _IENavigate($oIE, "google.com")
0058: 0-0: While 1
0059: 0-0:  $msg = GUIGetMsg()
0060: 0-0:  Switch $msg
0076: 0-0: WEnd
0059: 0-0:  $msg = GUIGetMsg()
0060: 0-0:  Switch $msg
0076: 0-0: WEnd
0059: 0-0:  $msg = GUIGetMsg()
0060: 0-0:  Switch $msg
0076: 0-0: WEnd
0059: 0-0:  $msg = GUIGetMsg()
0060: 0-0:  Switch $msg
0062: 0-0:          Exit

Is that What you need?

Edited by big_daddy

Share this post


Link to post
Share on other sites

bump!

Share this post


Link to post
Share on other sites

By adding that at the top of my script I get this

CODE
0017: 0-0: $GUI_Button_Forward = GUICtrlCreateButton("Forward", 120, 10, 100, 30)

0018: 0-0: $GUI_Button_Home = GUICtrlCreateButton("Home", 220, 10, 100, 30)

0019: 0-0: $GUI_Button_Stop = GUICtrlCreateButton("Stop", 320, 10, 100, 30)

0020: 0-0: $GUI_Address_Box=GUICtrlCreateInput("http://", 425, 15, 450,20)

0021: 0-0: $GUI_GO=GUICtrlCreateButton ("Go", 920,15,30,20)

0022: 0-0: $GUI_Progress=GUICtrlCreateProgress(835, 632, 120, 15)

0023: 0-0: $wait = 20; wait 20ms for next progressstep

0024: 0-0: $s = 0; progressbar-saveposition

0025: 0-0: Do

0026: 0-0: $msg = GUIGetMsg()

0027: 0-0: If $msg = $GUI_GO Then

0050: 0-0: Until $msg = $GUI_EVENT_CLOSE

0026: 0-0: $msg = GUIGetMsg()

0027: 0-0: If $msg = $GUI_GO Then

0050: 0-0: Until $msg = $GUI_EVENT_CLOSE

; ...

0026: 0-0: $msg = GUIGetMsg()

0027: 0-0: If $msg = $GUI_GO Then

0050: 0-0: Until $msg = $GUI_EVENT_CLOSE

0053: 0-0: GUISetState() ;Show GUI

0055: 0-0: _IENavigate($oIE, "google.com")

0058: 0-0: While 1

0059: 0-0: $msg = GUIGetMsg()

0060: 0-0: Switch $msg

0076: 0-0: WEnd

0059: 0-0: $msg = GUIGetMsg()

0060: 0-0: Switch $msg

0076: 0-0: WEnd

0059: 0-0: $msg = GUIGetMsg()

0060: 0-0: Switch $msg

0076: 0-0: WEnd

0059: 0-0: $msg = GUIGetMsg()

0060: 0-0: Switch $msg

0062: 0-0: Exit

Is that What you need?

What I need...? :)

I think what YOU need is to look at the full listing of your script and compare what you see here with what you expected to happen in your script. Use this trace of what actually happened to see where it fails.

:P


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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
Sign in to follow this  
Followers 0