Jump to content

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

AHKControl


  • Please log in to reply
65 replies to this topic
Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006
Press Win+Q to show:

(Image and links removed as they were hosted at the now defunct autohotkey.net)

Required:

ListIncludes.ahk (placed in function library)
Menu Icons v2
AutoHotkey v1.0 or v1.1 ANSI/Unicode 32-bit. 64-bit is not supported.

AHKControl.ahk
public domain

Options

Several options can be set at the top of AHKControl.ahk, including hotkeys and tray icon. See the comments in the script for more information. The default hotkeys are:

Win+Q: Opens the menu shown above.
Win+A: If the active window belongs to a script, a menu to control it is shown. If the active window's title matches PathRegEx, all matching scripts are listed. Otherwise, all scripts are listed.

Shift+click the Edit menu item to open the main script file in an editor rather than showing the list of #included files.

Icons

On Windows XP and Vista, an icon is shown for any script that has a tray icon. For other scripts and newer versions of Windows, each script can set its own icon either by sending a WM_SETICON message to its main window, or by handling WM_GETICON. For example, AHKControl uses the following two lines (script_id is equivalent to A_ScriptHwnd):
if this_icon := MI_ExtractIcon(IconFile, IconNumber, IconSize)
SendMessage 0x80, 0, this_icon,, ahk_id %this_id% [color=green]; WM_SETICON = 0x80[/color]


ahklerner
  • Members
  • 1386 posts
  • Last active: Oct 08 2014 10:29 AM
  • Joined: 26 Jun 2006
You got some good stuff, I hope you know that.
:D

ahklerner
  • Members
  • 1386 posts
  • Last active: Oct 08 2014 10:29 AM
  • Joined: 26 Jun 2006
I have 3 suggestions for you consider.
-Do not show menu items that are not available for that file. (I get a menu option to 'View Variables' for a compiled script that I have running, for example)
-Have a variable for a custom editor (for portability)
-Have a variable for a custom file manager.
Thanks for sharing another great script! :)
Posted Image
ʞɔпɟ əɥʇ ʇɐɥʍ

Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006

-Do not show menu items that are not available for that file. (I get a menu option to 'View Variables' for a compiled script that I have running, for example)

"View Variables" and similar can't simply be excluded for all compiled scripts, since they may have been enabled via:
Menu, Tray, MainWindow
It should be possible to detect this by checking if the relevant menu items are enabled in the script's main window's menus, but since I don't use compiled scripts, it didn't seem worth the effort.

-Have a variable for a custom editor (for portability)

Good idea. I have portable SciTE, but end up using Notepad. :lol:

-Have a variable for a custom file manager.

I'd have no need for the option, but I'll consider adding it when I get around to working on the script.

I actually didn't intend to release the script, but someone asked me to. (If I am the only user, it is easier to edit the script directly than to implement options.)

For now, the editor and file manager can be customized by editing the OpenIncludeFile and OpenScriptDir subroutines, respectively.

ManaUser
  • Members
  • 1121 posts
  • Last active: Dec 07 2016 04:24 PM
  • Joined: 24 May 2007
Thanks for sharing this. I thought it sounded handy too. And I see it works even for scripts that don't have tray icons. It will be especially useful in that case or any time I have several scripts open that all use the default tray icon.

Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006
Script updated:
[*:352flppb]Two options now appear at the top of the script: BrowseAction and EditAction.
[*:352flppb]The default BrowseAction selects the script rather than simply opening the folder as before.
[*:352flppb]Edit and View menu items are no longer shown for compiled scripts.
[*:352flppb]If a script has a tray icon, its tooltip is used as the menu item name.
[*:352flppb]Exiting AHKControl from the AHKControl.ahk submenu no longer shows a prompt. (Now that I think of it, exiting AHKControl accidentally is bothersome, so maybe it should prompt.)
[*:352flppb]Exiting from the main menu gives you the option to close all running scripts.

"View Variables" and similar can't simply be excluded for all compiled scripts, since they may have been enabled via:

Menu, Tray, MainWindow

Apparently no-one ever uses that, or they'd have noticed it doesn't actually enable the menu items!

automaticman
  • Members
  • 658 posts
  • Last active: Nov 20 2012 06:10 PM
  • Joined: 27 Oct 2006
Thanks lexiKos for sharing that, too! I'll try it in some hours, have to go right now. Also interesting would be to rewrite the menu with the new menu control here:
<!-- m -->http://www.autohotke...pic.php?t=17674<!-- m -->

Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006

Also interesting would be to rewrite the menu with the new menu control here:
<!-- m -->http://www.autohotke...pic.php?t=17674<!-- m -->

What would MMenu offer that the script doesn't already have?

automaticman
  • Members
  • 658 posts
  • Last active: Nov 20 2012 06:10 PM
  • Joined: 27 Oct 2006

What would MMenu offer that the script doesn't already have?

I don't know. I just thought I'll add the comment here to connect these two threads as there should be also a reason for MMenu. Maybe other MMenu users would know the difference?

automaticman
  • Members
  • 658 posts
  • Last active: Nov 20 2012 06:10 PM
  • Joined: 27 Oct 2006
lexiKos, AHKControl is great. It's menu system could be even nicely combined with nDroid, if nDroid should get more and more new Actions and Scans and other stuff also maybe.

automaticman
  • Members
  • 658 posts
  • Last active: Nov 20 2012 06:10 PM
  • Joined: 27 Oct 2006
What do you think of extending AHKControl with the following feature: Right now we can see for each running ahk-code among others it's hotkeys with "View Hotkeys" but we don't have the possibility to get a list of all hotkeys in all running ahk-codes. An option like "View Hotkeys of All running ahk-codes" would be useful or is there already a workaround which I've overlooked?

Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006

What do you think of extending AHKControl with the following feature:

It isn't a feature I would use.

Right now we can see for each running ahk-code among others it's hotkeys with "View Hotkeys"

...because the function is already there. AHKControl merely sends a message to the script in question.

automaticman
  • Members
  • 658 posts
  • Last active: Nov 20 2012 06:10 PM
  • Joined: 27 Oct 2006
Thanks for the clarifications.

engunneer
  • Moderators
  • 9162 posts
  • Last active: Sep 12 2014 10:36 PM
  • Joined: 30 Aug 2005

[*]Edit and View menu items are no longer shown for compiled scripts.


Perhaps an additional option: It could allow view and edit if the ahk file of the same name is in the same folder as the exe. This requires asking the process where it started from, but I think Skan wrote some code for that.

Cool script!

I should adapt it to start other scripts in a known location, like my old launcher script (that my wife still uses)

Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006

Perhaps an additional option: It could allow view and edit if the ahk file of the same name is in the same folder as the exe.

Good idea. (edit: "Edit", yes. "View" applies only to running scripts, and the associated features are normally disabled in compiled scripts.)

This requires asking the process where it started from,

Actually, the full path of the compiled script can be retrieved from the main window's title. The title is how I differentiate between compiled and uncompiled scripts. Compiled scripts also omit the " - AutoHotkey vVersionNumber" from the title.

I should adapt it to start other scripts in a known location,

I planned to add that months ago, but never did since I usually launch via the editor, ACConsole or quick launch (with Vista's Win+Num shortcuts.)

Ideally you could set the access key (&1. ScriptName -> Script&Name) for such scripts, whether they are running or not. This way you can interact with a given script without needing to know where it is in the menu.