## IDEA| AutoHotkeyP - develop the next generation of hotkeys

Discuss other useful utilities, general computing tips & tricks, Internet resources, etc.
Stamimail
Posts: 77
Joined: 06 Nov 2014, 08:48

### IDEA| AutoHotkeyP - develop the next generation of hotkeys

This idea is for the smarter guys here, the Professionals.
It may require some patience and learning to take the world a big step forward...

I had a short conversation by email with Charlie Simmons, the webmaster, where I introduced the idea:

======== Forwarded conversation ========

Subject: My Dream - How to make the Hotkey power available for the Simple Users

------------------------
From: <stamimail>
Date: 2014-10-07 1:55 GMT+03:00
To: <support.at.ahkscript.org>

Hello AutoHotkey,

Everyone knows that AutoHotkey is a kind of scripting language, requires a lot of time learning, to get the wonderful Hotkey power.

Has anyone from the managers/administrators, is very familiar with the software HotkeyP?
http://sourceforge.net/projects/hotkeyp/

IMHO, HotkeyP is the best freeware for Hotkeys Category. It lets the users to use a GUI to set Keyboard and Mouse Hotkeys, to execute huge variety of useful actions/commands. Elegant and easy.

The problem with HotkeyP is the slow development (Since only one programmer is developing new commands).

My Dream:

Here comes the place of AutoHotkey. Since AutoHotkey it is a kind of scripting language, in open-source and popular, It can help to produce a huge variety of new commands. A library of commands. (Categorized...)
Simple users (without scripting knowledge) will be able to download their favorite commands had produced by AutoHotkey community, and to use them in a GUI like HotkeyP.

Someone must read the whole Help File of HotkeyP to understand the GUI idea and the principles of its implementation, to understand what I'm talking about.

In summary, A kind of marriage between AutoHotkey and HotkeyP...

Regards,
Stamimail

----------
From: <stamimail>
Date: 2014-10-17 3:14 GMT+03:00
To: <support.at.ahkscript.org>

Did you get my Email? I did not get an answer.
Stamimail

----------
From: ahkscripts <charlie simmons>
Date: 2014-10-17 20:16 GMT+03:00
To: <stamimail>

If there is a proposal I think I missed it.
You mentioned an Idea, but not what you might need me to do?
Perhaps this might be posted within the forum itself and you can see whom if any can better catch your intent

----------
From: <stamimail>
Date: 2014-10-26 1:09 GMT+03:00
To: ahkscripts <charlie simmons>
Cc: support <support.at.ahkscript.org>

Hi Charlie, and thank you for the reply.

I was not sure if my request was suitable for publication in a Forum, And anyway, You did not direct me to the right place to post it...

My wish was for a manager/administrator to examine my request to develop a New Project, a GUI for AutoHotkey. The GUI is intended to give the power of AutoHotkey to the all kinds of users rather than the Power Users who have learned the AutoHotkey script language.

It is necessary, that someone who has a close familiarity with a software like HotkeyP and knows its Power, would consider this request and take the decision .

Therefore I wrote:

Someone must read the whole Help File of HotkeyP to understand the GUI idea and the principles of its implementation, to understand what I'm talking about.

I would happy to hear from you, no matter what the decision will be.

Thank You,
Stamimail

----------
From: ahkscripts <charlie simmons>
Date: 2014-10-26 20:46 GMT+02:00
To: <stamimail>

This community is open source which means anyone could take up such a project. the best way to find out if ANYone is familiar with HotkeyP is to post in the forum. None of our staff is paid. we are all volunteer participants. You are free to post in the Ask For Help forum or Other Utilities & Resources to see if someone wants to work on tying the 2 applications together. My role specifically is to provide a web site and server. And support the content that the community at large wants. The current branch of AutoHotkey is the work of a member. but there are other branches as well. I would be happy to offer a supportive stance on the subject but this action would need to be carried out by yourself within the forum or be aided byt members of the community from within the forum. Even developments to the site itself are worked out in open discussions on the forum not by 2 people over email.
Please post your idea and request for help within the forum and see if the community bites and wants to work towards this.

