Sign in to follow this  
Followers 0
themax90

Network Move

13 posts in this topic

#1 ·  Posted (edited)

So I havn't had much time to write scripts. But I set up a network system and wanted to transfer files from my computer to perhaps my dads computer or something instead of emails, something that will put it right on the desktop so we can communicate and share files. ETC.... without windows crappy take forever loads. Here it is, my network moving program.... P.S. IT ONLY MOVES MULTIPUL FILES, It will not work for single files because of how I organized the breakdown of the array from FileOpenDialogue. If you want a single file mover, You can extract my idea or post and I can make one for you.

#include <GuiConstants.au3>
GUICreate("Network Utility", 210, 340, (@DesktopWidth - 200) / 2, (@DesktopHeight - 365) / 2, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
$filelist = GUICtrlCreateList("", 10, 10, 190, 149)
$add = GUICtrlCreateButton("Add", 10, 140, 90, 20)
$start = GUICtrlCreateButton("Work", 110, 140, 90, 20)
$history = GUICtrlCreateLabel("History.....", 10, 170, 190, 160, $SS_SUNKEN)
GUISetState()
Global $dir2 = "Set to network directory FIRST!!!!"
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then
        ExitLoop
    ElseIf $msg = $add Then
        $filelist2 = FileOpenDialog( "Choose files....", @DesktopDir, "All Files(*.*)", 5)
        $filelist2 = StringSplit($filelist2, "|")
        $n = 2
        $t = 0
        $numbers = $filelist2[0] - 1
        Dim $filelist3[$numbers]
        While $t <> $numbers
             $filelist3[$t] = $filelist2[$n]
            $t = $t + 1
            $n = $n + 1
        WEnd
        $n = 0
        $t = 0
        While $t <> $numbers
            GUICtrlSetData($filelist, GUICtrlRead($filelist) & @LF & $filelist3[$t])
            $t = $t + 1
            $n = $n + 1
        WEnd
    ElseIf $msg = $start Then
        $n = 0
        $t = 0
        While $t <> $numbers
            $ext = StringSplit($filelist3[$t], ".")
            $var = $ext[1] & "." & $ext[2]
            FileCopy($filelist3[$t], $dir2 & "\" & $var)
            GUICtrlSetData($history, GUICtrlRead($history) & @LF & "Moving " & $filelist3[$t])
            $n = $n + 1
            $t = $t + 1
        WEnd
        GUICtrlSetData($history, GUICtrlRead($history) & @LF & "Finished!" & @lf & "Exiting....")
        Sleep(2000)
        ExitLoop
    EndIf
WEnd
Exit
Edited by AutoIt Smith

Share this post


Link to post
Share on other sites



@AutoItSmith, nice idea. But need some info. When I click, "Add" it opens a file window, you select a file but then the window closes. You do not get a chance to click on "Work." So what do you think is going on?

Cheers.. B)

Share this post


Link to post
Share on other sites

It does not work for single files B) Did you do multipul select or single? And also you need to set a network directory to the second computer and set $dir2 to that.

Share this post


Link to post
Share on other sites

I think with this you can select a network comp & folder! Try to implement this so you can select the tagert comp, too!

FileSelectFolder("Select network folder","::{7007ACC7-3202-11D1-AAD2-00805FC1270E}")

before people start posting "ohh I see a magic number!^^", the long number thingy is a CLSID, which can be found in the appendix of the manual. This one stands for Network Computers! B)

HF

Felix N. (tdlrali)

Share this post


Link to post
Share on other sites

It does not work for single files :) Did you do multipul select or single? And also you need to set a network directory to the second computer and set $dir2 to that.

I was doing single files. I will try multiple and get back to you.. But I really like the idea.

Cheers.. :o

P.S. If you can fix the single file issue that would be great. :graduated: This could turn into an very interesting project! B)

Share this post


Link to post
Share on other sites

Ok with the weekend coming up I will work on a network file sender and maybe receive with new GUI, to be posted by 1am Pacific Standard Time

