For v1, I’ve often globally declared A_Quote. If I were still heavily writing in v1, I would appreciate standardizing it.
As we’re gravitating towards v2 and the focal of v1 development is bug fixes, it would be nice to have but I do not view it as necessary.
[v1/v2] Additional special character built-in variables
Re: [v1/v2] Additional special character built-in variables
You need something since just enabling %% in qouted strings would be a breaking change now. I just thought of python f-strings, hence the f.Why F?
_ is a valid variable name in AHK, you are free to do _ := '"' if you like.surprising that _ seems uncommon as standalone syntax character
Cheers.
Re: [v1/v2] Additional special character built-in variables
Personally I wouldn't use any of these if they were included. In v2 I don't see myself using A_Space nor A_Tab either since `s and `t exist.
Re: [v1/v2] Additional special character built-in variables
I see.
Yeah, I just meant that standalone _ is a good character for some built in use in AutoHotkey (it is prime real estate in keyboard city!). For now I'll define it for doublequote myself.
To everyone: Here are longer CLI examples to test if a doublequote variable can help readability. My eyes stumble on many adjacent ' and " in the current syntax. A_ variants solves that at the cost of less difference between text variable names and doublequote placeholders.
v2 current syntax:
Run('application.exe ' '"' FilePath '"' ' ' '"' parameter2 '"' ' ' '"' parameter3 '"' ' ' '"' parameter4 '"')
shorter:
Run('application.exe "' FilePath '" "' parameter2 '" "' parameter3 '" "' parameter4 '"')
variable candidates:
Run('application.exe ' A_Quote FilePath A_Quote ' ' A_Quote parameter2 A_Quote ' ' A_Quote parameter3 A_Quote ' ' A_Quote parameter4 A_Quote)
Run('application.exe ' A_DQ FilePath A_DQ ' ' A_DQ parameter2 A_DQ ' ' A_DQ parameter3 A_DQ ' ' A_DQ parameter4 A_DQ)
Run('application.exe ' A_Q FilePath A_Q ' ' A_Q parameter2 A_Q ' ' A_Q parameter3 A_Q ' ' A_Q parameter4 A_Q)
Run('application.exe ' _ FilePath _ ' ' _ parameter2 _ ' ' _ parameter3 _ ' ' _ parameter4 _)
To me _ wins at readability because it stands out from both ' and text variable names.
edit: adding kczx3's suggestion from next post, for comparison
Q := (a) => '"' a '"'
Run('application.exe ' Q(FilePath) ' ' Q(parameter2) ' ' Q(parameter3) ' ' Q(parameter4) )
Last edited by neogna2 on 11 Sep 2022, 07:39, edited 2 times in total.
Re: [v1/v2] Additional special character built-in variables
I’d probably either just use a helper function named quote/Q or rely on syntax highlighting of escaping a double quote in a double quoted string myself
Re: [v1/v2] Additional special character built-in variables
we can call dream of days past:
why was this removed again?
Code: Select all
Run('application.exe "%FilePath%" "%parameter2%" "%parameter3%" "%parameter4%"')