Sign in to follow this  
Followers 0
Kyan

[SOLVED] Do .. until break my function

5 posts in this topic

#1 ·  Posted (edited)

Hi here,

I'm in trouble with this code:

Func _progressDL($link)
   $err = 0
   Do
   $csize = InetGetInfo($ndown,0)
   $prog = Floor(($csize / $tsize) * 100)
   If $prog <> $curr Then
   $curr = $prog
   _GUICtrlStatusBar_SetText($Status,$curr & "%...",0)
   WinSetTitle($Form1,"","Title " & $curr & "%")
   EndIf
   if $curr = 100 Then _GUICtrlStatusBar_SetText($Status, "Done",0)
   Opt("GUIOnEventMode",1)
   GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEnow")
   GUICtrlSetOnEvent($btnabort,"AbortNOW")
   Opt("GUIOnEventMode",0)
   Until InetGetInfo($ndown,2) Or $err
   msgbox(0,"","I never see this text popup")
EndFunc
Func AbortNOW()
   If @GUI_WINHANDLE = $Form1 Then
   If Not InetGetInfo($ndown,2) Then
   InetClose($ndown)
   EndIf
   $erro = 1
   GUICtrlSetState($btnabort,$GUI_HIDE)
   GUICtrlSetState($btn,$GUI_SHOW)
   EndIf
   Sleep(40)
EndFunc  ;==>Abort

Func CLOSEnow()
   If @GUI_WINHANDLE = $Form1 Then
   If InetGetInfo($ndown,2) <> 1 Then
   InetClose($ndown)
   EndIf
   Exit
   EndIf
EndFunc  ;==>CLOSEnow

After I abort, the code stops instead of continues, what I'm doing wrong?

thanks in advance :)

Edited by DiOgO

Heroes, there is no such thing

One day I'll discover what IE.au3 has of special for so many users using it.
C'mon there's InetRead and WinHTTP, way better
happy.png

Share this post


Link to post
Share on other sites



What is the error that you are getting and it would help if you show the full code.

Share this post


Link to post
Share on other sites

What is the error that you are getting and it would help if you show the full code.

no error to be precise, it only hangs when I click in the abort button, I create some msgbox to see where is the code being read I discover that after I abort, it runs all the abort function and stops in the do loop (I create a msgbox right after the "until xxxxxxx" and nothing shows up

Heroes, there is no such thing

One day I'll discover what IE.au3 has of special for so many users using it.
C'mon there's InetRead and WinHTTP, way better
happy.png

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

It seems that in your abort function you have $erro = 1 which should be $err = 1 right and set the $err to Global in your main function so the both functions understands it.

Edited by Aipion

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

It seems that in your abort function you have $erro = 1 which should be $err = 1 right and set the $err to Global in your main function so the both functions understands it.

yeah, the problem was with the $err variable not to be Global, now works without problems

thanks for all :)

EDIT: I already fixed that error of diferent names, I copy my old code to here, sorry

Edited by DiOgO

Heroes, there is no such thing

One day I'll discover what IE.au3 has of special for so many users using it.
C'mon there's InetRead and WinHTTP, way better
happy.png

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