Need help with AHK2

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: Hacker, petermad, Stefan2, white

Post Reply
KozakMak
Senior Member
Senior Member
Posts: 478
Joined: 2021-05-24, 12:39 UTC
Location: UA

Need help with AHK2

Post by *KozakMak »

Besides Explorer, I also need to consider the current path in TotalCmd. Can anyone help with this?

Code: Select all

#SC029:: {    ; win + tilde
    hwnd := WinExist("A")
    for w in ComObject("Shell.Application").Windows
        if w.hwnd = hwnd && DirExist(path := w.Document.Folder.Self.Path) {
            Run A_ComSpec, path
            return
        }
    Run A_ComSpec
}
OS: Win10 | TC: latest x64
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50383
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Need help with AHK2

Post by *ghisler(Author) »

The official way is to send WM_COPYDATA with dwData set to 'G'+256*'W' and lpData set to one of the characters L, R, S or T to request the left, right, source or target directory. You will then get a WM_COPYDATA back with dwData set to 'R'+256*'W' and lpData set to the path in UTF-16LE. You can also send 'G'+256*'A' to get the path in ANSI and get 'R'+256*'A' back. You can use OnMessage in AHK to listen to WM_COPYDATA messages.
See this thread for examples using AHK1:
https://ghisler.ch/board/viewtopic.php?t=32658
Author of Total Commander
https://www.ghisler.com
KozakMak
Senior Member
Senior Member
Posts: 478
Joined: 2021-05-24, 12:39 UTC
Location: UA

Re: Need help with AHK2

Post by *KozakMak »

for AHK v2 no working options
OS: Win10 | TC: latest x64
Post Reply