======== End of Forwarded conversation ========

As you see, the idea is how the Professionals (=Developers) can help Power Users (AHK Community) to help Simple Users (=Everyone). Expanding the community, so that Everyone could enjoy the power of hotkeys.

The new project will give the Power Users (AHK Community) the ability to adjust their scripts to be used in a GUI. Instead of create scripts/commands to individuals, they will be able to share their useful works with the wide world (=Everyone). The GUI is actually intended for the Simple Users, But it is reasonable that Power Users will find it useful as well. Website moderators will create an Online Library of Commands and manage what to include in and where (in which Category/SubCategory...). Common commands can be installed in the first installation of the software. Then, the users will be able to download and add commands from the Online Library as much as they want.

As you will see, the GUI method has become, relatively speaking, very advanced with HotkeyP (Parameters, Macro, Multi command, Commands list, etc...). It's important to become familiar and understand, What are AutoHotkey advantages and what are HotkeyP advantages, to examine whether and how to join their advantages together.

1. GUI will be look similar to HotkeyP GUI (OK, might be improved), and will have the ability to run commands and parameters based on AHK language. I'm not sure, but maybe HotkeyP is a good place to start with, The GUI is already there. The hard work is to arrange, how HotkeyP and AHK users will communicate together.
2. Yes, you are right. Help/Description of each command should be in the GUI itself, and not (only) in Help File. More than that, I think it's very important to add examples to each command. This is one of the disadvantages of HotkeyP, what you need to read and find simple info in Help file.
3. I believe there will be always those 2 kinds of users: Power Users and Simple Users. Without a doubt, as more you have programming knowledge you have more power, but not everyone has the time or the talent or likes it.
4. I'm a Simple User...

That's it. Thank you for reading. I hope it was well explained.
You might want to download and play with HotkeyP a little to get a better look at it.
For your convenience, I've added here the help file, but a little bit shortened. I omitted what I thought it less important for understanding HotkeyP and the GUI principle.
Go for it!
Stamimail

HotkeyP Help File
Syntaxerror

### Re: IDEA| AutoHotkeyP - develop the next generation of hotke

Hello Stamimail,

You may remember me from the IRC-Channels #ahk and #ahkscript.

Regards,
Syntaxerror
Coco
Posts: 771
Joined: 29 Sep 2013, 20:37
GitHub: cocobelgica

### Re: IDEA| AutoHotkeyP - develop the next generation of hotke

Perhaps design an API and make/use AutoHotkey as the scripting language to extend HotkeyP via plugins(AHK script) - similar to how text editors can be extended e.g. (Scite4AutoHotkey - AutoHotkey, Sublime Text - Python, Atom - CoffeeScript/JavaScript(not really sure), Emacs - Emacs Lisp). In that way it'll be easier for AHK user(s) to write plugins for HotKeyP. HotkeyP users can just then dump these plugins in a directory (e.g.:HotkeyP\Commands) and then they'll be loaded automatically and will be available from the GUI as HotKeyP "commands". Communication can be achieved via a DLL, custom window message(s), or COM. To separate/keep the lower level stuff, a HotKeyP lib can be written(in AutoHotkey) and plugin developers can just #Include it in their AHK plugin scripts.

A plugin script can look like this:

Code: Select all

/* Let's assume that HotkeyP.ahk handles all the communication
* between HotkeyP and AutoHotkey (e.g.: DllCalls, COM, SendMessage).
* It can be shipped with HotkeyP. Plugin devs can just #Include it
* it in their script to access the API
*/
#Include %A_LineFile%\..\HotkeyP.ahk

