Need help with GetActiveExplorerTab in Windows 11

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Lopsho
Posts: 1
Joined: 03 Mar 2023, 17:32

Need help with GetActiveExplorerTab in Windows 11

03 Mar 2023, 17:44

[Mod edit: Topic moved to v1 help.]

I used this script for over a year and it worked amazing on Windows 10, but after moving to Windows 11 I have a problem with it, because it creates a New Text Document.txt only in the first tab of the currently opened explorer window, ignoring the tab I selected. I found this topic and it seems just like thing I need, but I have absolutely no idea how to incorporate GetActiveExplorerTab function in the existing script:

Code: Select all

#IfWinActive, ahk_class CabinetWClass
^+M::
vNameNoExt := "New Text Document"
vDotExt := ".txt"
vPath := ""
WinGet, hWnd, ID, A
for oWin in ComObjCreate("Shell.Application").Windows {
   if (oWin.HWND = hWnd) {
      vDir := oWin.Document.Folder.Self.Path
      Loop {
         vSfx := (A_Index=1) ? "" : " (" A_Index ")"
         vName := vNameNoExt vSfx vDotExt
         vPath := vDir "\" vName
         if !FileExist(vPath)
            break
      }
      FileAppend,, % vPath, UTF-8-RAW
      break
   }
}
oWin.Refresh()
for Item in oWin.Document.Folder.Items
   if (Item.Path = vPath)
      oWin.Document.SelectItem(Item, 3|4|8)
oWin := ""
return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: AlFlo, Bing [Bot], mikeyww and 136 guests