Jump to content

Is there a macro for quoting?


Recommended Posts

There are macros for $TAB, $LF and others but is there a builtin macro for the double-quote character? I can use Chr(34) with no problem, but using something like $QUOTE would be more intuitive perhaps.

Link to comment
Share on other sites

  • Moderators

Errr ... That really makes no sense, or maybe I'm just not understanding it...

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

There are macros for $TAB, $LF and others but is there a builtin macro for the double-quote character? I can use Chr(34) with no problem, but using something like $QUOTE would be more intuitive perhaps.

"this is a quote: ""."

'this is a quote: ".'

why would you need another way ?

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

Errr ... That really makes no sense, or maybe I'm just not understanding it...

For example, I want to quote a string for display purposes.

Something like Chr(34) & "C:\Temp" & Chr(34)

would display "C:\Temp" as opposed to the unquoted display C:\Temp.

Link to comment
Share on other sites

  • Moderators

For example, I want to quote a string for display purposes.

Something like Chr(34) & "C:\Temp" & Chr(34)

would display "C:\Temp" as opposed to the unquoted display C:\Temp.

Why not just type out "C:\Temp"? Less effort for sure...

And if your in a situation where you have to use something to create the quote... Chr(34) is just as easy as @Quote. I have run into situations where I have to do multiple Chr() rather than the string itself... but doesn't take any time... or do you just like the idea that you can type @Q and the option for @Quote would pop up in SciTe?

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

Why not just type out "C:\Temp"? Less effort for sure...

And if your in a situation where you have to use something to create the quote... Chr(34) is just as easy as @Quote. I have run into situations where I have to do multiple Chr() rather than the string itself... but doesn't take any time... or do you just like the idea that you can type @Q and the option for @Quote would pop up in SciTe?

I agree there are many stylistic preferences but """ is not so agreeable to the eye especially when printed. To me @QUOTE is easier to understand to some extent. @TAB is better than Chr(9) etc. :o

Link to comment
Share on other sites

  • Moderators

I agree there are many stylistic preferences but """ is not so agreeable to the eye especially when printed. To me @QUOTE is easier to understand to some extent. @TAB is better than Chr(9) etc. :o

Seems more of a Chat topic, It's an opinion at best.

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

I understand. I've sometimes wanted a macro for space!

I wonder if the main devs would go for someting like:

@SP - space

@SQ - single quote mark (apostrophe)

@DQ - double quote mark

Quotes might not be needed here, but I consider the first line the most readable....

$path = "C:\some long path\with spaces.txt"
Run("notepad.exe" & @SP & @DQ & $path & @DQ)

;versus
Run("notepad.exe " & """" $path & """")
;or
Run('notepad.exe "' & $path & '"')
;etc

Another example:

$exe = "C:\some buried executable\foo bar.exe"
$file = "C:\some long path\with spaces.txt"
Run($exe & @SP & @DQ & $file & @DQ)

;versus
Run($exe & " " & """" $file & """")
;or
Run($exe & ' "' $file & '"')
;etc
Edited by CyberSlug
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

  • Moderators

I understand. I've sometimes wanted a macro for space!

I wonder if the main devs would go for someting like:

@SP - space

@SQ - single quote mark (apostrophe)

@DQ - double quote mark

Quotes might not be needed here, but I consider the first line the most readable....

$path = "C:\some long path\with spaces.txt"
Run("notepad.exe" & @SP & @DQ & $path & @DQ)

;versus
Run("notepad.exe " & """" $path & """")
;or
Run('notepad.exe "' & $path & '"')
;etc

Another example:

$exe = "C:\some buried executable\foo bar.exe"
$file = "C:\some long path\with spaces.txt"
Run($exe & @SP & @DQ & $file & @DQ)

;versus
Run($exe & " " & """" $file & """")
;or
Run($exe & ' "' $file & '"')
;etc
Ahh, now that example makes sense.. but not using it to go like $Path = @DQ & C:\Something & @DQ Edited 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

  • Moderators

Why not, pray tell!

@DQ "Seems more of a Chat topic, It's an opinion at best." @DQ

:o

It's still an opnion at best...

You stated @Tab is better than Chr(9). That's a personal preference... therefore an opinion at best.

CyberSlug provided a reasonable explination on why this would be useful, and I provided why your example would not have been.

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

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...