/* On load, 'MyCustomCommand' will be available as command from the
* GUI. When the assigned hotkey(s) are fired, its Run() method is
* called. Event handling can also be implemented. Another option is
* for plugins to have some sort of JSON manifest file which can contain
* some info like (documenation, default icon, working dir, etc.)
*/
class MyCustomCommand extends HotkeyP
{
Run(args*) ;// this method is called when the user fires the hotkey
{
;// some code here
base.SomeAPI_Method_In_HotkeyP_AHK() ;// call API method
base.SetIcon(id, icon) ;// example method to set the icon in the GUI for a particular entry
}
}
Once communication between HotkeyP and AutoHotkey is established and a good API is written, you can pretty much implement most of the built-in HotkeP "commands" in AHK, hence, reducing the core code of HotkeyP itself. HotkeyP can be distributed with these basic plugin scripts.
vasili111
Posts: 747
Joined: 21 Jan 2014, 02:04
Location: Georgia

### Re: IDEA| AutoHotkeyP - develop the next generation of hotke

If I understand correctly it should be package management system. Each package there is AutoHotkey script file that does some automation.
If it is so, for that can be used ASPDM package management system with some modification.
DRAKON-AutoHotkey: Visual programming for AutoHotkey.
joedf
Posts: 7835
Joined: 29 Sep 2013, 17:08
GitHub: joedf
Contact:

### Re: IDEA| AutoHotkeyP - develop the next generation of hotke

Very interesting!
Stamimail
Posts: 77
Joined: 06 Nov 2014, 08:48

### Re: IDEA| AutoHotkeyP - develop the next generation of hotke

Hi Syntaxerror,

Thank you and thanks to all guys there in the IRC channel for your important support.

Thanks also to Charlie Simmons for his encouraging reply.

And finally, Thanks in Advance to all the people that are going to be seen in the Credits list of this project...

Regards,
Stamimail
Elesar
Posts: 69
Joined: 31 Oct 2013, 07:56

### Re: IDEA| AutoHotkeyP - develop the next generation of hotke

While Coco's solution would likely be more robust, I got bored at work and made a quick implementation in AHK, though far from feature complete. The attached zip includes this script and a couple of sample modules to show functionality. The first line of a "module" should be a comment that is loaded into the GUI as a description.
AutoHotkeyP:

Code: Select all

AboutText =
( LTrim
AutoHotkeyP
Author: Elesar
Proposed by: Stamimail

This is a concept of Stamimail's proposed integration of HotkeyP's
ease of use with AutoHotkey's power and flexability.

This script is a basic GUI imitation of HotkeyP, as well as a framework
for loading in script modules that can then be assigned to a hotkey by
the user via the GUI.

Lots of stuff still doesn't work, just did this while bored at work :P
)
;<=====  System Settings  ====================================================>
#SingleInstance Force
#NoEnv

;<=====  GUI  ================================================================>
Gui, +Resize -DPIScale +OwnDialogs
Gui, Margin, 5, 5
Gui, Add, ListView, x5 y5 w450 r30 vListView, Hotkey|Command|Description|Parameters
Gui, Add, Button, xp y+5 w75 h30 vInsert gInsert Disabled, &Insert
Gui, Add, Button, xp y+5 w75 h30 vEdit gEdit Disabled, &Edit
Gui, Add, Button, xp y+5 w75 h30 vDuplicate gDuplicate Disabled, D&uplicate
Gui, Add, Button, xp y+5 w75 h30 vDelete gDelete, &Delete
Gui, Add, Button, xp y+5 w75 h30 vOptions gOptions Disabled, &Options
Gui, Add, Button, xp y+5 w35 h30 vMoveUp gMoveUp Disabled, U
Gui, Add, Button, x+5 yp w35 h30 vMoveDown gMoveDown Disabled, D
Gui, Show
Gui, +MinSize
GoSub, PopulateLV

Gui, 2:-DPIScale +ToolWindow
Gui, 2:Margin, 5, 5
Gui, 2:Add, Text, x5 y5 w100, Hotkey:
Gui, 2:Add, Hotkey, x+5 yp w100 vChosenHotkey,
Gui, 2:Add, DropDownList, x5 y+5 w200 vCommandDDL gCommandDDL,
Gui, 2:Add, Text, x5 y+5 w100, Parameters:
Gui, 2:Add, Edit, x+5 yp w100 Disabled vCommandParameters,
Gui, 2:Add, Button, x5 y+5 w100 h30 gSaveNew, Save
Gui, 2:Add, Button, x+5 yp w100 h30 gCancel, Cancel

