AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to tell _why_ Filecopy fails?

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
zooz



Joined: 25 Mar 2007
Posts: 3
Location: Israel

PostPosted: Mon Oct 22, 2007 3:05 pm    Post subject: How to tell _why_ Filecopy fails? Reply with quote

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
View user's profile Send private message
zooz



Joined: 25 Mar 2007
Posts: 3
Location: Israel

PostPosted: Thu Oct 25, 2007 10:45 am    Post subject: Bumpy bump Reply with quote

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
View user's profile Send private message
Klaus



Joined: 12 May 2005
Posts: 205
Location: Münster, Germany

PostPosted: Thu Oct 25, 2007 10:59 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
jsmain



Joined: 11 Jul 2005
Posts: 84

PostPosted: Thu Oct 25, 2007 11:17 am    Post subject: Reply with quote

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
View user's profile Send private message
Zippo(()
Guest





PostPosted: Thu Oct 25, 2007 4:13 pm    Post subject: Reply with quote

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

PostPosted: Thu Oct 25, 2007 5:30 pm    Post subject: Reply with quote

Thanks! That was much more helpful!


System Error Codes
_________________
Jeff Main
Back to top
View user's profile Send private message
zooz



Joined: 25 Mar 2007
Posts: 3
Location: Israel

PostPosted: Mon Oct 29, 2007 10:57 am    Post subject: Reply with quote

Thanks Zippo,

Looks promising, I'll definitely try.
Back to top
View user's profile Send private message
jsmain



Joined: 11 Jul 2005
Posts: 84

PostPosted: Mon Oct 29, 2007 11:13 am    Post subject: Reply with quote

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
View user's profile Send private message
WillisDave
Guest





PostPosted: Wed Jul 23, 2008 3:35 pm    Post subject: batsu Reply with quote

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

PostPosted: Wed Jul 23, 2008 4:52 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group