AutoHotkey v2 removed commands.
AutoHotkey v2 removed commands.
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.
Re: AutoHotkey v2 removed commands.
Can you give examples?
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
Re: AutoHotkey v2 removed commands.
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
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.
Re: AutoHotkey v2 removed commands.
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)
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
Re: AutoHotkey v2 removed commands.
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.
Re: AutoHotkey v2 removed commands.
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)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)
but v2changes also says that contains and in are reserved, perhaps they will be built in operators, would be cool for between too
Re: AutoHotkey v2 removed commands.
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:
Is the code above valid code for AutoHotkey V2?
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
}
DRAKON-AutoHotkey: Visual programming for AutoHotkey.
Re: AutoHotkey v2 removed commands.
Of course. Perhaps you need to re-read the normal if-expression syntax docs: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?
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
No, you would need quotes around the function parameter, ie the filename, just like you would for any other function call.vasili111 wrote: For example:Is the code above valid code for AutoHotkey V2?Code: Select all
If (FileExist(test.ahk)) { ;do some code }
Re: AutoHotkey v2 removed commands.
They will, perhaps post-v2.0.guest3456 wrote:but v2changes also says that contains and in are reserved, perhaps they will be built in operators,
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.would be cool for between too
Some users have already tried to write code like this, either because it's intuitive, or because some other languages support it.
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 wrote:Progress
SplashImage
SplashTextOn/Off
Re: AutoHotkey v2 removed commands.
Thank you everyone for clarification. Now I understand the reasons for doing so and replacement for removed commands.
DRAKON-AutoHotkey: Visual programming for AutoHotkey.
Re: AutoHotkey v2 removed commands.
@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 wrote:
Re: AutoHotkey v2 removed commands.
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.
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.
Re: AutoHotkey v2 removed commands.
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.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.
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.
Re: AutoHotkey v2 removed commands.
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