I completely agree with you...In your example there is a clear distinction between text and variables, as it should be.jNizM wrote:End of Commands and more Functions would be nice
From:To:Code: Select all
MsgBox % "Output: " VarOut MsgBox 64,, % "Output: " VarOut MsgBox 64, % "Title - " Name, % "Output: " VarOut
Code: Select all
MsgBox("Output: " VarOut) MsgBox(64,, "Output: " VarOut) MsgBox(64, "Title - " Name, "Output: " VarOut)
Command syntax - "This parameter can be an expression"
Re: Command syntax - "This parameter can be an expression"
Re: Command syntax - "This parameter can be an expression"
Code: Select all
MsgBox(64, "Title - " Name, "Output: " VarOut)
Re: Command syntax - "This parameter can be an expression"
Would not it be clearer, less confused and easier for new and beginner to learn and remember one thing like just the function syntax?
So how about remove the command syntax in v2? (e.g. MsgBox in v2)
I personal see no benefit for the command over the function syntax why we should have both.
*Sorry for my crap eng. It's hard for me to write what I think and mean.
So how about remove the command syntax in v2? (e.g. MsgBox in v2)
I personal see no benefit for the command over the function syntax why we should have both.
*Sorry for my crap eng. It's hard for me to write what I think and mean.
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
Re: Command syntax - "This parameter can be an expression"
It has been discussed already, no chance. Quite the contrary: "All functions can now be called as commands, including library functions which haven't been manually #included."
Re: Command syntax - "This parameter can be an expression"
This would mean beginners need to learn expressions first before using AutoHotkey which is confusing when you are not a programmer.jNizM wrote:Would not it be clearer, less confused and easier for new and beginner to learn and remember one thing like just the function syntax?
I personal see no benefit for the command over the function syntax why we should have both.
Imagine below simple script would go over 1000 lines, users would need to write around 7500 more characters, even with suggested additional Gui functions you would need to write 5750 additional characters, that is just crazy.
It is like in AutoIt where you have to write $ before every variable to indicate that it is a variable, having only functions would mean to move in same direction (writing hundreds of useless characters).
Code: Select all
; Command syntax 79 characters
Gui,Add,Text,w100,Test
Gui,Add,Edit,w100,Test
Gui,Add,Button,w100,Test
Gui,Show
; Function syntax 109 characters
Gui("Add","Text","w100","Test")
Gui("Add","Edit","w100","Test")
Gui("Add","Button","w100","Test")
Gui("Show")
; Even with your shorthand functions
; 75 characters
GuiAdd,Text,w100,Test
GuiAdd,Edit,w100,Test
GuiAdd,Button,w100,Test
GuiShow
; Function syntax 98 characters
GuiAdd("Text","w100","Test")
GuiAdd("Edit","w100","Test")
GuiAdd("Button","w100","Test")
GuiShow()
Re: Command syntax - "This parameter can be an expression"
Here is how learning the syntaxes occured to me:
AHK was the first programming language i learned and i clearly remember i grasped the way commands worked long before functions. However, most of the built-in functionality at the time was in fact based on command syntax, which means i HAD to grasp commands first, so i cannot really say that learning functions first would've been harder.
Also, even though i say i understood the way commands worked first, it actually took me much much longer to undestand it enougth to be able to easily figure out if a parameter needed expression syntax or not (i.e., even if a parameter was expecting a variable, i would still try enclosing it in percent signs first, which obviously resulted in no good).
So i guess that letting function syntax be the only syntax available seems to be the most reasonable idea for simplifying the syntax and avoiding newb confusion.
AHK was the first programming language i learned and i clearly remember i grasped the way commands worked long before functions. However, most of the built-in functionality at the time was in fact based on command syntax, which means i HAD to grasp commands first, so i cannot really say that learning functions first would've been harder.
Also, even though i say i understood the way commands worked first, it actually took me much much longer to undestand it enougth to be able to easily figure out if a parameter needed expression syntax or not (i.e., even if a parameter was expecting a variable, i would still try enclosing it in percent signs first, which obviously resulted in no good).
So i guess that letting function syntax be the only syntax available seems to be the most reasonable idea for simplifying the syntax and avoiding newb confusion.
"What is suitable automation? Whatever saves your day for the greater matters."
Barcoder - Create QR Codes and other Barcodes using only Autohotkey !!
Archmage Gray - A fantasy shooter game fully coded in AutoHotkey
Barcoder - Create QR Codes and other Barcodes using only Autohotkey !!
Archmage Gray - A fantasy shooter game fully coded in AutoHotkey
Return to “AutoHotkey Development”
Who is online
Users browsing this forum: No registered users and 104 guests