Sign in to follow this  
Followers 0
ioliver

String Missing Closing Quotes

25 posts in this topic

$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

Share this post


Link to post
Share on other sites



$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

you're using the wrong comment character. VB coder? change your ' to a ;

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

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 $$.

Share this post


Link to post
Share on other sites

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.

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

#5 ·  Posted (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.

Ian

The 10 points are yours.

Edited by ioliver

"Blessed be the name of the Lord" - Job 1:21Check out Search IMF

Share this post


Link to post
Share on other sites

Thanks cameronsdad, I passed right over that one.

Ian

The 10 points are yours.

no problem, glad to help. 10 points eh? woohoo! :)

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

is that your only filewritelilne? there's nothing wrong with that one

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

I used to get this error a long time ago, I can't remember why... Your not using Beta are you?


[center]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.[/center]

Share this post


Link to post
Share on other sites

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

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

those look good, could you include a full listing of your code? also you may want to look at _FileWriteLog() to save yourself some typing

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

FileWriteLine may not like receiving your empty string. try changing it to " "

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

FileWriteLine($log, "If a file needs to be modified, the original should be modified.")

FileWriteLine($log, "")

FileWriteLine($log, $today & " " & $now)


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

I looked at _FileWriteLog()

Maybe I don't understand, but how is that different from FileWriteLine() ?

few ways

1) don't need to use fileopen() or fileclose()

2) it generates it's own timestamp instead of having to put one in manually


1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

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...

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

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)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0