AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

v1.0.48 released: Runs up to 3x as fast. Adds while-loop.
Goto page Previous  1, 2, 3  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Announcements
View previous topic :: View next topic  
Author Message
SamuelPlentz



Joined: 26 Jul 2006
Posts: 19

PostPosted: Sat Feb 28, 2009 11:58 pm    Post subject: Reply with quote

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
View user's profile Send private message
jaco0646



Joined: 07 Oct 2006
Posts: 3113
Location: MN, USA

PostPosted: Sun Mar 01, 2009 12:20 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10716

PostPosted: Sun Mar 01, 2009 1:32 am    Post subject: Reply with quote

It also seems difficult to support such a syntax due to its ambiguity with implicit (dotless) concatenation.
Back to top
View user's profile Send private message Send e-mail
SamuelPlentz



Joined: 26 Jul 2006
Posts: 19

PostPosted: Sun Mar 01, 2009 7:52 am    Post subject: Reply with quote

@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
View user's profile Send private message
fincs



Joined: 05 May 2007
Posts: 1163
Location: Seville, Spain

PostPosted: Sun Mar 01, 2009 10:28 am    Post subject: Reply with quote

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
View user's profile Send private message
SamuelPlentz



Joined: 26 Jul 2006
Posts: 19

PostPosted: Sun Mar 01, 2009 1:30 pm    Post subject: Reply with quote

Ok but why would this lead to ambiguity?
Can you give also an example for this?
_________________
http://www.familie-plentz.de
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10716

PostPosted: Sun Mar 01, 2009 2:56 pm    Post subject: Reply with quote

"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
View user's profile Send private message Send e-mail
SamuelPlentz



Joined: 26 Jul 2006
Posts: 19

PostPosted: Sun Mar 01, 2009 9:39 pm    Post subject: Reply with quote

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 Smile
_________________
http://www.familie-plentz.de
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10716

PostPosted: Mon Mar 02, 2009 4:26 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
ruespe



Joined: 17 Jun 2008
Posts: 243

PostPosted: Wed Mar 04, 2009 12:58 pm    Post subject: Reply with quote

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 Very Happy
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. Very Happy
_________________
Greetings
Rog
Back to top
View user's profile Send private message
halweg



Joined: 27 Jan 2005
Posts: 117
Location: Germany, Dresden

PostPosted: Thu Mar 26, 2009 8:02 am    Post subject: Reply with quote

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
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10716

PostPosted: Wed Apr 15, 2009 5:47 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
jenn
Guest





PostPosted: Fri Apr 17, 2009 9:45 am    Post subject: Reply with quote

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






PostPosted: Fri Apr 17, 2009 1:15 pm    Post subject: Reply with quote

A question. If i turn listlines off, is there any performance gain?
Back to top
Lexikos



Joined: 17 Oct 2006
Posts: 7299
Location: Australia

PostPosted: Fri Apr 17, 2009 2:05 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Announcements All times are GMT
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
You cannot post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group