How to get selected items in Explorer replacement?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
MIRKOSOFT
Posts: 334
Joined: 23 Sep 2014, 14:29

How to get selected items in Explorer replacement?

21 May 2017, 18:12

Hi!

With help on this forum I'm using opening selected files/folders (in Explorer) in many applications - works correctly.
But now I'm using Explorer replacement XYplorer and with this cannot work - of course, in code is used Explorer.

My Q is maybe not so easy, but here's:
Is possible to apply it on XYplorer?
And even - recognize if is selected item in Explorer or XYplorer?

Here's code:

Code: Select all

Selected_Files()
{
  ; Handles Explorer
  IfWinActive, ahk_class CabinetWClass
  {
    for window in ComObjCreate("Shell.Application").Windows
      if window.HWND = WinExist("A")
        this_window := window
    
    ; If multiple Items selected
    if(this_window.Document.SelectedItems.Count > 1)
    {
      these_files := ""
      for item in this_window.Document.SelectedItems
        these_files .= item.Path . "`n"
      
      return these_files
    }
    else
      return this_window.Document.FocusedItem.Path
  }
  
  ; Handles Desktop
  if(WinActive("ahk_class Progman") || WinActive("ahk_class WorkerW"))
  {
    ControlGet, selectedFiles, List, Selected Col1, SysListView321, A
    
    ; If multiple Items selected
    if InStr(selectedFiles, "`n")
    {
      these_files := ""
      Loop, Parse, selectedFiles, `n, `r
        these_files .= A_Desktop . "\" . A_LoopField . "`n"
    
      return these_files
    }
    else
      return A_Desktop . "\" . selectedFiles
  }
  else
    return false
}
And here info about XYplorer:

Code: Select all

Window text: G:\ - XYplorer 17.60.0100
ahk_class ThunderRT6FormDC
ahk_exe XYplorer.exe
Can anybody help me?

Thank you for all.
Miro

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: filipemb, TAC109, wineguy and 293 guests