Create own class id for ahk gui?

Get help with using AutoHotkey and its commands and hotkeys
User avatar
Scr1pter
Posts: 270
Joined: 06 Aug 2017, 08:21
Location: Germany

Create own class id for ahk gui?

21 Jul 2018, 18:07

Hi,

I found this 12 year old thread were someone had the same question:
https://autohotkey.com/board/topic/1091 ... ahk-class/

When I compile a script (e.g. one which creates an AHK gui), the class id is always:
ahk_class AutoHotkeyGUI

Is there a newer way to change the class id rather than using any hex tools?
I create guis for different applications.
If all guis have the same class id, there might be some problems.
because I often work with #if WinActive("ahk_class ...")

Regards
I'm not an expert, just an enthusiastic AutoHotkey user.
If my post contains the word Gaming, it does not automatically mean it's a gaming related question ;)
Keyboard: Logitech G15 first generation - Mice: Logitech G9, G502, G602 - OS: Windows 7 Pro 64 Bit AHK version: 1.1.29.00
User avatar
Flipeador
Posts: 950
Joined: 15 Nov 2014, 21:31
GitHub: Flipeador
Location: Argentina
Contact:

Re: Create own class id for ahk gui?

21 Jul 2018, 19:27

Try this code, it is for AHKv2 because AHKv1 is MUCH slower. Create a copy of AutoHotkey.exe and select it in the dialog box.

Code: [Select all] [Expand] [Download] (Untitled.ahk)GeSHi © Codebox Plus



Anyway, this is a VERY bad idea. You should look for a smarter alternative to ahk_class.


Edit: You can try this for v1.
Spoiler
Windws 1♂ Pro 64-Bits I make scripts for AHKv2 (my v2 compiler) & WIN_7+ Spanish Argentina SublimeText 3 & AHKv2
AHKStudent
Posts: 287
Joined: 05 May 2018, 12:23

Re: Create own class id for ahk gui?

22 Jul 2018, 08:31

Interesting, how can I do this manually? when I try to open the exe in txt I do not find AutoHotkeyGUI
User avatar
Flipeador
Posts: 950
Joined: 15 Nov 2014, 21:31
GitHub: Flipeador
Location: Argentina
Contact:

Re: Create own class id for ahk gui?

22 Jul 2018, 09:57

AHKStudent wrote:Interesting, how can I do this manually? when I try to open the exe in txt I do not find AutoHotkeyGUI

Open it in a hexadecimal editor like HxD.


Edit: I tried doing it in a running script with GetAddressOfData (v2) but it did not work :lol:
Windws 1♂ Pro 64-Bits I make scripts for AHKv2 (my v2 compiler) & WIN_7+ Spanish Argentina SublimeText 3 & AHKv2
AHKStudent
Posts: 287
Joined: 05 May 2018, 12:23

Re: Create own class id for ahk gui?

22 Jul 2018, 13:02

Flipeador wrote:
AHKStudent wrote:Interesting, how can I do this manually? when I try to open the exe in txt I do not find AutoHotkeyGUI

Open it in a hexadecimal editor like HxD.


Edit: I tried doing it in a running script with GetAddressOfData (v2) but it did not work :lol:

I tried HxD, I select my exe, I do a search for the word AutoHotkeyGUI and it finds nothing, but your script works. I tried with a exe that did not have the changed name yet.
User avatar
jeeswg
Posts: 4785
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Create own class id for ahk gui?

22 Jul 2018, 14:22

- Here's a script I wrote to change 'AutoHotkeyGUI' to something else, live, while the exe is open, rather than editing the exe file.
test whether another script's hotkeys are still working (trigger hotkeys in another script) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=27839&p=132392#p132392
- But I agree, it ought to be possible to choose a custom class name for GUIs, and I mentioned it in my Wish List 2.0.
Wish List 2.0 - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=13&t=36789
User avatar
Flipeador
Posts: 950
Joined: 15 Nov 2014, 21:31
GitHub: Flipeador
Location: Argentina
Contact:

Re: Create own class id for ahk gui?

23 Jul 2018, 10:29

AHKStudent wrote:I tried HxD, I select my exe, I do a search for the word AutoHotkeyGUI and it finds nothing

Image
Windws 1♂ Pro 64-Bits I make scripts for AHKv2 (my v2 compiler) & WIN_7+ Spanish Argentina SublimeText 3 & AHKv2
AHKStudent
Posts: 287
Joined: 05 May 2018, 12:23

Re: Create own class id for ahk gui?

23 Jul 2018, 10:33

Flipeador wrote:
AHKStudent wrote:I tried HxD, I select my exe, I do a search for the word AutoHotkeyGUI and it finds nothing


works :thumbup: :thumbup: :thumbup:
User avatar
Scr1pter
Posts: 270
Joined: 06 Aug 2017, 08:21
Location: Germany

Re: Create own class id for ahk gui?

24 Jul 2018, 06:16

Hi, thanks for the many replies!
Very interesting indeed.

A question:
Let's say I create a bigger script which contains single scripts (for different applications for example).
If I have several Guis and compile the big script to an Exe, will a hex editor show me several AutoHotKeyGui class ids?

If yes, I assume that the first found will be the first gui, the second the second gui etc.
So I guess I could simply rename those IDs even though they are in 1 big script?

Regards
I'm not an expert, just an enthusiastic AutoHotkey user.
If my post contains the word Gaming, it does not automatically mean it's a gaming related question ;)
Keyboard: Logitech G15 first generation - Mice: Logitech G9, G502, G602 - OS: Windows 7 Pro 64 Bit AHK version: 1.1.29.00

Return to “Ask For Help”

Who is online

Users browsing this forum: Banayat, colt, labrint, swagfag and 46 guests