Jump to content

Recommended Posts

Posted

Hello guys, I'm with some troubles here on my script, im trying to make a program, that when you insert in the input the link,

 it automaticly downloads it to your desktop.

The website i want to use for download is this one:   mega.co.nz

What im trying to say is, if I upload some stuff in "mega.co.nz" and then, put that link in my input for my programm automaticly download it. But i can't do it :c can someone help?  Ty guys, btw, heres my script:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("[AutoDownloader]   -   SsCriPteR", 379, 132, 251, 393)
GUISetFont(9, 400, 0, "Calibri")
$Label1 = GUICtrlCreateLabel("Link:", 8, 16, 33, 22)
GUICtrlSetFont(-1, 11, 400, 0, "Calibri")
$Input1 = GUICtrlCreateInput("                              (Insert the link)                                  ", 88, 16, 273, 22)
$Button1 = GUICtrlCreateButton("Download", 72, 72, 65, 25)
$Checkbox1 = GUICtrlCreateCheckbox("Download to Desktop", 80, 48, 137, 17)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd
Posted

I changed the size because you will not be able to enter a download link in that small input.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("[AutoDownloader]   -   SsCriPteR", 600,150)
GUISetFont(9, 400, 0, "Calibri")
$Label1 = GUICtrlCreateLabel("Link:", 8, 16, 33, 22)
GUICtrlSetFont(-1, 11, 400, 0, "Calibri")
$Input1 = GUICtrlCreateInput("(Insert the link)", 88, 16, 500, 22, $ES_CENTER)
GUICtrlSetLimit(-1, 100)
$Button1 = GUICtrlCreateButton("Download", 72, 72, 65, 25)
$Checkbox1 = GUICtrlCreateCheckbox("Download to Desktop", 80, 48, 137, 17)
GUISetState(@SW_SHOW)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
  Case $Button1
   Local $sPath
   Local $Desktop = GUICtrlRead($Checkbox1)
   Local $sUrl = GUICtrlRead($Input1)
   If $Desktop = 1 Then
    $sPath = @DesktopDir & "\something.rar"
   Else
    $sPath = InputBox("Path", "Set path to download:")
    If @error Then ContinueCase
   EndIf
   Local $hDownload = InetGet($sUrl, $sPath)
   If @error Then
    ConsoleWrite("InetGet error: " & @error)
    ContinueLoop
   EndIf
   ConsoleWrite("Successfully downloaded")
    EndSwitch
WEnd
Posted

If the download link is bigger than the input then when you paste it, not all of it will be pasted in the input. So INetGet will return error 1 normally.

I changed ur input to an edit so you understand what is going on. Be sure your checkbox is pressed before pressing download link. Else you will have to declare your download path.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>


$Form1 = GUICreate("[AutoDownloader] - SsCriPteR", 600,250)
GUISetFont(9, 400, 0, "Calibri")
$Label1 = GUICtrlCreateLabel("Link:", 8, 16, 33, 22)
GUICtrlSetFont(-1, 11, 400, 0, "Calibri")
$Input1 = GUICtrlCreateEdit("(Insert the link)", 90, 10, 500, 100, $ES_CENTER)
$Button1 = GUICtrlCreateButton("Download", 72, 172, 65, 25)
$Checkbox1 = GUICtrlCreateCheckbox("Download to Desktop", 80, 148, 137, 17)
GUISetState(@SW_SHOW)

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
Local $sPath
Local $Desktop = GUICtrlRead($Checkbox1)
Local $sUrl = GUICtrlRead($Input1)
If $Desktop = 1 Then
$sPath = @DesktopDir & "\something.rar"
Else
$sPath = InputBox("Path", "Set path to download:")
If @error Then ContinueCase
EndIf
Local $hDownload = InetGet($sUrl, $sPath)
If @error Then
ConsoleWrite("InetGet error: " & @error)
ContinueLoop
EndIf
ConsoleWrite("Successfully downloaded")
EndSwitch
WEnd

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...