Sign in to follow this  
Followers 0
PitBullBlonde

Using the semicolon - not for comments

9 posts in this topic

I sure hope someone can help - I'm trying to append to a file, but the string I want to append has a semicolon in it - AutoIT help says that a semicolon within a string should be ok, but everything after the semicolon is still getting 'commented out'. I've been pulling my hair out trying different combinations of putting single and / or double quotes around it, without any luck. :ph34r: Here's what I want to append at the moment:

_FileAppend($HMpath & $FieldDescHTML, "<tr><td><a href='#' onclick="window.open('test.htm';">")

there may be other errors in this string now, with all the variations I've tried, using the quotes and double quotes, but the main thing is that I'm going to be using autoIT to create htm and hta files that have alot of semicolons as part of functions or script - How can I get autoIT to stop commenting out everything behind the semicolon?

Any and all information most appreciated!

Thanks!


Corey J. HarperCorey_Harper@HotMail.com

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I sure hope someone can help - I'm trying to append to a file, but the string I want to append has a semicolon in it - AutoIT help says that a semicolon within a string should be ok, but everything after the semicolon is still getting 'commented out'.  I've been pulling my hair out trying different combinations of putting single and / or double quotes around it, without any luck.   :ph34r: Here's what I want to append at the moment:

_FileAppend($HMpath & $FieldDescHTML, "<tr><td><a href='#' onclick="window.open('test.htm';">")

there may be other errors in this string now, with all the variations I've tried, using the quotes and double quotes, but the main thing is that I'm going to be using autoIT to create htm and hta files that have alot of semicolons as part of functions or script - How can I get autoIT to stop commenting out everything behind the semicolon?

Any and all information most appreciated! 

Thanks!

<{POST_SNAPBACK}>

Not sure about your syntax here but try this version:

_FileAppend($HMpath & $FieldDescHTML, '<tr><td><a href="#" onclick="window.open(test.htm)";>')

If its not correct then post the result you would like to see so we can code it properly...

Edited by JdeB

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

_FileAppend($HMpath & $FieldDescHTML, "<tr><td><a href='#' onclick="window.open('test.htm';">")

gray = quoted, green equals commented...

If you look at this in something like sciTE you'll see that the quotes are opening and closing as it goes...

replacing the double quotes on the outside was my first step to fixing this, second step is to double up the single quotes on the inside:

_FileAppend($HMpath & $FieldDescHTML, '<tr><td><a href=''#'' onclick="window.open(''test.htm'';">')

I believe that should do it. You might want to give SciTE a shot as an editor, it makes such things stick out very clearly...


"I'm not even supposed to be here today!" -Dante (Hicks)

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Have you tried running the code?

I'm pretty sure AutoIt will parse the code correctly.  SciTe, on the other hand, has a problem with nested quotes, and SciTe might color the code wrong....

<{POST_SNAPBACK}>

Cyberslug, are you sure that Scite doesn't correctly do syntax highlighting of nested quotes ? can you give an example of that ? Edited by JdeB

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

#6 ·  Posted (edited)

Have you tried running the code?

I'm pretty sure AutoIt will parse the code correctly.  SciTe, on the other hand, has a problem with nested quotes, and SciTe might color the code wrong....

<{POST_SNAPBACK}>

It seems to me that SciTe highlights correctly. The code is not correct. Try au3check on it :( Correct code is:
_FileAppend($HMpath & $FieldDescHTML, "<tr><td><a href='#' onclick=""window.open('test.htm';"">")
or
_FileAppend($HMpath & $FieldDescHTML, '<tr><td><a href=''#'' onclick="window.open(''test.htm'';">')

BTW: is the generated HTML code correct? I think the "window.open(.." will be missing a closing brace :ph34r:

Edited by tylo

blub

Share this post


Link to post
Share on other sites

Cyberslug, are you sure that Scite doesn't correctly do syntax highlighting of nested quotes ? can you give an example of that ?

<{POST_SNAPBACK}>

Well, I didn't try running any test code :ph34r: I thought there had been a problem at one point, but everything looks okay now. :">

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

Well, I didn't try running any test code :ph34r:  I thought there had been a problem at one point, but everything looks okay now.  :">

<{POST_SNAPBACK}>

heh. neither did I... just call me lazy I guess...

"I'm not even supposed to be here today!" -Dante (Hicks)

Share this post


Link to post
Share on other sites

Well, I didn't try running any test code :(  I thought there had been a problem at one point, but everything looks okay now.  :">

<{POST_SNAPBACK}>

:ph34r: Ok... i was getting worried here .....

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

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