Share this post


Link to post
Share on other sites

Ok with the weekend coming up I will work on a network file sender and maybe receive with new GUI, to be posted by 1am Pacific Standard Time

It will be good to see what you come up with..

Cheers.. B)

Share this post


Link to post
Share on other sites

Here is the gui, I just got time to work on it, sorry it took so long. Script to be finished shortly, within a day

; ----------------------------------------------------------------------------
; AutoIt Version: 3.1.1++ (BETA)
; Author:        Max Gardner(AutoIt Smith;king.of.all@comcast.net)
; Script Function:
;   To copy network files from one source to the other.
; ----------------------------------------------------------------------------
#include <GuiConstants.au3>
GuiCreate("NM 1.3 BETA", 230, 227,(@DesktopWidth-230)/2, (@DesktopHeight-227)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
$visuallist = GuiCtrlCreateList("", 10, 10, 210, 84)
$destinfo = GuiCtrlCreateInput("Network Dir", 10, 160, 130, 20)
$dirbrowse = GuiCtrlCreateButton("Browse", 150, 160, 70, 20)
$addfile = GuiCtrlCreateButton("Add File", 10, 100, 100, 20)
$removefolder = GuiCtrlCreateButton("Remove Folder", 120, 130, 100, 20)
$removefile = GuiCtrlCreateButton("Remove File", 10, 130, 100, 20)
$addfolder = GuiCtrlCreateButton("Add Folder", 120, 100, 100, 20)
$work = GuiCtrlCreateButton("Work", 10, 190, 100, 30)
$clear = GuiCtrlCreateButton("Clear", 120, 190, 100, 30)
GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
    ;;;
    EndSelect
WEnd
Exit

Share this post


Link to post
Share on other sites

maybe a test for this AutoIt Smith...

could it help us when we need to move our Autoit ITS server to another web-site?

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Yes actually it could. Set up the domain and I will run it through ip addresses and if you allow the domains cross compatibility then it will work. (AKA PcAnywhere software or I can organize my RS 1.0 to transfer everything. Its simple, if we need it just tell me.)

Share this post


Link to post
Share on other sites

Yes actually it could. Set up the domain and I will run it through ip addresses and if you allow the domains cross compatibility then it will work. (AKA PcAnywhere software or I can organize my RS 1.0 to transfer everything. Its simple, if we need it just tell me.)

i am sure we will.... thanks

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Heres how the scripts coming along. I got all file recognition and array structures done. I need the following items to complete

To Do:

Figure out how the Horizontally Scroll Lists(for some reason the WS_HSCROLL messes up the GUI)

Add Browse Feature to find destination

Add Clear to erase all data in gui and Arrays

Add Work to finish off script and make it usable

Here it is so far, I am releasing it at this point so if someone wants to adapt it to anything hybrid from what I am making they can easily. This is just a GUI and array structure B)

