AutoHotkey v2 removed commands.

Discuss the future of the AutoHotkey language
vasili111
Posts: 747
Joined: 21 Jan 2014, 02:04
Location: Georgia

AutoHotkey v2 removed commands.

05 Aug 2014, 02:42

In Changes from v1.1 to v2.0 I see that lots of commands have been removed. Some of them have in parenthesis the solution that can replace them. But there are some useful commands that does not have any indicated replacement. They are just removed with any replacement or the Changes from v1.1 to v2.0 needs to be updated?
DRAKON-AutoHotkey: Visual programming for AutoHotkey.
User avatar
jNizM
Posts: 3183
Joined: 30 Sep 2013, 01:33
Contact:

Re: AutoHotkey v2 removed commands.

05 Aug 2014, 02:46

Can you give examples?
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
vasili111
Posts: 747
Joined: 21 Jan 2014, 02:04
Location: Georgia

Re: AutoHotkey v2 removed commands.

05 Aug 2014, 03:17

I think all commands need some sort of clarification about why they are removed. But I am particularly interested in:

FileReadLine
IfXXX (IfMsgBox replaced with A_MsgBoxResult) - What about other IfXXX commands?
Progress
SplashImage
SplashTextOn/Off
StringGetPos - as far as I understand InStr can't specify right offset as StringGetPos.
StringLeft
StringLen
StringMid
StringRight
StringTrimLeft
StringTrimRight
DRAKON-AutoHotkey: Visual programming for AutoHotkey.
User avatar
jNizM
Posts: 3183
Joined: 30 Sep 2013, 01:33
Contact:

Re: AutoHotkey v2 removed commands.

05 Aug 2014, 03:23

FileReadLine ==> FileObject

IfExist ==> if FileExist()
IfNotExist ==> if !FileExist()

IfEqual ==> if (var = value)
IfNotEqual ==> if !(var = value) or if (var <> value)

IfGreater ==> if (var > value)
IfGreaterOrEqual ==> if (var >= value)

IfLess ==> if (var < value)
IfLessOrEqual ==> if (var <= value)

IfInString ==> if InStr()
IfNotInString ==> if !InStr()

IfWinActive ==> if WinActive()
IfWinNotActive ==> if !WinActive()

IfWinExist ==> if WinExist()
IfWinNotExist ==> if !WinExist()

if Var between LowerBound and UpperBound ==> if (var >= low) && (value <= high)
if Var not between LowerBound and UpperBound ==> if (var < low) || (var > high)

StringLen ==> StrLen()

StringCommands ==> SubStr() (eg String-Commands vs String-Functions)
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
Coco
Posts: 771
Joined: 29 Sep 2013, 20:37
Contact:

Re: AutoHotkey v2 removed commands.

05 Aug 2014, 06:25

vasili111 wrote:StringGetPos - as far as I understand InStr can't specify right offset as StringGetPos.
InStr() wrote:InStr: If StartingPos is negative, the search is conducted in reverse (right-to-left) beginning at that position counting from the right.
guest3456
Posts: 3454
Joined: 09 Oct 2013, 10:31

Re: AutoHotkey v2 removed commands.

05 Aug 2014, 13:00

jNizM wrote: if Var between LowerBound and UpperBound ==> if (var >= low) && (value <= high)
if Var not between LowerBound and UpperBound ==> if (var < low) || (var > high)
you could trivially write this, but in the \Lib\ subdirectory of the v2 distro, there is a between() wrapper function that can be used as a replacement: if between(var, low, high)

but v2changes also says that contains and in are reserved, perhaps they will be built in operators, would be cool for between too

vasili111
Posts: 747
Joined: 21 Jan 2014, 02:04
Location: Georgia

Re: AutoHotkey v2 removed commands.

05 Aug 2014, 13:43

jNizM
Coco
guest3456
Thank you.

Is it possible to include IfXXX commands that were made as functions FileExist(), !FileExist(), InStr(), !InStr(), WinActive(), !WinActive(), WinExist(), !WinExist() in parenthesis () in If statement? For example:

Code: Select all

If (FileExist(test.ahk))
{
      ;do some code
}
Is the code above valid code for AutoHotkey V2?
DRAKON-AutoHotkey: Visual programming for AutoHotkey.
guest3456
Posts: 3454
Joined: 09 Oct 2013, 10:31

Re: AutoHotkey v2 removed commands.

05 Aug 2014, 14:27

