Sign in to follow this  
Followers 0
AzKay

How can I save the file to a specific directory?

8 posts in this topic

#1 ·  Posted (edited)

Ok, Heres my script:

#include <GUIConstants.au3>
; == GUI generated with Koda ==
$Form1 = GUICreate("AForm1", 385, 105, 192, 125)
$Input1 = GUICtrlCreateInput("Url Here Eg: www.file.com/file.exe", 8, 8, 369, 21, -1, $WS_EX_CLIENTEDGE)
$Input2 = GUICtrlCreateInput("Name Of File Here Eg: File.exe", 8, 32, 369, 21, -1, $WS_EX_CLIENTEDGE)
$Input3 = GUICtrlCreateInput("Save To Eg: C:/Downloads/", 8, 56, 369, 21, -1, $WS_EX_CLIENTEDGE)
$Button1 = GUICtrlCreateButton("Download", 8, 80, 369, 17)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        ;;;;;;;
    EndSelect
WEnd
Exit

If $Button1 Then
    _Download($Input1, $Input2)
    Sleep(100)
EndIf

Func _Download($File, $name)
    
    $FileSize1 = InetGetSize($file)
    InetGet($file, $name, 1, 1)
    While @InetGetActive
        
        $filedownload = Round(@InetGetBytesRead / 1048576, 5)
        $Percent = $filedownload / $FileSize1
        
        TrayTip("", "" & $filedownload & " Mb", 10, 16)
        Sleep(250)
    WEnd
    Sleep(500)
EndFunc

Yes, So, I need to have an input box which tells the script where to download to.

Oh, and how can I make it download when I click Button1?

Thanks

Edited by AzKay

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Ok, Heres my script:

#include <GUIConstants.au3>
; == GUI generated with Koda ==
$Form1 = GUICreate("AForm1", 385, 105, 192, 125)
$Input1 = GUICtrlCreateInput("Url Here Eg: www.file.com/file.exe", 8, 8, 369, 21, -1, $WS_EX_CLIENTEDGE)
$Input2 = GUICtrlCreateInput("Name Of File Here Eg: File.exe", 8, 32, 369, 21, -1, $WS_EX_CLIENTEDGE)
$Input3 = GUICtrlCreateInput("Save To Eg: C:/Downloads/", 8, 56, 369, 21, -1, $WS_EX_CLIENTEDGE)
$Button1 = GUICtrlCreateButton("Download", 8, 80, 369, 17)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        ;;;;;;;
    EndSelect
WEnd
Exit

If $Button1 Then
    _Download($Input1, $Input2)
    Sleep(100)
EndIf

Func _Download($File, $name)
    
    $FileSize1 = InetGetSize($file)
    InetGet($file, $name, 1, 1)
    While @InetGetActive
        
        $filedownload = Round(@InetGetBytesRead / 1048576, 5)
        $Percent = $filedownload / $FileSize1
        
        TrayTip("", "" & $filedownload & " Mb", 10, 16)
        Sleep(250)
    WEnd
    Sleep(500)
EndFunc

Yes, So, I need to have an input box which tells the script where to download to.

Oh, and how can I make it download when I click Button1?

Thanks

Oh, how I put the "IF" command, I dont really know how to use that, it always confuses me, so it was just there to test.

EDIT::

Nevermind, Ill remove the button and just put a hotkey for {ENTER}.

EDIT::

Ive confused myself, I have NO IDEA what im doing

Edited by AzKay

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

******* not tested

#include <GUIConstants.au3>
; == GUI generated with Koda ==
$Form1 = GUICreate("AForm1", 385, 105, 192, 125)
$Input1 = GUICtrlCreateInput("Url Here Eg: www.file.com/file.exe", 8, 8, 369, 21, -1, $WS_EX_CLIENTEDGE)
$Input2 = GUICtrlCreateInput("Name Of File Here Eg: File.exe", 8, 32, 369, 21, -1, $WS_EX_CLIENTEDGE)
$Input3 = GUICtrlCreateInput("Save To Eg: C:/Downloads/", 8, 56, 369, 21, -1, $WS_EX_CLIENTEDGE)
$Button1 = GUICtrlCreateButton("Download", 8, 80, 369, 17)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $Button1
         _Download(GUICtrlRead($Input1), GUICtrlRead($Input3)&GUICtrlRead($Input2))
    Sleep(100)
    EndSelect
WEnd
Exit

Func _Download($File, $name)
   
    $FileSize1 = InetGetSize($file)
    InetGet($file, $name, 1, 1)
    While @InetGetActive
       
        $filedownload = Round(@InetGetBytesRead / 1048576, 5)
        $Percent = $filedownload / $FileSize1
       
        TrayTip("", "" & $filedownload & " Mb", 10, 16)
        Sleep(250)
    WEnd
    Sleep(500)
EndFunc

9)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Oh, how I put the "IF" command, I dont really know how to use that, it always confuses me, so it was just there to test.

EDIT::

Nevermind, Ill remove the button and just put a hotkey for {ENTER}.

check out FileSaveDialog in the beta helpfile...

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Hmm, the script, the one you posted, keeps freezing up, And it doesnt seem to work right...

Instead of using a GUI, would it be easier to just use InputBox's?

Edited by AzKay

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

Ok, I have changed it, Im using inputbox's instead

just one question, is it possible to resize an inputbox?

by inputbox, I mean InputBox("", "") That type


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

Ok, I have changed it, Im using inputbox's instead

just one question, is it possible to resize an inputbox?

by inputbox, I mean InputBox("", "") That type

have you looked at FileSaveDialog()?

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

have you looked at FileSaveDialog()?

yes, but I didnt understand it, but, I got my script working anyway, I just need to know if its possible to resize the InputBox.

DirCreate("Downloads")
$FileUrl = InputBox("Download", "Url:")
$FileName = InputBox("Save As", "Save As:")

  _Download($FileUrl, @scriptDir & "/Downloads/" & $FileName )
    Sleep(100)

Func _Download($File, $name)
    
    $FileSize1 = InetGetSize($file)
    InetGet($file, $name, 1, 1)
    While @InetGetActive
        
        $filedownload = Round(@InetGetBytesRead / 1048576, 5)
        $Percent = $filedownload / $FileSize1
        
        TrayTip("", "" & $filedownload & "Mb", 10, 16)
        Sleep(250)
    WEnd
    Sleep(500)
EndFunc

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

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