;<=====  End AutoExecute  ====================================================>
return

;<=====  Subs  ===============================================================>
return

GuiControl, 2:, ChosenHotkey,
GuiControl, 2:, CommandDDL, % commandList()
GuiControl, 2:, CommandParameters,
GuiControl, 2: Disable, CommandParameters
Gui 2:Show
return

Cancel:
2GuiClose:
Gui 2:Hide
return

CommandDDL:
GuiControlGet, CommandDDL,, CommandDDL
if inStr(CommandDesc, "<P>", N)
GuiControl, Enable , CommandParameters,
else
GuiControl, Disable, CommandParameters,
return

Delete:
LV_Delete(LV_GetNext("F"))
return

Insert:
Edit:
Duplicate:
Options:
MoveUp:
MoveDown:
MsgBox, Not implemented.
return

Cleanup:
GuiClose:
MsgBox,4,, Closing this window will stop your hotkeys.nDo you want to close?
IfMsgBox Yes
{
GoSub, StopScript
ExitApp
}
return

GuiSize:
AutoXYWH("ListView", "wh")
return

SaveNew:
Gui, 2:Submit
Gui, 1:Default
StringTrimLeft, CommandDesc, CommandDesc, 1
LV_ModifyCol(1, "AutoHDR")
LV_ModifyCol(2, "AutoHDR")
LV_ModifyCol(3, "AutoHDR")
LV_ModifyCol(4, "AutoHDR")
return

StartScript:
SplashTextOn, 200, 30, AutoHotkeyP, Building script...
strOut := ";This script was generated by AutoHotkeyP" . chr(13)
Loop, % LV_GetCount()
{
LV_GetText(curHotkey, A_Index, 1)
LV_GetText(curCommand, A_Index, 2)
LV_GetText(curParam, A_Index, 4)
strOut .= curHotkey . "::Run, " . "%A_ScriptDir%\Modules\" . curCommand . ".ahk"
if curParam
strOut .= " " . curParam
strOut .= chr(13)
}
ifExist, %A_ScriptDir%\AHKPScript.ahk
FileDelete, %A_ScriptDir%\AHKPScript.ahk
FileAppend, %strOut%, %A_ScriptDir%\AHKPScript.ahk
Run, %A_ScriptDir%\AHKPScript.ahk, %A_ScriptDir%,, AHKP
SplashTextOff
return

RestartScript:
GoSub, StopScript
GoSub, StartScript
return

StopScript:
Process, Close, %AHKP%
Process, WaitClose, %AHKP%
AHKP := ""
return

PopulateLV:
ifExist, %A_ScriptDir%\AHKPScript.ahk
{
Loop, Parse, script, r, n
{
if (A_Index == 1) {
continue
} else if (A_LoopField == "") {
continue
} else {
cmdPath := SubStr(A_LoopField, RegExMatch(A_LoopField, "::Run, ") + 7)
StringSplit, field, A_LoopField, :
SplitPath, cmdPath, cmdFile
cmdParam := SubStr(cmdFile, inStr(cmdFile, ".ahk") + 4)
cmdParam = %cmdParam%
if cmdParam
cmdName := SubStr(cmdFile, 1, StrLen(cmdFile) - (strLen(cmdParam) + 5))
else
cmdName := SubStr(cmdFile, 1, StrLen(cmdFile) - 4)
StringTrimLeft, cmdDesc, cmdDesc, 1
}
}
LV_ModifyCol(1, "AutoHDR")
LV_ModifyCol(2, "AutoHDR")
LV_ModifyCol(3, "AutoHDR")
LV_ModifyCol(4, "AutoHDR")
} else {
}
return

