copyleft Posted July 31, 2006 Share Posted July 31, 2006 Here's the broken code so far: $Bak = (@YEAR & "-" & @MON & "-" & @MDAY) If FileExists ("G:\IMAGE\TEST2.IMG" ) Then FileMove("G:\Backup\" & $Bak) Exit(0) EndIf Produces the error code: "Incorrect number of parameters in function call." Link to comment Share on other sites More sharing options...
dlp Posted July 31, 2006 Share Posted July 31, 2006 (edited) You have no source. See this:http://www.autoitscript.com/autoit3/docs/f...ns/FileMove.htm Edited July 31, 2006 by dlp Link to comment Share on other sites More sharing options...
copyleft Posted July 31, 2006 Author Share Posted July 31, 2006 This one won't work either. (comma in the wrong place?) $Bak = (@YEAR & "-" & @MON & "-" & @MDAY) If FileExists ("G:\IMAGE\TEST2.IMG" ) Then FileMove("G:\IMAGE\TEST2.IMG", "G:\Backup\" & $Bak) Exit(0) EndIf Link to comment Share on other sites More sharing options...
dlp Posted July 31, 2006 Share Posted July 31, 2006 (edited) Are you sure that's exactly what you have? I made a little test with this code (tried to be exactly like yours): $Bak = ( @YEAR & "-" & @MON & "-" & @MDAY ) If FileExists( "C:\name.txt" ) Then FileMove( "C:\name.txt", "C:\" & $Bak ) Exit(0) EndIf and it works fine. Notice though (not that this is the problem) that you're cutting the extension off the name of the file, which may screw up any attempts to open it later. Anyway try copying and pasting that, if it doesn't work, try reinstalling AutoIT. Edited July 31, 2006 by dlp Link to comment Share on other sites More sharing options...
/dev/null Posted July 31, 2006 Share Posted July 31, 2006 This one won't work either. (comma in the wrong place?)$Bak = (@YEAR & "-" & @MON & "-" & @MDAY)If FileExists ("G:\IMAGE\TEST2.IMG" ) ThenFileMove("G:\IMAGE\TEST2.IMG", "G:\Backup\" & $Bak)Exit(0)EndIfand the question is ... What exactly does not work? Choose between:the backup file gets the wrong namethe backup directory does not existI can't view the backup image with my preferred image viewermy computer crashedthe whole internet crashed for 5 seconds when I started the script (sorry for that !!)CheersKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
sshrum Posted July 31, 2006 Share Posted July 31, 2006 (edited) Check out my batch file renamer...written in AutoIT (source available as well)Home: http://www.shrum.net/code/renamerBinary: http://www.shrum.net/code/renamer/binHelp : http://www.shrum.net/code/renamer/helpSource: http://www.shrum.net/code/renamer/sourceAllows for a token-based name with date and time elements. Edited July 31, 2006 by sshrum Sean Shrum :: http://www.shrum.net All my published AU3-based apps and utilities 'Make it idiot-proof, and someone will make a better idiot' Link to comment Share on other sites More sharing options...
pecloe Posted July 31, 2006 Share Posted July 31, 2006 I think you need the extension $Bak & ".IMG" Link to comment Share on other sites More sharing options...
copyleft Posted August 26, 2006 Author Share Posted August 26, 2006 (edited) I got this licked finally. The reason this worked for dlp and not me is because he wasn't renaming the file in a directory but in the root of his drive. The renaming will fail if you include a directory and don't create it (stupid me). Also, I had to put the extension in the $Bak declaration line not in the filemove line. So here's the working code for anyone that may find it useful: $Bak1 = (@YEAR & "-" & @MON & "-" & @MDAY & "XP.IMG") $Bak2 = (@YEAR & "-" & @MON & "-" & @MDAY & "2K.IMG") If FileExists("D:\Image") Then MsgBox(65, "Imaging", "Standby While We Image Your Drives", 5) Else DirCreate("D:\Image") MsgBox(65, "Imaging", "Standby While We Image Your Drives", 5) EndIf RunWait ("program.exe D:\IMAGE\TEST2.IMG") WinWaitNotActive("Program Window Title") RunWait ("program.exe D:\IMAGE\TEST1.IMG") WinWaitNotActive("Program Window Title") If FileExists ("D:\IMAGE\TEST2.IMG" ) Then FileMove("D:\IMAGE\TEST2.IMG", "D:\Image\" & $Bak1) ; Exit(0) EndIf Sleep(1000) If FileExists ("D:\IMAGE\TEST1.IMG" ) Then FileMove("D:\IMAGE\TEST1.IMG", "D:\Image\" & $Bak2) ; Exit(0) EndIf ; still can't figure out code to kill out renamed files older than 10 days so I call a visual basic substitute to kill them off RunWait(@ComSpec & " /c " & 'delimg.vbs', "", @SW_HIDE) Exit (0) Edited August 26, 2006 by copyleft 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