Quinch Posted November 16, 2006 Share Posted November 16, 2006 'ello there, more-or-less long time AutoIt user {well, roughly since 3.1.0}, first time poster. I'm experiencing a rather odd problem when trying to copy a file from a network location to my local machine. Copying it to the root folder of a drive, for example; FileCopy($GMS&$list_name&@YEAR&$DAY&".lst", "G:\", 1) {{the variables are predefined or called by the function}} ...works like a charm. But whenever I try to copy them to an actual folder, for example; FileCopy($GMS&$list_name&@YEAR&$DAY&".lst", "G:\Temp\", 1) {{or, in the latest version, flags 8 or 9}} ....I got nuffin. No error messages, no strange happenings, the file just doesn't copy. Any ideas what I might be doing wrong here? Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted November 16, 2006 Share Posted November 16, 2006 (edited) does Temp exist im guessing it does? and betas tend to have problems not surprised if this is one and if this error occurs im sure you can easily do a double filecopy and just make a _FileCopy Function that you can call and have it copy it to G:\ then copy it again to G:\Temp and idk but could the trailing backslash be the cause of it? Edited November 16, 2006 by thatsgreat2345 Link to comment Share on other sites More sharing options...
Quinch Posted November 16, 2006 Author Share Posted November 16, 2006 (edited) Yeah, it exists {tried with several other folders}. Mind you, I've tried the same script using 3.1.0 and 3.2.0.1 so I'm guessing it's a flaw in my script, rather than the app itself. I've also done some experimentation and I've found something rather odd. Here's the function in whole; Func DM_Sort($list_name, $header_line_offset, $dept_char_offset) FileCopy($GMS&$list_name&@YEAR&$DAY&".lst", "G:\NR_Lists\", 9) $active_list = FileOpen("G:\NR_Lists\"&$list_name&@YEAR&$DAY&".lst", 0) $active_list_path= "G:\NR_Lists\"&$list_name&@YEAR&$DAY&".lst" $list_length = _FileCountLines($active_list) For $page_header = $header_line_offset to $list_length step 53 $header_read = FileReadLine($active_list, $page_header) $department_no = StringMid($header_read, $dept_char_offset, 2) $page_start = $page_header-($header_line_offset-1) $page_end = $page_header-$header_line_offset+53 For $line_read = $page_start to $page_end step 1 $content = FileReadLine($active_list, $line_read) FileWriteLine("G:\NR_Lists\Department-"&$department_no&".txt", $content) Next Next For $line_fill = 1 to 8 step 1 $file_length = _FileCountLines("G:\NR_Lists\Department- "&$line_fill&".txt") While NOT _MathCheckDiv($file_length, 53) = 1 FileWriteLine("G:\NR_Lists\Department- "&$line_fill&".txt", "") Wend Next For $line_fill = 11 to 15 step 1 $file_length = _FileCountLines("G:\NR_Lists\Department- "&$line_fill&".txt") While NOT _MathCheckDiv($file_length, 53) = 1 FileWriteLine("G:\NR_Lists\Department-"&$line_fill&".txt", "") Wend Next FileClose($active_list) FileDelete($active_list_path) EndFunc If I change the destination of the second line to something else, like G:\Temp, then the file will copy. But if I do that with the rest of the function {i.e. replace all G:\NR_Lists with G:\Temp}, nothing seems to happen. {Edit: And no, tried it without the backslashes at the end of the destination, still no go} Edited November 16, 2006 by Quinch Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted November 16, 2006 Share Posted November 16, 2006 everything looks clean to me, just for effects include the filename after G:\NR_Lists\name of file copying, it shouldnt be that you have to but its worth a shot, and im just curious as to what all your variables are cuz it could be an issue with the first parameter of file copy so do a messagebox and see if the first parameter is in fact what you want it to be Link to comment Share on other sites More sharing options...
Quinch Posted November 16, 2006 Author Share Posted November 16, 2006 Yep, looks like adding the filename to the destination fixed the copying problem. As for the variables, I'm making {well, remaking} a script that will read a bunch of files and sort them by departments - list name is the name of the file, header line offset is on what line of the page the department's number is and the dept char offset is at what position of the line is the department number. Then it just reads the page line by line and dumps the content into the respective department's "sorted" files. Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted November 16, 2006 Share Posted November 16, 2006 o alright i was just curious as to the possibility of it being the first parameter, might want to get on those devs about the issue you shouldnt have to include the filename afterwards Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now