; ----------------------------------------------------------------------------
; AutoIt Version: 3.1.1++ (BETA)
; Author:        Max Gardner(AutoIt Smith;king.of.all@comcast.net)
; Script Function:
;   To copy network files from one source to the other.
; ----------------------------------------------------------------------------
#include <Array.au3>
$Filelist = _ArrayCreate (0)
$Folderlist = _ArrayCreate (0)
$GUI_EVENT_CLOSE = -3
GUICreate("NM 1.3", 230, 300, (@DesktopWidth - 230) / 2, (@DesktopHeight - 300) / 2, 0x00CF0000 + 0x10000000 + 0x04000000)
$folderlistlabel = GUICtrlCreateLabel("Folder/s To Move:", 70, 2.5, 95, 15, 0x1000)
$filelistlabel = GUICtrlCreateLabel("File/s To Move:", 75, 82.5, 85, 15, 0x1000)
$visualfolderlist = GUICtrlCreateList("", 10, 20, 210, 85)
$visualfilelist = GUICtrlCreateList("", 10, 100, 210, 85)
$destinfo = GUICtrlCreateInput("", 10, 230, 130, 20)
$dirbrowse = GUICtrlCreateButton("Browse", 150, 230, 70, 20)
$addfile = GUICtrlCreateButton("Add File", 10, 170, 100, 20)
$removefolder = GUICtrlCreateButton("Remove Folder", 120, 200, 100, 20)
$removefile = GUICtrlCreateButton("Remove File", 10, 200, 100, 20)
$addfolder = GUICtrlCreateButton("Add Folder", 120, 170, 100, 20)
$work = GUICtrlCreateButton("Work", 10, 260, 100, 30)
$clear = GUICtrlCreateButton("Clear", 120, 260, 100, 30)
GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $addfolder
            $Folder = FileSelectFolder( "Please select folder...", "")
            If $Folder = "" And @error = 1 Then
            ; User cancelled or closed window
            ElseIf $Folder <> "" And @error <> 1 Then
            ; Add folder to array
                _ArrayAdd($Folderlist, $Folder)
                $Folderlist[0] = ($Folderlist[0] + 1)
            EndIf
            UpdateList($visualfolderlist, $Folderlist)
        Case $msg = $removefolder
            MsgBox(0, "Select Array Number", "Please select the array number to remove.....")
            _ArrayDisplay($Folderlist, "Select Number")
            $Folder = InputBox("Folder Remove", "Which folder number did you choose to remove?")
            If $Folder = "" And @error >= 0 Then
            ; User canceled remove
            ElseIf $Folder <> "" Then
            ; User entered number
                _ArrayDelete($Folderlist, $Folder)
                $Folderlist[0] = ($Folderlist[0] - 1)
            EndIf
            UpdateList($visualfolderlist, $Folderlist)
        Case $msg = $addfile
            $File = FileOpenDialog( "Please select file...", "", "All Files(*.*)", 7)
            If @error = 1 Then
            ; User canceled
            ElseIf @error <> 1 Then
                $File = StringSplit($File, "|")
                If IsNumber($File[0]) = 1 And $File[0] >= 2 Then
                ; User selected multiple files
                    $NoF = ($File[0] + 1)
                    $Track = 2
                    While $Track <> $NoF
                        _ArrayAdd($Filelist, $File[1] & "\" & $File[$Track])
                        $Filelist[0] = ($Filelist[0] + 1)
                        $Track = ($Track + 1)
                    WEnd
                ElseIf $File[0] >= 1 Then
                ; User selected a single file
                    _ArrayAdd($Filelist, $File[$File[0]])
                    $Filelist[0] = ($Filelist[0] + 1)
                EndIf
            EndIf
            UpdateList($visualfilelist, $Filelist)
        Case $msg = $removefile
            MsgBox(0, "Select Array Number", "Please select the array number to remove.....")
            _ArrayDisplay($Filelist, "Select Number")
            $File = InputBox("File Remove", "Which file number did you choose to remove?")
            If $File = "" And @error >= 0 Then
            ; User canceled remove
            ElseIf $File <> "" Then
            ; User entered number
                _ArrayDelete($Filelist, $File)
                $Filelist[0] = ($Filelist[0] - 1)
            EndIf
            UpdateList($visualfilelist, $Filelist)
    EndSelect
WEnd
Exit
Func UpdateList($ListGUIVariable, $ListVariable)
    GUICtrlSetData($ListGUIVariable, "")
    $Track = 1
    While $Track <> ($ListVariable[0] + 1)
        GUICtrlSetData($ListGUIVariable, GUICtrlRead($ListGUIVariable) & $ListVariable[$Track])
        $Track = ($Track + 1)
    WEnd
EndFunc  ;==>UpdateList

Have fun :o

Share this post


Link to post
Share on other sites

For this:

Add Browse Feature to find destination

If you wanna pick a computer on the network, then use the code i posted earlier, that should work:

$destination = FileSelectFolder("Select network folder","::{7007ACC7-3202-11D1-AAD2-00805FC1270E}")

Kepp up the good work! B)

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