MikeS Posted July 4, 2006 Share Posted July 4, 2006 Hello, I having trouble getting this code to work. It copies a txt file into a *.log file using the Datetime stamp. I'm just learning Autoit scripting and can not find which line of code is not right. so to save time, I was need some to look over this code and see if anything stands out, and then I can try it and see if it will run correctly. Thanks, Mike Dim $DateTime = @YEAR & "-" & @MON & "-" & @MDAY & "-" & @HOUR & "-" & @MIN & "_" & @SEC Dim $Location = @WorkingDir & '\\new\\' Dim $FileName = "all.txt" FileMove($Location & $FileName , $Location & $DateTime & ".log",1) sleep(4000) Run(@ComSpec & ' /k "del ..\\Password\\new\\*.txt"', @ScriptDir, @SW_HIDE) sleep(4000) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 4, 2006 Moderators Share Posted July 4, 2006 Hello,I having trouble getting this code to work. It copies a txt file into a *.log file using the Datetime stamp. I'm just learning Autoit scripting and can not find which line of code is not right. so to save time, I was need some to look over this code and see if anything stands out, and then I can try it and see if it will run correctly.Thanks,MikeDim $DateTime = @YEAR & "-" & @MON & "-" & @MDAY & "-" & @HOUR & "-" & @MIN & "_" & @SEC Dim $Location = @WorkingDir & '\\new\\' Dim $FileName = "all.txt" FileMove($Location & $FileName , $Location & $DateTime & ".log",1) sleep(4000) Run(@ComSpec & ' /k "del ..\\Password\\new\\*.txt"', @ScriptDir, @SW_HIDE) sleep(4000)I really don't know what your trying to do here... Could explain step by step what you would like to see happen? 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 More sharing options...
MikeS Posted July 5, 2006 Author Share Posted July 5, 2006 I really don't know what your trying to do here... Could explain step by step what you would like to see happen?Step 1. copy all.txt file from workingDir to \\newStep 2. move file to WorkingDir and rename it to DateTime.logStep 3. Delete the all.txt file from WorkingDirHope this helps, As I did not invent this, the person that did is not around, so I need to put the pieces together.Thanks, and if I can explain something in more detail or show you the complete script, I can do that. I just thought someone may see if the statements are even correctly written,Mike Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 5, 2006 Moderators Share Posted July 5, 2006 You could try this:Dim $DateTime = @YEAR & "-" & @MON & "-" & @MDAY & "-" & @HOUR & "-" & @MIN & "_" & @SEC Dim $Location = @WorkingDir & '\new\' Dim $FileName = "all.txt" If FileExists($Location & $FileName) Then FileMove($Location & $FileName , $Location & $DateTime & ".log",1) Sleep(4000) If FileExists($Location & $FileName) Then FileDelete($Location & $FileName) Sleep(4000) Else MsgBox(64, 'Info:', $Location & $FileName & ' Does not exist.') EndIf 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 More sharing options...
PsaltyDS Posted July 5, 2006 Share Posted July 5, 2006 Step 1. copy all.txt file from workingDir to \\newStep 2. move file to WorkingDir and rename it to DateTime.logStep 3. Delete the all.txt file from WorkingDirHope this helps, As I did not invent this, the person that did is not around, so I need to put the pieces together.Thanks, and if I can explain something in more detail or show you the complete script, I can do that. I just thought someone may see if the statements are even correctly written,MikeThe code SmOke_N gave you should work, yours appears to have been written in a context where the backslash "\" had to be escaped by another, giving "\\". That does not generate valid paths in AutoIT. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
MikeS Posted July 6, 2006 Author Share Posted July 6, 2006 Thanks SmOke_N, it did worked great. Thanks for taken time to help me with my FileMove problem. Mike 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