theguy0000 Posted January 15, 2006 Share Posted January 15, 2006 #include <File.au3> Dim $file,$backupfile,$backupfilename,$trash For $i=1 To $CmdLine[0] $file = $file & " " & $CmdLine[$i] Next $file = StringTrimLeft ($file, 1) If $file = "" Then exit $path = _PathSplit ($file, $trash, $trash, $trash, $trash) $backupfile = _TempFile (@HomeDrive & "\BACKUP\", "", $path[4]) $filename = $path[3] & $path[4] If FileCopy ( $file, @TempDir & "\BACKUP\", 9 ) = 0 Then MsgBox (48, "AutoBackup File Backup Utility", "AutoBackup failed to copy "&$file&" to "&@TempDir & "\BACKUP\" & $filename&".") Exit EndIf $backupfilename = _PathSplit ($backupfile, $trash, $trash, $trash, $trash) $backupfilename = $backupfilename[3] & $backupfilename[4] If FileMove ( @TempDir & "\BACKUP\" & $filename, $backupfile ) = 0 Then MsgBox (48, "AutoBackup File Backup Utility", "AutoBackup failed to move " & @TempDir & "\BACKUP\" & $filename & " to "_ & $backupfile & ".") exit EndIf If IniWrite ( @HomeDrive & "\BACKUP\settings.ini", "Files", $backupfilename, $file ) = 0 Then MsgBox (48, "AutoBackup File Backup Utility", "AutoBackup could not write to the settings.ini file because it is read-only. Backup h_ as failed.") FileDelete ( $backupfile ) Exit EndIf MsgBox (64, "AutoBackup File Backup Utility", "AutoBackup has successfully added "&$filename&" to your weekly backup. Please note that _ the file has not actually been backed up yet, only added to your computer's backup directory. This file, along with the rest of your bac_ kup directory, will be backed up at the designated automatic backup day.") I run this program with the parameters: C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Blue hills.jpg and i get: What am I doing wrong? The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN Link to comment Share on other sites More sharing options...
w0uter Posted January 15, 2006 Share Posted January 15, 2006 try to use filegetshortpath or quote the filename. My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
theguy0000 Posted January 15, 2006 Author Share Posted January 15, 2006 #include <File.au3> Dim $file,$backupfile,$backupfilename,$trash For $i=1 To $CmdLine[0] $file = $file & " " & $CmdLine[$i] Next $file = FileGetShortName (StringTrimLeft ($file, 1)) If $file = "" Then exit $path = _PathSplit ($file, $trash, $trash, $trash, $trash) $backupfile = _TempFile (@HomeDrive & "\BACKUP\", "", $path[4]) $filename = $path[3] & $path[4] If FileCopy ( $file, @TempDir & "\BACKUP\", 9 ) = 0 Then MsgBox (48, "AutoBackup File Backup Utility", "AutoBackup failed to copy "&$file&" to "&@TempDir & "\BACKUP\" & $filename&".") Exit EndIf $backupfilename = _PathSplit ($backupfile, $trash, $trash, $trash, $trash) $backupfilename = $backupfilename[3] & $backupfilename[4] If FileMove ( @TempDir & "\BACKUP\" & $filename, $backupfile ) = 0 Then MsgBox (48, "AutoBackup File Backup Utility", "AutoBackup failed to move " & @TempDir & "\BACKUP\" & $filename & " to "_ & $backupfile & ".") exit EndIf If IniWrite ( @HomeDrive & "\BACKUP\settings.ini", "Files", $backupfilename, $file ) = 0 Then MsgBox (48, "AutoBackup File Backup Utility", "AutoBackup could not write to the settings.ini file because it is read-only. Backup h_ as failed.") FileDelete ( $backupfile ) Exit EndIf MsgBox (64, "AutoBackup File Backup Utility", "AutoBackup has successfully added "&$filename&" to your weekly backup. Please note that _ the file has not actually been backed up yet, only added to your computer's backup directory. This file, along with the rest of your bac_ kup directory, will be backed up at the designated automatic backup day.") still doesnt work The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN Link to comment Share on other sites More sharing options...
theguy0000 Posted January 15, 2006 Author Share Posted January 15, 2006 what am i doing wrong? The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 16, 2006 Moderators Share Posted January 16, 2006 (edited) Did you try to debug it? If FileExists((@TempDir & "\BACKUP\" & $filename) Then MsgBox(0, 'Exists', 'File does Exist') Else MsgBox(0, 'Does Not Exist', 'The File Does Not Exist') EndIf Put that before the filemove. Edited January 16, 2006 by SmOke_N 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...
theguy0000 Posted January 16, 2006 Author Share Posted January 16, 2006 hmm...the file doesnt exist...what could i be doing wrong that would not allow it to copy, and the copy error doesn't pop up... The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 16, 2006 Moderators Share Posted January 16, 2006 Put a msgbox in your loop: For $i=1 To $CmdLine[0] $file = $file & " " & $CmdLine[$i] MsgBox(0, 'Files', $file); watch this because you have no seperator here, and if you have more than one file, they are going to all be on one line. Next 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...
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