jerem488 Posted April 6, 2013 Share Posted April 6, 2013 How to close a window chen a download is in progress ? And I can also click on any button. Button has'nt effect... I tested with exit, winkill, inetclose and guidelete, but nothing Qui ose gagneWho Dares Win[left]CyberExploit[/left] Link to comment Share on other sites More sharing options...
FireFox Posted April 7, 2013 Share Posted April 7, 2013 Hi, How can we help you if you don't provide a snippet ? Hence we will be able to tell you what's wrong. Br, FireFox. Link to comment Share on other sites More sharing options...
ileandros Posted April 7, 2013 Share Posted April 7, 2013 If your download is called from your script then your script will remain frozen till it returns. Provide a snippet I feel nothing.It feels great. Link to comment Share on other sites More sharing options...
jerem488 Posted April 7, 2013 Author Share Posted April 7, 2013 #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> GUICreate("Barre de progression", 220, 100, 100, 200) $Barre_de_progression = GUICtrlCreateProgress(10, 10, 200, 20) $Bouton = GUICtrlCreateButton("Démarrer", 75, 70, 70, 20) $Avancement = GUICtrlCreateLabel("Ouvrir le dossier", 10, 40) GUISetState() Do $msg = GUIGetMsg() If $msg = $Bouton Then $Taille_fichier = InetGetSize("http://download.mythicsoft.com/agentran.exe") $Download = InetGet("http://download.mythicsoft.com/agentran.exe", @DesktopDir & "\Test\Ransack.exe", 3, 1) Do Sleep(200) $Taille_intermediaire = InetGetInfo($Download, 0) $Pourcentage = 100 * $Taille_intermediaire / $Taille_fichier GUICtrlSetData($Barre_de_progression, $Pourcentage) GUICtrlSetData($Avancement, "Avancement : " & Round($Pourcentage, 0) & " %") Until InetGetInfo($Download, 2) EndIf Until $msg = $GUI_EVENT_CLOSE I tested Opt("GUIOnEventMode", 1) but, I don't understand why buttons doesn't work !!! Qui ose gagneWho Dares Win[left]CyberExploit[/left] Link to comment Share on other sites More sharing options...
FireFox Posted April 7, 2013 Share Posted April 7, 2013 Lorsque tu démarres le téléchargement, ton script passe dans un sous looping tant que le téléchargement n'est pas terminé; du coup le looping principal qui écoute les événements GUI n'est plus actif et ne peux pas répondre aux différents cliques.When you start the download, your script goes in a sub loop while the download is not complete; therefore the main loop which listens to the GUI messages is not active and can't answer to various clicks.#include <GUIConstantsEx.au3> #include <ProgressConstants.au3> GUICreate("Barre de progression", 220, 100, 100, 200) $Barre_de_progression = GUICtrlCreateProgress(10, 10, 200, 20) $Bouton = GUICtrlCreateButton("Démarrer", 75, 70, 70, 20) $Avancement = GUICtrlCreateLabel("Ouvrir le dossier", 10, 40) GUISetState() Local $Download = 0 While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $Bouton $Taille_fichier = InetGetSize("http://download.mythicsoft.com/agentran.exe") $Download = InetGet("http://download.mythicsoft.com/agentran.exe", @DesktopDir & "\Test\Ransack.exe", 3, 1) EndSwitch If $Download > 0 Then $Taille_intermediaire = InetGetInfo($Download, 0) $Pourcentage = 100 * $Taille_intermediaire / $Taille_fichier GUICtrlSetData($Barre_de_progression, $Pourcentage) GUICtrlSetData($Avancement, "Avancement : " & Round($Pourcentage, 0) & " %") If InetGetInfo($Download, 2) Then $Download = 0 EndIf WEndBr, FireFox. Link to comment Share on other sites More sharing options...
jerem488 Posted April 7, 2013 Author Share Posted April 7, 2013 Thanks FireFox It works !! I would add a new func with an other download... How do ? Qui ose gagneWho Dares Win[left]CyberExploit[/left] Link to comment Share on other sites More sharing options...
FireFox Posted April 7, 2013 Share Posted April 7, 2013 (edited) Whenever you want to manage multiple things, the array is always the best solution. Like this : expandcollapse popup#include <GUIConstantsEx.au3> #include <ProgressConstants.au3> Local $iMaxDownload = 5 ;let's say 5 simultaneous max downloads Local $ahDownload[$iMaxDownload], $aiDlSize[$iMaxDownload] Local $aiPbProgress[$iMaxDownload], $aiBtnStart[$iMaxDownload], $aiLabelStatus[$iMaxDownload] #region GUI Local $hGUI = GUICreate("MyGUI") For $i = 0 To $iMaxDownload -1 $aiPbProgress[$i] = GUICtrlCreateProgress(10, 10 + $i * 55, 200, 20) $aiBtnStart[$i] = GUICtrlCreateButton("Démarrer", 9, 35 + $i * 55, 70, 20) $aiLabelStatus[$i] = GUICtrlCreateLabel("Na", 85, 40 + $i * 55, 200) Next GUISetState(@SW_SHOW, $hGUI) #endregion Local $iMsg = 0, $iCurrSize = 0, $iPercent = 0 While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE ExitLoop Case Else For $i = 0 To $iMaxDownload -1 If $iMsg <> $aiBtnStart[$i] Then ContinueLoop $aiDlSize[$i] = InetGetSize("http://download.mythicsoft.com/agentran.exe") $ahDownload[$i] = InetGet("http://download.mythicsoft.com/agentran.exe", @DesktopDir & "\Test\Ransack" & $i & ".exe", 3, 1) Next EndSwitch For $i = 0 To $iMaxDownload -1 If $ahDownload[$i] = 0 Then ContinueLoop $iCurrSize = InetGetInfo($ahDownload[$i], 0) $iPercent = 100 * $iCurrSize / $aiDlSize[$i] GUICtrlSetData($aiPbProgress[$i], $iPercent) GUICtrlSetData($aiLabelStatus[$i], "Avancement : " & Round($iPercent) & " %") If InetGetInfo($ahDownload[$i], 2) Then $ahDownload[$i] = 0 Next WEnd Br, FireFox. Edited April 7, 2013 by FireFox 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