Copy file name Just

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
asad41163
Posts: 268
Joined: 29 Jul 2014, 14:31

Copy file name Just

19 Apr 2018, 15:49

This great code frome here: https://autohotkey.com/boards/viewtopic.php?f=5&t=44848
Written by: Odlanir

Code: Select all

q::
fileselected := Explorer_GetSelection()
SplitPath,fileselected, fn
MsgBox % "FileName :`t" fn "`nFullName :`t" fileselected
return


Explorer_GetSelection(hwnd="") {
    WinGet, process, processName, % "ahk_id" hwnd := hwnd? hwnd:WinExist("A")
    WinGetClass class, ahk_id %hwnd%
    if (process = "explorer.exe")
        if (class ~= "Progman|WorkerW") {
            ControlGet, files, List, Selected Col1, SysListView321, ahk_class %class%
            Loop, Parse, files, `n, `r
                ToReturn .= A_Desktop "\" A_LoopField "`n"
        } else if (class ~= "(Cabinet|Explore)WClass") {
            for window in ComObjCreate("Shell.Application").Windows
                if (window.hwnd==hwnd)
                    sel := window.Document.SelectedItems
            for item in sel
                ToReturn .= item.path "`n"
        }
    return Trim(ToReturn,"`n")
}
my question is:
How do I get a list by name only in clipboard, formatted as in the picture, can paste it into any text editor
ask.png
ask.png (2.87 KiB) Viewed 1299 times
Any help would be greatly appreciated
poetbox
Posts: 112
Joined: 18 Apr 2018, 20:47

Re: Copy file name Just

19 Apr 2018, 22:07

Loop, Files, *.bas
poetbox
Posts: 112
Joined: 18 Apr 2018, 20:47

Re: Copy file name Just

19 Apr 2018, 22:25

Loop, Files, %dir%\*.bas
list=%list%%A_LoopFileName%`n
clipboard=FileName:`n%list%
MsgBox %clipboard%
poetbox
Posts: 112
Joined: 18 Apr 2018, 20:47

Re: Copy file name Just

19 Apr 2018, 22:29

all the code here:

Code: Select all

q::
fileselected := Explorer_GetSelection()
SplitPath,fileselected,,dir
list=""
Loop, Files, %dir%\*.*
  list=%list%%A_LoopFileName%`n
clipboard=FileName:`n%list%
MsgBox %clipboard%
;MsgBox %list% 
return


Explorer_GetSelection(hwnd="") {
    WinGet, process, processName, % "ahk_id" hwnd := hwnd? hwnd:WinExist("A")
    WinGetClass class, ahk_id %hwnd%
    if (process = "explorer.exe")
        if (class ~= "Progman|WorkerW") {
            ControlGet, files, List, Selected Col1, SysListView321, ahk_class %class%
            Loop, Parse, files, `n, `r
                ToReturn .= A_Desktop "\" A_LoopField "`n"
        } else if (class ~= "(Cabinet|Explore)WClass") {
            for window in ComObjCreate("Shell.Application").Windows
                if (window.hwnd==hwnd)
                    sel := window.Document.SelectedItems
            for item in sel
                ToReturn .= item.path "`n"
        }
    return Trim(ToReturn,"`n")
}
asad41163
Posts: 268
Joined: 29 Jul 2014, 14:31

Re: Copy file name Just

20 Apr 2018, 15:29

Hi Mr. poetbox
It has saved me a lot of time and effort
You are truly awesome
Great help, and a commendable initiative
THANK YOU very much
asad41163
Posts: 268
Joined: 29 Jul 2014, 14:31

Re: Copy file name Just

22 Apr 2018, 03:28

Hi Mr. poetbox
I'm sorry
it's not work propably
it gaves me this Msg:
Attachments
ask peplay.png
ask peplay.png (2.59 KiB) Viewed 1224 times

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot] and 171 guests