Sign in to follow this  
Followers 0
zwierzak

FileMove

4 posts in this topic

Hello, it's me again.

I'm working on updater - will download data from internet and copy it into given directory. The problem is that user creates inputs / labels / buttons on his own - up to 15. Here begins my nightmare. I can't read anything from this inputs or use buttons because they don't actually exist in the moment of compiling the script. Here is my qustion: Look and the "download" function and tell me how to move the file into directory given in Input 1?

Code:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <Zip.au3>
#include <IE.au3>
#include <String.au3>
Global $Label[15]
Global $Input[15]
Global $Button[15]
Global $coord[3] = [8, 40, 0]
Global $Input0
Global $Input1

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Sbot updater", 633, 447, 194, 140)
$LabelINFO = GUICtrlCreateLabel("Podaj ścieżki do folderów z botem:", 8, 8, 259, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$start = GUICtrlCreateButton("Start", 8, 420, 365, 20)
$Add = GUICtrlCreateButton("+", 295, 5, 27, 25, $WS_GROUP)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
tworzenieGUI($coord[0], $coord[1], $coord[2])
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


If Not FileExists(@ScriptDir & "\" & "ustawienia.ini") Then
    $licznik = 1
Else
    $licznik = IniRead("ustawienia.ini", "licznik", "wartosc", "")
    GUICtrlSetState($Add, IniRead("ustawienia.ini", "plus", "status", ""))
    For $x = 1 To $licznik - 1
        $coord[0] = $coord[0]
        $coord[1] = $coord[1] + 25
        $coord[2] = $coord[2] + 1
        tworzenieGUI($coord[0], $coord[1], $coord[2])
    Next
EndIf

;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;main programe loop <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            IniWrite("ustawienia.ini", "licznik", "wartosc", $licznik)
            IniWrite("ustawienia.ini", "plus", "status", GUICtrlGetState($Add))
            Exit
        Case $Add
            adding()
        Case $start
            download()
    EndSwitch
WEnd
;main programe loop <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Func tworzenieGUI($x, $y, $z)
    $Label[$z] = GUICtrlCreateLabel("#" & $z, $x, $y, 25, 20) ; 8 40
    GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
    $Input[$z] = GUICtrlCreateInput("", $x * 5, $y, 241, 21) ; 32 40
    $Button[$z] = GUICtrlCreateButton("Przeglądaj", $x * 37, $y, 75, 21, $WS_GROUP) ; 280 40
EndFunc   ;==>tworzenieGUI

Func adding()
    If $licznik > 13 Then
        MsgBox(0, "Warning!", "Can't load more sbots")
        GUICtrlSetState($Add, $GUI_DISABLE)
    EndIf
    $coord[0] = $coord[0]
    $coord[1] = $coord[1] + 25
    $coord[2] = $coord[2] + 1
    tworzenieGUI($coord[0], $coord[1], $coord[2])
    $licznik = $licznik + 1
EndFunc   ;==>dodawanie

Func download()
    $okno = _IECreate("http://www.bot-cave.net", 1, 0)
    $source = _IEBodyReadHTML($okno)
    _IEQuit($okno)
    $string = String($source)
    $data = _StringBetween($string, "download/", ".zip") 
    $download = InetGet("http://89.146.215.204/download/" & $data[0] & ".zip", @ScriptDir & "\" & $data[0] & ".zip", 1, 1)
    While @InetGetActive
        TrayTip("Downloading", "Bytes = " & @InetGetBytesRead, 10, 16)
        Sleep(250)
    WEnd
    ;$zip = _Zip_List(@ScriptDir & "\" & $data[0] & ".zip") ;nazwy 3 plikow
    ;MsgBox(0,'lol', $zip[1])
    ;MsgBox(0,'lol', $zip[2])
    ;MsgBox(0,'lol', $zip[3])
    _Zip_UnzipAll(@ScriptDir & "\" & $data[0] & ".zip", GUICtrlRead($Input1), 1)
EndFunc   ;==>download

Share this post


Link to post
Share on other sites



zwierzak,

I see you are planning to download bots for Silkroad Online- _IECreate("http://www.bot-cave.net", 1, 0).

Have you read this? Probably not, or you would realise we do not support bots like this. :blink:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Is this prohibiton that restrictive? :blink: It's only updating file, who cares if it's bot ;)

Ok only jokin. My interpretation was wrong then. Please close the topic.

Share this post


Link to post
Share on other sites

I give you credit for one of the best thread titles I've seen in a while:

"FileMove - have to move file into unknown destination" :blink:

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