Jump to content

FileCopy not copying file


Recommended Posts

Hmm, this is probably something really basic i have missed.

but, i am working on a program for a school

the idea is to cut down on printing by providing an easy way to pass files in electronically.

Students select the teachers name, and the script passes the file to a WriteOnly access share on the server

the share on the server for each staff member is then mapped on login so that they can easily get to all 30 odd files in one place.

Syntax check from Scite comes back clean.

Now, here is the code for the program:

#Include <GUIConstants.au3>
#Include <GuiCombo.au3>

GUICreate("test", 346, 200)
;GUICtrlCreatePic("Banner.bmp", 0, 0, 346, 61)
$ini = String("d:\SubmittWork.ini")


$TeacherArray = IniReadSection($ini, "TeacherNames")
    If @Error = 1 Then
        MsgBox(0, "Error", "Unable to read the ini file")
        Exit
    EndIf
GUICtrlCreateLabel("Teacher: ", 10, 75)
$TeacherCombo = GUICtrlCreateCombo("", 75, 71, 200, 25)
For $t = 1 to $TeacherArray[0][0] Step 1
_GUICtrlComboAddString($TeacherCombo, $TeacherArray[$t][0])
Next
GUICtrlCreateLabel("File: ", 10, 105)
$File = GUICtrlCreateInput("", 75, 101, 200, 22, $ES_READONLY)
$FileOpen = FileOpenDialog("Select File To Submitt:", "H:\", "All Files (*.*)", 3)
GUICtrlSetData($File, $FileOpen)
$btn_Submit = GUICtrlCreateButton("Submit", 86, 150, 75, 25)
$btn_Cancel = GUICtrlCreateButton("Cancel", 180, 150, 75, 25)

GuiSetState(@SW_SHOW)

While 1
    $Msg = GUIGetMsg()
    Select
        Case $Msg = $GUI_EVENT_CLOSE or $Msg = $btn_Cancel
            Exit
        Case $Msg = $btn_Submit
            $DropBox = IniRead($ini, "ServerSettings", "Share", "")
            $TeacherDir = IniRead($ini, "TeacherNames", GUICtrlRead($TeacherCombo), "")
            FileCopy($File, $Dropbox&"\"&$TeacherDir&"\*.*", 8)
            MsgBox(0, "test", $Dropbox&"\"&$TeacherDir&"\*.*")
            Exit
    EndSelect
WEnd

Sample of the ini file:

[ServerSettings]
Share=c:\dropbox

[TeacherNames]
Mr Doe=john.doe.dropbox
Mr Citizen=john.citizen.dropbox
Link to comment
Share on other sites

  • Moderators

Have you tried:

FileCopy($File, $Dropbox&"\"&$TeacherDir&"\", 8)
?

Also...are you sure their computers will have a "C" drive?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

will try that first thing in the morning.

and I am 100% certain that students do not see the C: drive.

but I had to test with something whilst at home.

the eventual script will pass to a unc share:

\\server\share$\dropboxname

and each teacher will have there "dropbox" mapped at login.

ps: I know dropbox sucks as a name, but I only create the stuff I don't name it

** EDIT ** Update:

Dangit..

it was that line of code that was fubar, but this is what fixed it:

FileCopy(GUICtrlRead($File), $Dropbox&"\"&$TeacherDir&"\*.*", 8)

.. just knew it would be a really stupid mistake, especially after it took me 10 minutes just to get the basic GUI running cause i forgot to include the guiconstants.au3 file..

oh well, its 100% working, time to add some error checking :whistle:

Edited by tAKTelapis
Link to comment
Share on other sites

Hey guys,

Well, i got this all working locally, set it up for the network and seemed to be running fine.

now i have another issue..

when a students account attempts to submit work, and the FOLDER that the working is going to does not exist, it works fine.

it also continues to work fine for THAT student for THAT folder from then on.

HOWEVER

that folder is "owned" by that student, and even thought ALL STUDENTS have WRITE access to it, it fails for all other students attempting to submit via the system to that folder.

Anyone have any ideas on this?

i find it odd, seeing as the initial share \\server\share$ allows the creation of the folder in the first place.

any ideas?

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