vasili111 wrote: Is it possible to include IfXXX commands that were made as functions FileExist(), !FileExist(), InStr(), !InStr(), WinActive(), !WinActive(), WinExist(), !WinExist() in parenthesis () in If statement?
Of course. Perhaps you need to re-read the normal if-expression syntax docs:
http://www.autohotkey.com/docs/commands ... ession.htm

Also, those commands weren't 'made' as functions. Those functions existed long ago in AHK Basic v1.0.48. Anything jNizM wrote, you could have done the same thing in AHK Basic, apart from the File Object and maybe StrLen().
http://www.autohotkey.com/docs/Functions.htm#BuiltIn
vasili111 wrote: For example:

Code: Select all

If (FileExist(test.ahk))
{
      ;do some code
}
Is the code above valid code for AutoHotkey V2?
No, you would need quotes around the function parameter, ie the filename, just like you would for any other function call.

lexikos
Posts: 9560
Joined: 30 Sep 2013, 04:07
Contact:

Re: AutoHotkey v2 removed commands.

06 Aug 2014, 01:54

guest3456 wrote:but v2changes also says that contains and in are reserved, perhaps they will be built in operators,
They will, perhaps post-v2.0.
would be cool for between too
x between y and z is a bit tricky to implement in expressions due to the alternative meaning assigned to and. Another option would be making y <= x <= z equivalent to y <= (_ := x) && _ <= z as a direct alternative to between..and, but also allowing other combinations like y < x < z or perhaps even an arbitrary sequence of comparisons like a > b <= c > d.

Some users have already tried to write code like this, either because it's intuitive, or because some other languages support it.
vasili111 wrote:Progress
SplashImage
SplashTextOn/Off
These were discussed some time ago. Basically, they can be reproduced fairly simply with the Gui commands, and allowing much more flexibility. If someone replicated them in script, they would be considered for inclusion in a standard library distributed with AutoHotkey. A side benefit of that approach is that users could learn some of the Gui API by looking at how those commands are implemented.
vasili111
Posts: 747
Joined: 21 Jan 2014, 02:04
Location: Georgia

Re: AutoHotkey v2 removed commands.

06 Aug 2014, 02:50

Thank you everyone for clarification. Now I understand the reasons for doing so and replacement for removed commands.
DRAKON-AutoHotkey: Visual programming for AutoHotkey.
pk23
Posts: 110
Joined: 24 Apr 2015, 00:49

Re: AutoHotkey v2 removed commands.

14 Apr 2017, 02:42

lexikos wrote: 
@lexikos IfWinExist, which has been removed in v2, is not listed in v2-changes, and should be listed, as a complete list of changes.
lexikos
Posts: 9560
Joined: 30 Sep 2013, 04:07
Contact:

Re: AutoHotkey v2 removed commands.

14 Apr 2017, 03:28

Can you guess what "IfXXX" means? It's in the list of removed commands.

v2-changes is not, will never be, and was never intended to be a complete list of changes (but it mostly only omits details like specific differences in error handling that were never documented). It's not even a formal part of the documentation.
pk23
Posts: 110
Joined: 24 Apr 2015, 00:49

Re: AutoHotkey v2 removed commands.

14 Apr 2017, 04:25

lexikos wrote:Can you guess what "IfXXX" means? It's in the list of removed commands.

v2-changes is not, will never be, and was never intended to be a complete list of changes (but it mostly only omits details like specific differences in error handling that were never documented). It's not even a formal part of the documentation.
Oh, it's in it. but this kind of XXX aren't easy to search, for those foreigner like me, who have no full-ablitity and time to read through v2-changes from start to end, I always search for it only when encounter the features v2 abandoned, such as I can search for `stringmid` to know it's replaced by `substr`, but when I find `ifwinexist` can not use, search `ifwinexist` in v2-changes have no luck. It's better for search to list them all.

Of course, this is just an immature suggestion. Accept it or not is up to our dear @lexikos.

In addition, I use complete, means in the TOC and summary level, of course not full details, that's the job of help.chm. Thanks for your job @lexikos. :)
lexikos
Posts: 9560
Joined: 30 Sep 2013, 04:07
Contact:

Re: AutoHotkey v2 removed commands.

14 Apr 2017, 19:17

By the way, I already clarified v2-changes shortly after I posted.

Return to “AutoHotkey Development”

Who is online

Users browsing this forum: No registered users and 32 guests