ioliver Posted April 5, 2006 Posted April 5, 2006 $log = FileOpen($destination & "Ian's Documents\_Backup.txt", 1) ' Open for Append When I try to run my script, I get an error message: String missing closing quotes, on the above line. What am I doing wrong? Thanks for your help, Ian "Blessed be the name of the Lord" - Job 1:21Check out Search IMF
seandisanti Posted April 5, 2006 Posted April 5, 2006 $log = FileOpen($destination & "Ian's Documents\_Backup.txt", 1) ' Open for Append When I try to run my script, I get an error message: String missing closing quotes, on the above line. What am I doing wrong? Thanks for your help, Ianyou're using the wrong comment character. VB coder? change your ' to a ;
inthewayboy Posted April 5, 2006 Posted April 5, 2006 I still suck at this part, but wouldn't you need to use two ' in the folder name? Using two of them should result in only one, at least that's how it works with other things like $$.
seandisanti Posted April 5, 2006 Posted April 5, 2006 I still suck at this part, but wouldn't you need to use two ' in the folder name? Using two of them should result in only one, at least that's how it works with other things like $$.it's not the folder name where the unterminated string is occuring, it's the comment after the function call. with autoit you're able to include a single quote within a literal string surrounded by double quotes (and vice versa) without needing an escape character.
ioliver Posted April 5, 2006 Author Posted April 5, 2006 (edited) it's not the folder name where the unterminated string is occuring, it's the comment after the function call. with autoit you're able to include a single quote within a literal string surrounded by double quotes (and vice versa) without needing an escape character.Thanks cameronsdad, I passed right over that one.IanThe 10 points are yours. Edited April 5, 2006 by ioliver "Blessed be the name of the Lord" - Job 1:21Check out Search IMF
seandisanti Posted April 5, 2006 Posted April 5, 2006 Thanks cameronsdad, I passed right over that one.IanThe 10 points are yours.no problem, glad to help. 10 points eh? woohoo!
ioliver Posted April 5, 2006 Author Posted April 5, 2006 Another 10 points on the board: How about this: $today = @YEAR & @MON & @MDAY $now = @HOUR & ":" & @MIN & ":" & @SEC FileWriteLine($log, $today & " " & $now) I get an error message, stating FileWriteLine to many paramaters. Any Idea? Thanks again, Ian "Blessed be the name of the Lord" - Job 1:21Check out Search IMF
seandisanti Posted April 5, 2006 Posted April 5, 2006 Another 10 points on the board: How about this: $today = @YEAR & @MON & @MDAY $now = @HOUR & ":" & @MIN & ":" & @SEC FileWriteLine($log, $today & " " & $now) I get an error message, stating FileWriteLine to many paramaters. Any Idea? Thanks again, Ianis that your only filewritelilne? there's nothing wrong with that one
Moderators SmOke_N Posted April 5, 2006 Moderators Posted April 5, 2006 I used to get this error a long time ago, I can't remember why... Your not using Beta are you? 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.
seandisanti Posted April 5, 2006 Posted April 5, 2006 I can't remember why...bad code? oh yeah sorry if my girl was bothering you yesterday smoke, she said she aim'd you from my laptop
ioliver Posted April 5, 2006 Author Posted April 5, 2006 is that your only filewritelilne? there's nothing wrong with that one There are these FileWriteLine's: $today = @YEAR & @MON & @MDAY $now = @HOUR & ":" & @MIN & ":" & @SEC If FileExists($destination & "\Ian''s Documents\_Backup.txt") Then $log = FileOpen($destination & "Ian's Documents\_Backup.txt", 1); Open for Append FileWriteLine($log, "") FileWriteLine($log, $today & " " & $now) FileWriteLine($log, "Note: ") Thanks again, Ian "Blessed be the name of the Lord" - Job 1:21Check out Search IMF
seandisanti Posted April 5, 2006 Posted April 5, 2006 There are these FileWriteLine's: $today = @YEAR & @MON & @MDAY $now = @HOUR & ":" & @MIN & ":" & @SEC If FileExists($destination & "\Ian''s Documents\_Backup.txt") Then $log = FileOpen($destination & "Ian's Documents\_Backup.txt", 1); Open for Append FileWriteLine($log, "") FileWriteLine($log, $today & " " & $now) FileWriteLine($log, "Note: ") Thanks again, Ianthose look good, could you include a full listing of your code? also you may want to look at _FileWriteLog() to save yourself some typing
ioliver Posted April 5, 2006 Author Posted April 5, 2006 Here's the script: ; This script will create a backup copy of the folder Ian's Documents $source = InputBox("Source", "Drive where the Ian's Documents folder is located:") $destination = InputBox("Destination", "Drive where the backup copy of Ian's Documents should be created:") RunWait(@ComSpec & ' /c xcopy "' & $source & '\Ian''s Documents" "' & $destination & '\Ian''s Documents" /E /I /H /-Y') $today = @YEAR & @MON & @MDAY $now = @HOUR & ":" & @MIN & ":" & @SEC If FileExists($destination & "\Ian''s Documents\_Backup.txt") Then $log = FileOpen($destination & "Ian's Documents\_Backup.txt", 1); Open for Append FileWriteLine($log, "") FileWriteLine($log, $today & " " & $now) FileWriteLine($log, "Note: ") Else $log = FileOpen($destination & "Ian's Documents\_Backup.txt", 2); Open for Write FileWriteLine($log, "The files in this directory are a backup.") FileWriteLine($log, "Do not make changes to the files in this directory.") FileWriteLine($log, "If a file needs to be modified, the original should be modified.") FileWriteLine($log, "" FileWriteLine($log, $today & " " & $now) FileWriteLine($log, "Note: ") EndIf FileClose($log) It's a lot of Copy & Paste, but I'll check in to _FileWriteLog(), I didn't know that existed. Thanks, Ian "Blessed be the name of the Lord" - Job 1:21Check out Search IMF
ioliver Posted April 5, 2006 Author Posted April 5, 2006 I looked at _FileWriteLog()_FileWriteLog( $sLogPath, $sLogMsg )Maybe I don't understand, but how is that different from FileWriteLine() ? "Blessed be the name of the Lord" - Job 1:21Check out Search IMF
seandisanti Posted April 5, 2006 Posted April 5, 2006 Here's the script: ; This script will create a backup copy of the folder Ian's Documents $source = InputBox("Source", "Drive where the Ian's Documents folder is located:") $destination = InputBox("Destination", "Drive where the backup copy of Ian's Documents should be created:") RunWait(@ComSpec & ' /c xcopy "' & $source & '\Ian''s Documents" "' & $destination & '\Ian''s Documents" /E /I /H /-Y') $today = @YEAR & @MON & @MDAY $now = @HOUR & ":" & @MIN & ":" & @SEC If FileExists($destination & "\Ian''s Documents\_Backup.txt") Then $log = FileOpen($destination & "Ian's Documents\_Backup.txt", 1); Open for Append FileWriteLine($log, "") FileWriteLine($log, $today & " " & $now) FileWriteLine($log, "Note: ") Else $log = FileOpen($destination & "Ian's Documents\_Backup.txt", 2); Open for Write FileWriteLine($log, "The files in this directory are a backup.") FileWriteLine($log, "Do not make changes to the files in this directory.") FileWriteLine($log, "If a file needs to be modified, the original should be modified.") FileWriteLine($log, "" FileWriteLine($log, $today & " " & $now) FileWriteLine($log, "Note: ") EndIf FileClose($log) It's a lot of Copy & Paste, but I'll check in to _FileWriteLog(), I didn't know that existed. Thanks, IanFileWriteLine may not like receiving your empty string. try changing it to " "
Developers Jos Posted April 5, 2006 Developers Posted April 5, 2006 FileWriteLine($log, "If a file needs to be modified, the original should be modified.") FileWriteLine($log, "") FileWriteLine($log, $today & " " & $now) SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
seandisanti Posted April 5, 2006 Posted April 5, 2006 I looked at _FileWriteLog()Maybe I don't understand, but how is that different from FileWriteLine() ?few ways1) don't need to use fileopen() or fileclose()2) it generates it's own timestamp instead of having to put one in manually
seandisanti Posted April 5, 2006 Posted April 5, 2006 FileWriteLine($log, "If a file needs to be modified, the original should be modified.") FileWriteLine($log, "") FileWriteLine($log, $today & " " & $now)good eye, i didn't see that and didn't tidy it either...
Developers Jos Posted April 5, 2006 Developers Posted April 5, 2006 good eye, i didn't see that and didn't tidy it either...nah... AU3Check: >Running AU3Check (1.54.1.1) params: from:C:\Program Files\AutoIt3\Beta C:\Development\winutil\AutoIt3\programs\test\test.au3(21,27) : ERROR: syntax error FileWriteLine($log, "" ~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Development\winutil\AutoIt3\programs\test\test.au3(22,44) : ERROR: FileWriteLine() [built-in] called with wrong number of args. FileWriteLine($log, $today & " " & $now) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
ioliver Posted April 5, 2006 Author Posted April 5, 2006 good eye, i didn't see that and didn't tidy it either...Thanks JdeB and cameronsdad, for the tips and explanations. That should take care of it.Thanks again,Ian "Blessed be the name of the Lord" - Job 1:21Check out Search IMF
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