| View previous topic :: View next topic |
| Author |
Message |
zooz
Joined: 25 Mar 2007 Posts: 3 Location: Israel
|
Posted: Mon Oct 22, 2007 3:05 pm Post subject: How to tell _why_ Filecopy fails? |
|
|
Hi there,
I know that I can look at %errorlevel% after I use "Filecopy" to see if it succeeded or failed but I wanna know why it failed (so I can fix whats bothering it and try again).
Is there a way to do this?
P.S. same question goes to filemove as well. |
|
| Back to top |
|
 |
zooz
Joined: 25 Mar 2007 Posts: 3 Location: Israel
|
Posted: Thu Oct 25, 2007 10:45 am Post subject: Bumpy bump |
|
|
Anyone?
Please?
Even an authoritative "this can't be done with ahk" reply is good. At least I'll know I need to work on a workaround instead of keep trying.
If my question is missing details, just tell me - I'll happily add them.
(I'm sorry for bumping, I just really need it and I couldn't find answers elsewhere) |
|
| Back to top |
|
 |
Klaus
Joined: 12 May 2005 Posts: 205 Location: Münster, Germany
|
Posted: Thu Oct 25, 2007 10:59 am Post subject: |
|
|
hi, zooz,
I don't know about a "built-in reason-why", but in an equal situation I wrote a failure detection on my own.
Look whether a file with the same name already resides on the destination,
look whether there's enough space on the drive, try to store another small, not existing file on the destination, if it fails, you don't have the right and so on.
Hope I could help,
Klaus |
|
| Back to top |
|
 |
jsmain
Joined: 11 Jul 2005 Posts: 84
|
Posted: Thu Oct 25, 2007 11:17 am Post subject: |
|
|
I was really hoping to see a better responce to this myself.
I've been using filecopy to transfer and rename 150+
MB MPEG files from DVD to the HDD, and they do so, unless the file already exists at the destination, and even with an overwrite flag set, it appears to pass right over them. It's easy enough to see, as it takes a few seconds to copy that large a file, and only a moment to move on to the next track.
Personally, I may have to resort to deleting the file if it exists, but IMO, if it is to overwrite, it should be doing so, and I'd like a reason why it's not. _________________ Jeff Main |
|
| Back to top |
|
 |
Zippo(() Guest
|
Posted: Thu Oct 25, 2007 4:13 pm Post subject: |
|
|
I checked, and my version of AHK, FileCopy seems to clear the A_LastError variable.
So to stop that, you can call the OS CopyFile thru a DllCall and then check A_LastError to get an error code. You can then look that up on Google and figure out what happened to cause it to fail:
| Code: | DllCall("CopyFile", "Str", "SourcePathAndFile", "Str", "DestPathAndFile", Int, 0) ;Last parameter is over-write flag
MsgBox %A_LastError% |
Just a thought. |
|
| Back to top |
|
 |
jsmain
Joined: 11 Jul 2005 Posts: 84
|
Posted: Thu Oct 25, 2007 5:30 pm Post subject: |
|
|
Thanks! That was much more helpful!
System Error Codes _________________ Jeff Main |
|
| Back to top |
|
 |
zooz
Joined: 25 Mar 2007 Posts: 3 Location: Israel
|
Posted: Mon Oct 29, 2007 10:57 am Post subject: |
|
|
Thanks Zippo,
Looks promising, I'll definitely try. |
|
| Back to top |
|
 |
jsmain
Joined: 11 Jul 2005 Posts: 84
|
Posted: Mon Oct 29, 2007 11:13 am Post subject: |
|
|
Because of Zippo, I was able to determine that I wasn't able to over write because the file was read only. once I changed the attribute, I was able to over write it.
Thanks Zippo! _________________ Jeff Main |
|
| Back to top |
|
 |
WillisDave Guest
|
Posted: Wed Jul 23, 2008 3:35 pm Post subject: batsu |
|
|
Hi
Is there any reason why the ahk filecopy function will not work for jpegs?
thanks |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6847 Location: Pacific Northwest, US
|
Posted: Wed Jul 23, 2008 4:52 pm Post subject: |
|
|
no. it does not care about filetype _________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM |
|
| Back to top |
|
 |
|