| View previous topic :: View next topic |
| Author |
Message |
SamuelPlentz
Joined: 26 Jul 2006 Posts: 19
|
Posted: Sat Feb 28, 2009 11:58 pm Post subject: |
|
|
Great release! Thanks.
I have one wish for a long time now. I also program in C++.
I would like to be able to write stuff like:
| Code: | Variable=Test
if(Variable=="Test") msgbox,Test
else msgbox,!Test |
But I have to write:
| Code: | Variable=Test
if(Variable=="Test")
msgbox,Test
else msgbox,!Test |
Wouldn't this be easy to change? You just have to count Braces and look for strings. Or am I wrong? _________________ http://www.familie-plentz.de |
|
| Back to top |
|
 |
jaco0646
Joined: 07 Oct 2006 Posts: 3113 Location: MN, USA
|
Posted: Sun Mar 01, 2009 12:20 am Post subject: |
|
|
If you're just looking to save lines, it's even shorter with a ternary. | Code: | Variable=Test
MsgBox,% (Variable=="Test") ? "Test":"!Test" |
|
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10716
|
Posted: Sun Mar 01, 2009 1:32 am Post subject: |
|
|
| It also seems difficult to support such a syntax due to its ambiguity with implicit (dotless) concatenation. |
|
| Back to top |
|
 |
SamuelPlentz
Joined: 26 Jul 2006 Posts: 19
|
Posted: Sun Mar 01, 2009 7:52 am Post subject: |
|
|
@Chris
Mh I don't get the point. What implicit (dotless) concatenation do you mean? Can you give an example?
@jaco0646
Thanks, I know this example could be made shorter. It was just an example. I also like the easy readability of ifs. _________________ http://www.familie-plentz.de |
|
| Back to top |
|
 |
fincs
Joined: 05 May 2007 Posts: 1163 Location: Seville, Spain
|
Posted: Sun Mar 01, 2009 10:28 am Post subject: |
|
|
| SamuelPlentz wrote: | @Chris
Mh I don't get the point. What implicit (dotless) concatenation do you mean? Can you give an example?
|
He's referring to:
| Code: | a := "Hello "
b := a "World"
MsgBox % b "!" |
_________________ fincs
Get SciTE4AutoHotkey v3.0.00 (Release Candidate)
[My project list] |
|
| Back to top |
|
 |
SamuelPlentz
Joined: 26 Jul 2006 Posts: 19
|
Posted: Sun Mar 01, 2009 1:30 pm Post subject: |
|
|
Ok but why would this lead to ambiguity?
Can you give also an example for this? _________________ http://www.familie-plentz.de |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10716
|
Posted: Sun Mar 01, 2009 2:56 pm Post subject: |
|
|
| "if (expression) something" is ambiguous because depending on how you look at it, "something" could either be concatenated onto "expression" or be the IF's action. There is more explanation of dotless concatenation at www.autohotkey.com/docs/Variables.htm#concat |
|
| Back to top |
|
 |
SamuelPlentz
Joined: 26 Jul 2006 Posts: 19
|
Posted: Sun Mar 01, 2009 9:39 pm Post subject: |
|
|
Now I understand the problem.
Would be nice if you could add braces to the exceptions of implicit (dotless) concatenation. As you have some exceptions for them right now. (+, ++, -, etc)
Please  _________________ http://www.familie-plentz.de |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10716
|
Posted: Mon Mar 02, 2009 4:26 pm Post subject: |
|
|
It is already documented than an open-brace may appear to the right of if (expression). The if-expression page says: Unlike an "else" statement -- which supports any type of statement immediately to its right -- an if-[expression]-statement supports only a "{" to its right.
In addition, braces are illegal in expressions; so the program should display an error dialog upon launch if you try to use braces in anything other than if-expression. |
|
| Back to top |
|
 |
ruespe
Joined: 17 Jun 2008 Posts: 243
|
Posted: Wed Mar 04, 2009 12:58 pm Post subject: |
|
|
Thanks, thanks, thanks to chris and lexikos. It's fantastic.
| Chris wrote: | | Krogdor wrote: | The only other thing from Lexikos' that I wish was in this one is the #If hotkey modifier, but it's still very nice to see an official update  | Hopefully that and some of the other features will be added in the next major release, or maybe a sooner, minor one. | ...and this would be even more fantastic. The earlier thew better. The #If-modifier is one of the most helpful things for me. And I like the idea, that you both work on the same AHK.  _________________ Greetings
Rog |
|
| Back to top |
|
 |
halweg
Joined: 27 Jan 2005 Posts: 117 Location: Germany, Dresden
|
Posted: Thu Mar 26, 2009 8:02 am Post subject: |
|
|
| SamuelPlentz wrote: | I have one wish for a long time now. I also program in C++.
I would like to be able to write stuff like:
| Code: | Variable=Test
if(Variable=="Test") msgbox,Test
else msgbox,!Test | Wouldn't this be easy to change? You just have to count Braces and look for strings. Or am I wrong? |
Concerning this, please Chris, never change AHK in a way so that | Code: | var=Test1
IFEQUAL, var,test1,SETENV, temp, % my_func1(my_parms)
ELSE IFEQUAL,var,test2,SETENV, temp, % my_func2(my_parms)
ELSE MSGBOX, !Test
| wouldn't work.
I like this "one line comparisons", they are the only way to easly and readable add conditional commands in a multi condition situation.
The SETENV is also important due to the possibility to add function calls on the same line. _________________
 |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10716
|
Posted: Wed Apr 15, 2009 5:47 pm Post subject: |
|
|
Here are the changes for v1.0.48.01:
Changed: For Windows Vista and later, hotkeys that include the Windows key (e.g. #a) will wait for LWin and RWin to be released before sending any text containing an "L" keystroke. This prevents such a hotkey from locking the PC. This behavior applies to all sending modes except SendPlay (which doesn't need it) and blind mode.
Fixed A_LoopFileExt to be blank for any filename having no extension but a period in its pathname. [thanks Yek-Toho-Tua].
Fixed the assignment of integers that are 19 or 20 characters long to work as they did prior to v1.0.48. [thanks Laszlo & Lexikos]
Fixed function definitions to work properly inside a block. [thanks rmarko]
Improved performance of A_Index in expressions by treating it as an integer rather than a string.
Improved performance of "if var [not] in/contains". [developed by Lexikos]
Improved ListLines with an option to turn line-logging Off or On. [thanks kenomby & ruespe] |
|
| Back to top |
|
 |
jenn Guest
|
Posted: Fri Apr 17, 2009 9:45 am Post subject: |
|
|
| Chris wrote: | Here are the changes for v1.0.48.01:
Improved ListLines with an option to turn line-logging Off or On. |
Hi, Chris
Thanks for adding ListLines On/Off Now, how about a "A_ListLines" variable?
I have started using ListLines On/Off in functions where I either want to see or not see the function lines. The obvious problem is that when exiting a function that uses this, there is no current way to know what the ListLines On/Off state was when entering the function. |
|
| Back to top |
|
 |
Guest
|
Posted: Fri Apr 17, 2009 1:15 pm Post subject: |
|
|
| A question. If i turn listlines off, is there any performance gain? |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 7299 Location: Australia
|
Posted: Fri Apr 17, 2009 2:05 pm Post subject: |
|
|
| Chris wrote: | Although the benchmarks of this version seem to be a few percent worse than the previous version, putting "ListLines Off" near the top of the script makes the benchmarks a few percent faster than the previous version. So maybe it balances out.
|
|
|
| Back to top |
|
 |
|