Jump to content
Sign in to follow this  
jerem488

Close a window during download

Recommended Posts

jerem488

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]

Share this post


Link to post
Share on other sites
FireFox

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.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
ileandros

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.

Share this post


Link to post
Share on other sites
jerem488

#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]

Share this post


Link to post
Share on other sites
FireFox

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
WEnd

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
jerem488

Thanks FireFox :) It works !!

I would add a new func with an other download... How do ?


Qui ose gagneWho Dares Win[left]CyberExploit[/left]

Share this post


Link to post
Share on other sites
FireFox

Whenever you want to manage multiple things, the array is always the best solution.

Like this :

#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 by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

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  

×