Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

v1.0.48 released: Runs up to 3x as fast. Adds while-loop.


  • Please log in to reply
39 replies to this topic
SamuelPlentz
  • Members
  • 19 posts
  • Last active: Oct 11 2011 11:25 PM
  • Joined: 26 Jul 2006
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:
Variable=Test
if(Variable=="Test") msgbox,Test
else msgbox,!Test

But I have to write:
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?

jaco0646
  • Moderators
  • 3165 posts
  • Last active: Apr 01 2014 01:46 AM
  • Joined: 07 Oct 2006
If you're just looking to save lines, it's even shorter with a ternary.
Variable=Test

MsgBox,% (Variable=="Test") ? "Test":"!Test"


Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
It also seems difficult to support such a syntax due to its ambiguity with implicit (dotless) concatenation.

SamuelPlentz
  • Members
  • 19 posts
  • Last active: Oct 11 2011 11:25 PM
  • Joined: 26 Jul 2006
@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.

fincs
  • Moderators
  • 1662 posts
  • Last active:
  • Joined: 05 May 2007

@Chris
Mh I don't get the point. What implicit (dotless) concatenation do you mean? Can you give an example?


He's referring to:

a := "Hello "
b := a "World"
MsgBox % b "!"


SamuelPlentz
  • Members
  • 19 posts
  • Last active: Oct 11 2011 11:25 PM
  • Joined: 26 Jul 2006
Ok but why would this lead to ambiguity?
Can you give also an example for this?

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
"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 <!-- w -->www.autohotkey.com/docs/Variables.htm#concat<!-- w -->

SamuelPlentz
  • Members
  • 19 posts
  • Last active: Oct 11 2011 11:25 PM
  • Joined: 26 Jul 2006
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 :)

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
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.

ruespe
  • Members
  • 567 posts
  • Last active: Dec 01 2014 07:59 PM
  • Joined: 17 Jun 2008
Thanks, thanks, thanks to chris and lexikos. It's fantastic.

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 :D

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

halweg
  • Members
  • 127 posts
  • Last active: Jul 06 2015 06:54 AM
  • Joined: 27 Jan 2005

I have one wish for a long time now. I also program in C++.
I would like to be able to write stuff like:

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

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
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]

jenn
  • Guests
  • Last active:
  • Joined: --

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.

  • Guests
  • Last active:
  • Joined: --
A question. If i turn listlines off, is there any performance gain?

Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006

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.

Source: AutoHotkey Forums: ListLines - turn off/on