AutoHotkey Community

It is currently May 26th, 2012, 3:55 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: March 31st, 2009, 9:48 am 
Offline

Joined: August 4th, 2008, 1:41 pm
Posts: 14
Just 4 wishes from me.

If we had the first 2, then we'd have a much more standard syntax.
I've programmed in all the popular languages & gotten used to them - but after a year I still can't get a handle on how AutoHotkey deals with variables - when the % is used & when not.
When I pass Transparent to WinSet, is Transparent a keyword - or a string parameter?
And sometimes when I think I've got it - a DllCall will only work with the opposite!
I know there are guys on this forum who understand & in time so will I - but in my opinion, it's just not intuitive.

1) Commands as Functions - Keep the commands for backwards compatibility, but also have a function equivalent. I want to be able to use MsgBox(...) or WinActivate(...)
As a side note, perhaps the pre-processor directives could also take the same form so we'd write #EscapeChar(NewChar), #SingleInstance(Value)

2) Explicit Strings - Use double quotes like other languages to define a string. Implicit strings are a very small feature that totally confuse the syntax of AutoHotkey.
Remove implicit strings & we can get rid of all those % signs since the compiler can tell the difference between a string in quotes "..." & a variable.
Again for backwards compatibility, this can be something like #ExplicitStrings(1) to turn this mode on. Perhaps in a few years this would become the default.
We can use % at the start of the expression but it just looks cumbersome.


3) Hotkeys that consume or pass-thru keys at run time.
Currently we can pass-thru a hotkey with the ~ operator, or consume it by leaving that out.
It would be very useful if the hotkey subroutine itself could decide whether to consume or pass-thru the hotkey, rather than having 2 make a choice before hand.
This would be like a hook function.
Current context sensitive hotkeys sometimes fall short.
Sometimes I may want to let all MouseClick pass-thru but consume them when they are over a Minimize button so I can minimize to the systray.

You could capture all clicks & use Send to push out a click, but some programs don't behave - like those that use the button to initiate a drag rather than a click.

This last 1 is more nice to have than anything. They can be done already but is a bit cumbersome with a timer. And the other problem is you can't consume the event to prevent the default processing.
4) MouseMove as a hotkey - In other words, receive events only when the user moves the mouse.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 31st, 2009, 2:09 pm 
If you want a more strict basicish language, try AutoIt instead...

AutoHotkey was meant to "save keystrokes/typing" while scripting. Sure, might be confusing, but gives us more speed...


Report this post
Top
  
Reply with quote  
PostPosted: March 31st, 2009, 3:04 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
robertdeniro wrote:
When I pass Transparent to WinSet, is Transparent a keyword - or a string parameter?
It is a string parameter. WinSet then compares that string against several keywords.
Quote:
And sometimes when I think I've got it - a DllCall will only work with the opposite!
DllCall and all other functions() use expression rules, commands do not (except in numeric parameters).
Quote:
1) Commands as Functions
Already done: Titan's Command Functions.
Quote:
As a side note, perhaps the pre-processor directives could also take the same form so we'd write #EscapeChar(NewChar), #SingleInstance(Value)
That is an interesting point which I had not considered. However, it would not be feasible (or practical) to support proper expression syntax in directives.
Quote:
2) Explicit Strings - Use double quotes like other languages to define a string.
It is possible to avoid "implicit string syntax" in most cases:
Quote:
Source: AutoHotkey Documentation: Variables and Expressions
Force an expression: An expression can be used in a parameter that does not directly support it (except an OutputVar or InputVar parameter such as those of StringLen) by preceding the expression with a percent sign and a space or tab. This technique is often used to access arrays. For example:
Code:
FileAppend, % MyArray%i%, My File.txt
MsgBox % "The variable MyVar contains " . MyVar . "."
Loop % Iterations + 1
WinSet, Transparent, % X + 100
Control, Choose, % CurrentSelection - 1

Quote:
It would be very useful if the hotkey subroutine itself could decide whether to consume or pass-thru the hotkey, rather than having 2 make a choice before hand.
This would be like a hook function.
This can be done with an actual hook function or AutoHotkey_L's #if. As with #IfWin, it requires the hotkey to be implemented using a system-wide keyboard hook. It would not be practical to allow this feature for all hotkeys, since scripts are relatively slow and likely to introduce system-wide input lag due to the nature of the keyboard hook. If a script goes awry, it can make the PC unusable (though in most configurations only for a few seconds).
Quote:
4) MouseMove as a hotkey - In other words, receive events only when the user moves the mouse.
The use of a mouse hook to detect mouse movement has been demonstrated on the forums.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 1st, 2009, 12:06 pm 
Offline

Joined: August 4th, 2008, 1:41 pm
Posts: 14
I tried AutoIt & love the syntax but without hotkey support for the mouse, I abandoned it.
As for speed in typing, like I said, leave the current syntax of implicit strings without quotes as is, but just add the ability to turn on expressions - the best of both.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 1st, 2009, 12:47 pm 
Offline

Joined: August 4th, 2008, 1:41 pm
Posts: 14
I downloaded Titan's functions a few days ago & will give them a shot.
Lexikos I also downloaded yr build of AutoHotkey. I will investigate that #if command. Thanks.

I'd still luv something switch to turn on expressions by default! :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject: I agree.
PostPosted: April 10th, 2009, 3:36 am 
Offline

Joined: August 25th, 2005, 9:40 pm
Posts: 129
The syntax is a serious drawback. there needs to be a clear consistent use of quoted strings.
________
Coach Handbags


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group