;<=====  Functions  ==========================================================>
commandList(){
strOut := "|"
Loop, %A_ScriptDir%\Modules\*.ahk
{
strOut .= "|" . SubStr(A_LoopFileName, 1, StrLen(A_LoopFileName) - 4)
}
return strOut
}

;<=====  Includes  ===========================================================>
;AutoXYWH by tmplinshi - http://ahkscript.org/boards/viewtopic.php?f=6&t=1079
AutoXYWH(ctrl_list, Attributes, Redraw = False)
{
static cInfo := {}, New := []

Loop, Parse, ctrl_list, |
{
ctrl := A_LoopField

if ( cInfo[ctrl]._x = "" )
{
GuiControlGet, i, Pos, %ctrl%
_x := A_GuiWidth  - iX
_y := A_GuiHeight - iY
_w := A_GuiWidth  - iW
_h := A_GuiHeight - iH
_a := RegExReplace(Attributes, "i)[^xywh]")
cInfo[ctrl] := { _x:(_x), _y:(_y), _w:(_w), _h:(_h), _a:StrSplit(_a) }
}
else
{
if ( cInfo[ctrl]._a.1 = "" )
Return

New.x := A_GuiWidth  - cInfo[ctrl]._x
New.y := A_GuiHeight - cInfo[ctrl]._y
New.w := A_GuiWidth  - cInfo[ctrl]._w
New.h := A_GuiHeight - cInfo[ctrl]._h

Loop, % cInfo[ctrl]._a.MaxIndex()
{
ThisA   := cInfo[ctrl]._a[A_Index]
Options .= ThisA New[ThisA] A_Space
}

GuiControl, % Redraw ? "MoveDraw" : "Move", % ctrl, % Options
}
}
}
Attachments
AutoHotkeyP.zip
Stamimail
Posts: 77
Joined: 06 Nov 2014, 08:48

### Re: IDEA| AutoHotkeyP - develop the next generation of hotke

mmm... Nice. I see from Elesar picture, there is a need for familiar Hotkeys for AHK Users.
1. Is it possible to add such column to HotkeyP?
2. What is better: Developing a new app from start, or to keep developing being based on HotkeyP?

BTW Elesar, There is also a "Run" button can be added in Options of HotkeyP.
Attachments
Elesar
Posts: 69
Joined: 31 Oct 2013, 07:56

### Re: IDEA| AutoHotkeyP - develop the next generation of hotke

Stamimail wrote:mmm... Nice. I see from Elesar picture, there is a need for familiar Hotkeys for AHK Users.
1. Is it possible to add such column to HotkeyP?
2. What is better: Developing a new app from start, or to keep developing being based on HotkeyP?

BTW Elesar, There is also a "Run" button can be added in Options of HotkeyP.
A column for AHK's key names isn't really needed, and I have actually played around with my version a bit more and it now displays "friendly" key names, similar to HotkeyP.

If you are already working on a module for HotkeyP, I would say to continue work in that direction. While I may be able to mock some (or even all) of the functionality in AHK, multiple options would be a good thing, especially since I'm in no way committing myself to working on this, it's just something that I can tinker with when I get in the mood and don't have other projects going.

If I ever get around to building the Options page, I'll include the RUN button option there. I'll probably not be very faithful to HotkeyP's design, as I don't have it installed, and probably won't install it just to copy elements in a 1:1 manner.
Stamimail
Posts: 77
Joined: 06 Nov 2014, 08:48

### Re: IDEA| AutoHotkeyP - develop the next generation of hotke

Stamimail
Posts: 77
Joined: 06 Nov 2014, 08:48

### Re: IDEA| AutoHotkeyP - develop the next generation of hotkeys

