Get File Path And File Name

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
dentopolis
Posts: 125
Joined: 06 May 2016, 16:28

Get File Path And File Name

Post by dentopolis » 25 Sep 2022, 06:13

when I select some file in a windows folder, I use some keys (^!+d) and I'd like it to store in clipboard the file path and file name ex: C:\photo.jpg. How can I do that?

User avatar
boiler
Posts: 16705
Joined: 21 Dec 2014, 02:44

Re: Get File Path And File Name

Post by boiler » 25 Sep 2022, 22:04

This works for me:

Code: Select all

^!+d::^c
I'm not seeing the advantage of pressing all those keys instead of just ^c, though.

dentopolis
Posts: 125
Joined: 06 May 2016, 16:28

Re: Get File Path And File Name

Post by dentopolis » 26 Sep 2022, 09:31

but I want to get the file path from the address bar like C:\Desktop\file.txt

safetycar
Posts: 435
Joined: 12 Aug 2017, 04:27

Re: Get File Path And File Name

Post by safetycar » 26 Sep 2022, 10:46

I think that @boiler's reply is still what you are trying to do.
Try it this other way

Code: Select all

^!+d::
{
	A_Clipboard := ""
	Send "^c"
	ClipWait
	MsgBox A_Clipboard
}
(selecting the file and then pressing the keys)

User avatar
boiler
Posts: 16705
Joined: 21 Dec 2014, 02:44

Re: Get File Path And File Name

Post by boiler » 26 Sep 2022, 11:23

Yes, sometimes just ^c gets me the path, and sometimes it doesn't work at all, then I need to do what safetycar did.

Post Reply

Return to “Ask for Help (v2)”