Jump to content

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

v1.0.46 released: SubStr() and more expression operators


  • Please log in to reply
63 replies to this topic
SamuelPlentz
  • Members
  • 19 posts
  • Last active: Oct 11 2011 11:25 PM
  • Joined: 26 Jul 2006

LV_ModifyCol(1,"60 Integer"), LV_ModifyCol(2,"60 Integer"), LV_ModifyCol(3,"36 Center")
LV_ModifyCol(4,"36 Integer"), LV_ModifyCol(4,"36 Center"),  LV_ModifyCol(6,"100")


There are 2 ModifyCols on column 4. One should be for column 5.

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005

There are 2 ModifyCols on column 4. One should be for column 5.


Thanks! :D
kWo4Lk1.png

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005
Dear Mr.Chris, :)

I never knew about ternary operator before it was included in AHK. I find it very useful and convenient.

Many thanks. :)
kWo4Lk1.png

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
NOTE: Although this release has been extensively tested, several low-level enhancements were made. If you have any mission-critical scripts, it is recommended that you retest them and/or wait a few weeks for any bugs to get fixed.

Here are the changes for v1.0.46.01:

Fixed comma-separated declaration initializers such as "local x = 1, y = 2" to work even when immediately below an if/else/loop statement.

Fixed comma-separated expressions so when the leftmost item is an assignment, it will occur before the others rather than after. [thanks Laszlo]

Changed and fixed function-calls so that any changes they make to dynamic variable names, environment variables, and built-in variables (such as Clipboard) are always visible to subsequent parts of the expression that called them.

Changed: When a multi-statement comma is followed immediately by a variable and an equal sign, that equal sign is automatically treated as a := assignment. For example, all of the following are assignments: x:=1, y=2, a=b=c

Changed comma-separated expressions to produce the following effects: 1) the leftmost /= operator becomes true divide rather than EnvDiv; 2) blank values are not treated as zero in math expressions (thus they yield blank results).

Improved the performance of expressions by 5 to 20% (depending on type).

Improved the new assignment operators such as .= to support the Clipboard variable (even in comma-separated expressions).

Improved the .= operator so that it doesn't require a space to its left.

Improved GUI controls to accept static variables as their associated variables (formerly only globals were allowed).

Added option HwndOutputVar to "Gui Add", which stores a control's HWND in OutputVar. [thanks Corrupt & Toralf]

toralf
  • Moderators
  • 4035 posts
  • Last active: Aug 20 2014 04:23 PM
  • Joined: 31 Jan 2005
Thanks a lot for the HwndOutputVar. It will help me a lot.
Ciao
toralf
 
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
You're welcome.

In today's v1.0.46.02, environment variables have been fixed to work properly as input variables in various commands such as StringLen and StringReplace (broken by 1.0.44.14). [thanks Camarade_Tux]

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
In today's v1.0.46.03, ListView's floating point sorting has been fixed to produce the correct ordering. [thanks oldbrother/Goyyah/Laszlo]

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005

ListView's floating point sorting has been fixed to produce the correct ordering.


Thanks for the wonderful support. :)
kWo4Lk1.png

BoBo
  • Guests
  • Last active:
  • Joined: --
Hi Skan (DeveloperFormerlyKnownAsGoyyah) :D

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
In v1.0.46.04, the inability to pass the result of an assignment (:=) to a ByRef parameter has been fixed. [thanks Titan]

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005
Nice.. Thanks Mr.Chris. :)

HexColorCode := toHex( [color=red]X := chr(127) chr(127) chr(127)[/color] )
MsgBox, % HexColorCode

toHex(ByRef b, l = 0) { ; Titan
   f := A_FormatInteger, p := &b - 1 
   SetFormat, Integer, h 
   Loop, % l ? l : VarSetCapacity(b) 
      h .= *++p ; unaries rox ur sox!! 
   SetFormat, Integer, %f% 
   Return, RegExReplace(RegExReplace(h, "0x(.)(?=0x|$)", "0$1"), "0x") 
} ; http://www.autohotkey.com/forum/viewtopic.php?p=97593#97593

kWo4Lk1.png

Laszlo
  • Moderators
  • 4713 posts
  • Last active: Mar 31 2012 03:17 AM
  • Joined: 14 Feb 2005
The above example does not work if the parameter is assigned a literal string, or an expression containing a literal string.
HexColorCode := toHex( X := " " )

AHK gives the following error:
---------------------------
xxx.ahk
---------------------------
Error: Caller must pass a variable to this ByRef parameter.

Specifically: X := " " )

Line#
003: SetBatchLines,-1
---> 005: HexColorCode := toHex( X := " " )
006: MsgBox,HexColorCode
008: {
009: f := A_FormatInteger, p := &b - 1
010: SetFormat,Integer,h
011: Loop,l ? l : VarSetCapacity(B)
012: h .= *++p
013: SetFormat,Integer,%f%

The program will exit.
---------------------------
OK
---------------------------

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
Thanks. I should probably just remove all the syntax checking for ByRef parameters. Without it, runtime errors will be displayed instead, which seems acceptable.

corrupt
  • Members
  • 2558 posts
  • Last active: Nov 01 2014 03:23 PM
  • Joined: 29 Dec 2004

Thanks a lot for the HwndOutputVar. It will help me a lot.

Yes, thanks Chris :) . That will come in very handy. Sorry for the delayed response - I haven't had much time available for coding lately :( .

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
Here are the changes for v1.0.46.05:

Fixed the Input command to allow named end keys like {F9} to work even when the shift key is being held down (broken by v1.0.45). [thanks Halweg]

Fixed inability of "Gui Show" to focus the GUI window when the tray menu is used both to reload the script and to show the GUI window. [thanks Rnon]

Fixed inability to pass some types of assignments (:=) to a ByRef parameter. [thanks Laszlo]