Stamimail wrote:
14 Nov 2014, 08:12
Here comes the place of AutoHotkey. Since AutoHotkey it is a kind of scripting language, in open-source and popular, It can help to produce a huge variety of new commands. A library of commands. (Categorized...)
Simple users (without scripting knowledge) will be able to download their favorite commands had produced by AutoHotkey community, and to use them in a GUI like HotkeyP.
Common commands can be installed in the first installation of the software. Then, the users will be able to download and add commands from the Online Library as much as they want.
Perhaps this idea has something in common with the concept of a Package Manager, like pip and npm.
Does Autohotkey platform have a kind of Package Manager?
joedf
Posts: 7835
Joined: 29 Sep 2013, 17:08
GitHub: joedf
Contact:

### Re: IDEA| AutoHotkeyP - develop the next generation of hotkeys

The closest and most up to date things currently are ASPDM and pAHK_light. Went I have some free time in the summer, I think I’ll try connecting in ASPDM using forum authentication.
Stamimail
Posts: 77
Joined: 06 Nov 2014, 08:48

### Re: IDEA| AutoHotkeyP - develop the next generation of hotkeys

I know I'm bringing up an old topic here, but I'm still looking for a way to combine HotkeyP+AutoHotkey together.
Let's take a simple example:
Let's say I want to select text in text editor, and then launch a script that convert the selected text to UPPERCASE.

I want the script to be by AutoHotkey
I want the launching to be by Hotkeyp (meaning that HotkeyP is in charge of managing the hotkey)

Is it possible?
swagfag
Posts: 4092
Joined: 11 Jan 2017, 17:59

### Re: IDEA| AutoHotkeyP - develop the next generation of hotkeys

so, just launch the script then
see CreateProcess
Stamimail
Posts: 77
Joined: 06 Nov 2014, 08:48

### Re: IDEA| AutoHotkeyP - develop the next generation of hotkeys

swagfag wrote:
04 Jun 2020, 08:01
so, just launch the script then
see CreateProcess
I can say that I'm talking about such a situation that both HotkeyP and AutoHotkey Script are running in the background (they are both in the system tray).
I want to set the hotkeys by HotkeyP. "launch a script that "
I want to launch commands that lying in AutoHotkey script. "convert the selected text to UPPERCASE"
swagfag
Posts: 4092
Joined: 11 Jan 2017, 17:59

### Re: IDEA| AutoHotkeyP - develop the next generation of hotkeys

what do u mean? arent u the developer of HotkeyP, asking how to integrate running ahk scripts with ur app?
if so, running the script from disk, passing the script name as a command line parameter to autohotkey.exe(with CreateProcess), is the simplest way. there are also other ways(named pipes, bundling autohotkey.dll and starting threads, etc)

if not(ie ure just a user of HotkeyP), ull have to figure out a way to signal to a would-be-listener program(need not necessarily be an ahk script) from HotkeyP that a HotkeyP-hotkey has been activated, and the listener would handle the dispatch to take an appropriate action
im not familiar with HotkeyP, so ure better informed on what its capabilities of accomplishing that are
Stamimail
Posts: 77
Joined: 06 Nov 2014, 08:48

### Re: IDEA| AutoHotkeyP - develop the next generation of hotkeys

I'm just a user of HotkeyP.
and I'm trying to figure out a way..
Stamimail
Posts: 77
Joined: 06 Nov 2014, 08:48

### Re: IDEA| AutoHotkeyP - develop the next generation of hotkeys

I got help in IRC channel. Credit to ShatterCoder.

Code: Select all

sendinput, ^c
tempvar := clipboard
stringupper, tempvar, tempvar
clipboard := tempvar
sleep, 100
sendinput, ^v`
ShatterCoder wrote:that's all it takes to convert to uppercase. normally you would use a hotkey to trigger the script, but in this case when you run the script it will send Ctrl + c to copy the highlighted text then convert it to uppercase and send ctrl + v to paste it back over the original text.
if you compile the script all you need to do is call it from the command line
otherwise you would need to use ahk.exe "path\to\your\script.ahk"
So setting this in HotkeyP worked for me:
Command:
"path\to\AutoHotkeyU64.exe"
Parameters:
"path\to\convert_to_UPPERCASE.ahk"

and a compiled also worked,
Command:
"path\to\convert_to_UPPERCASE.exe"