Jump to content

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

v1.0.41 released: Context-sensitive hotkeys & hotstrings


  • Please log in to reply
27 replies to this topic
Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
Here are the changes for v1.0.41:

Fixed "Transform HTML", which was broken by v1.0.40.02. [thanks Rabiator]

Improved syntax to support One True Brace (OTB) style with IFs, ELSEs, functions, and normal loops.

Added built-in variable A_AhkPath, which contains the full path and name of AutoHotkey.exe (if available).

Added directives #IfWinActive/Exist to enable selected hotkeys and hotstrings for only the windows you specify.

toralf
  • Moderators
  • 4035 posts
  • Last active: Aug 20 2014 04:23 PM
  • Joined: 31 Jan 2005
Thanks for the OTB, although it will require to change a lot in the Auto-Syntax-Tidy, I believe it is a good improvement.
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.

PhiLho
  • Moderators
  • 6850 posts
  • Last active: Jan 02 2012 10:09 PM
  • Joined: 27 Dec 2005
Yeah!
I don't care much for the OTB, as I don't use this style of coding, but it is nice for those which cannot live without it...

I eagerly awaited the context sensitive hotkeys.
Indeed, there was workarounds like:
$F9::
	appName = Create Folder
	WinGetClass winClass, A
	If winClass != ExploreWClass
	{
;		MsgBox 16, %appName%, Oops, wrong window...
		Send {F9}
		return
	}
but it wasn't very nice, adding a lot of code and not being very readable.
Your solution is nice, very well made (the idea of group of windows is excellent) and practical.

Congratulations, you are doing an excellent job on this software!

polyethene
  • Members
  • 5519 posts
  • Last active: May 17 2015 06:39 AM
  • Joined: 26 Oct 2012
The OTB feature adds greater flexibility to the way scripters can code which is terrific. The window-specific hotkeys are also a useful addon. Thanks Chris.

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
Thanks. The #IfWin feature isn't as useful as I'd originally envisioned because I ran into some roadblocks when trying to implement it (such as thread-safety in the hook thread).

Hopefully the feature will get improved to support %Var% in parameters. Eventually, it may also allow duplicate hotkey labels as Evl suggested at http://www.autohotke...opic.php?t=7485

Demokos
  • Members
  • 105 posts
  • Last active: Jan 20 2011 06:28 PM
  • Joined: 28 Dec 2005

Hopefully the feature will get improved to support %Var% in parameters.

I would like to see that. Thanks for this very usefull release.

BoBo
  • Guests
  • Last active:
  • Joined: --

Improved syntax to support One True Brace (OTB) style with IFs, ELSEs, functions, and normal loops.

Kinda coincidence :D. I had a look at Perl two days ago. To get into the right mood for that, I've checked a script of one of my colleagues and have seen that style of coding for the first time (well, I'm not a programmer :roll:). Whopeee, that means that I can use the same technique with AHK & Perl.

Thx. 8)

beardboy
  • Members
  • 443 posts
  • Last active: May 27 2017 08:41 AM
  • Joined: 02 Mar 2004
With the #IfWin directives, can ahk_id be added as a WinTitle option? The use will be rare, so only if it doesn't add a lot of code size or time to add.

thanks,
beardboy

evl
  • Members
  • 1237 posts
  • Last active: Oct 20 2010 11:41 AM
  • Joined: 24 Aug 2005
As beardboy said, it would be handy - it would also be more consistent with other commands. To be useful though, it would need to be able to accept variables for the ID (as Chris already mentioned might be added).

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
I believe ahk_id and ahk_pid are already supported. The only reason they're not mentioned is what Evl said: Without %Var% support, they would be useful only in unusual circumstances such as a script creating another script via FileAppend.

However, it might be of use that GroupAdd can add a series of ahk_id's or ahk_pid's to a group. You can then use that group with #IfWin. Also, you can keep adding more id's and pid's to such a group as long as you want -- and as long as the list doesn't get huge, performance shouldn't be affected much.

beardboy
  • Members
  • 443 posts
  • Last active: May 27 2017 08:41 AM
  • Joined: 02 Mar 2004
Chris, thanks for the work around solution.

thanks,
beardboy

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

Fixed AltGr hotkeys that send AltGr characters such as "<^>!a::Send \" in German. [thanks AGU]
Fixed Gui +Disable/AlwaysOnTop to work even if other options are present on the same line. [thanks evl]
Improved syntax to support having a command on the same line as an open-brace. [thanks segfault]

The tentative plan for the next major release is to support duplicate hotkeys and hotstrings for easier context sensitivity with the #IfWin directives.

polyethene
  • Members
  • 5519 posts
  • Last active: May 17 2015 06:39 AM
  • Joined: 26 Oct 2012

Improved syntax to support having a command on the same line as an open-brace. [thanks segfault]

Nice one however this does not apply to OTB. Is this intentional?

For example this works:
Loop, 3
{ MsgBox, %n%
	n += 10
}
But not this (OTB):
Loop, 3 { MsgBox, %n%
	n += 10
}

autohotkey.com/net Site Manager

 

Contact me by email (polyethene at autohotkey.net) or message tidbit


Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
Yes, it's intentional because the extra code size didn't seem justified given how rarely anyone would want to use such an ugly style :)

It is also documented on the Block page under the OTB section: "However, open-braces of the One True Brace style do not support commands to their right."

PhiLho
  • Moderators
  • 6850 posts
  • Last active: Jan 02 2012 10:09 PM
  • Joined: 27 Dec 2005
Well, I do find the first style (the one you just allowed) ugly too, perhaps that's why it is rarely used.
Ugly and impratical if you have to add a new command just before the first line of the block.
And with no clear advantage over the OTB style, ie. no gain of line. Well, at least, braces are aligned, I find this more readable than OTB.

But well, it is good to have flexibility and to please as much people as possible, as long this doesn't bloat the code. Which seems to be a true concern for Chris :-) I like that.