Jump to content

Path of least resistance?


Fyzzle
 Share

Recommended Posts

Heyas,

I need to be able to maintain a list of computers, at any time I need to be able to push a specific file (which i'll browse for) to a preset location on these computers. Sometimes it may be two PCs, other times it may be 12. I also need to be able to edit the list of computers on occasion, I could live with containing it in a txt file and editing it with notepad if needed. I just need something that works.

How on earth do I accomplish this? If you have the code it'd be nice, but if you could just point me to the commands needed and recommend a process I would be equally grateful.

I can get the whole process done fine if i'm only doing one computer at a time by having a textbox to type the computer name into. What would be the easiest way to do this?

Many thanks.

Link to comment
Share on other sites

Second thought... if the pc's aren't remotely conectable you could grab a file off a web server (local network or on the internet)... something like

1|c:\copy_here.txt|http://web/file.txt
2-10,15,22|c:\copy_here.txt|http://web/file_2_10.txt

The above format has 3 parts:

- number of pc

- where to put the file

- where to download the file from

This would ensure that when the pc boots up it will download the files. You don't even need to have them all online at the same time. Just upload the file list and the files and your work is done.

With a little php and mysql tinkering you could also build a log of what pc downloaded wich file and when (and so on).

Can you give me more information about your network and other things that are closely related to what you're trying to do?

Link to comment
Share on other sites

Huh? Nobody uses ftp for local network file sharing. If you have admin rights on these systems you can just use named pipes.

He did not say 'local network'. And ftp (or sftp for secure transfers) might sometimes be better than copying files from a share. And it's cross-platform, standardized and easy to set up.

Edited by madScientist
Link to comment
Share on other sites

Yeah one sec and i'll get the code, it's been butchered and I need to clean it up.

1. I have admin rights on these computers and they are on the local network. Sorry for not specifying.

2. I'm using filecopy to move the file from $filelocation = fileopendialogue to $targetlocation = guictrlcreateinput

That's some cool stuff though madscientist, if you don't mind i'll hold onto that for a future project :mellow:

Link to comment
Share on other sites

And here is what I have going from the txt file.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
;====================================================
;Globals
;====================================================
Global $computernamefile = fileopen("C:\computers.txt",0)

;====================================================
;GUI
;====================================================
$Form1 = GUICreate("Update Util", 257, 111, 383, 155)
$filelocationlabel = GUICtrlCreateLabel("File location", 8, 16, 60, 17)
$filefind = GUICtrlCreateButton("Browse", 72, 8, 75, 25, $WS_GROUP)
$targetcomputerlabel = GUICtrlCreateLabel("Target Computer", 8, 48, 83, 17)
$computername = GUICtrlCreateInput("", 96, 48, 121, 21)
$Label = GUICtrlCreateLabel("Target location: C:\TA", 40, 80, 178, 17)
$Go = GUICtrlCreateButton("Go", 200, 8, 43, 25, $WS_GROUP)
GUISetState(@SW_SHOW)

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
    Case $Go
        gomango()
    Case $filefind
        $filelocation = FileOpenDialog("Locate front end", "C:\", "Databases (*.mdb;*.accdb)", 5)
        If @error Then
            MsgBox(4096,"","No File(s) chosen")
        Else
            $filelocation = StringReplace($filelocation, "|", @CRLF)
EndIf
Case $GUI_EVENT_CLOSE
Exit

EndSwitch
WEnd


;====================================================
;Main Process
;====================================================

Func gomango()
        If $computernamefile = -1 Then
            MsgBox(0, "Error", "Unable to open file.")
            Exit
        EndIf
    While 1
        Global $computername = FileReadLine($computernamefile)
        If @error = -1 Then ExitLoop
        Pushfile()
    Wend
    FileClose("C:\computers.txt")
EndFunc

;====================================================
;Functions
;====================================================

Func Pushfile()
    FileCopy($filelocation,"\\" & GUICtrlRead($computername) & "\C$\TA\", 9)
    ;MsgBox(4096,"Complete","Copy completed to " & $computername)
EndFunc
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...