Adress File or Folder to Clipboard

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Guill
Posts: 139
Joined: 09 Jun 2016, 22:00

Adress File or Folder to Clipboard

12 Sep 2019, 10:20

Is it feasible to obtain a script that does the following?:

When you click on a certain file in any windows folder, it copies its address to the clipboard. The same for the folder.

For example:

Ex1: Click on file "Activities.txt"
Clipboard = C://My Folder/Activities.txt

Or

Ex2: Click on folder "My Folder"
Clipboard = C://My Folder/
Kobaltauge
Posts: 264
Joined: 09 Mar 2019, 01:52
Location: Germany
Contact:

Re: Adress File or Folder to Clipboard

12 Sep 2019, 15:58

You could try the search function of this forum. It's pretty good. =)

https://www.autohotkey.com/boards/viewtopic.php?t=23788
Kobaltauge
Posts: 264
Joined: 09 Mar 2019, 01:52
Location: Germany
Contact:

Re: Adress File or Folder to Clipboard

13 Sep 2019, 00:43

Forgot to write.

To execute the hotkey with the mousebutton you have only to change F6 to ^lbutton. But beware, if you executing things like copy to clipboard on every click, it can cause a strange behaviour in some programs or situations. i would recommend that you use a F-key or someting else after selecting the file or folder with the mouse.
User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

Re: Adress File or Folder to Clipboard

13 Sep 2019, 04:34

One easy way, without AutoHotkey is to use SHIFT + Right-Click, and select "Copy as Path". The only downside (for you I think) is that when copied, the path is in quotes, but those should be easy enough to remove for whatever you need.
Odlanir
Posts: 659
Joined: 20 Oct 2016, 08:20

Re: Adress File or Folder to Clipboard

13 Sep 2019, 05:59

Select one or more files from an explorer window and press ctrl+1:

Code: Select all

^1::
	MsgBox % clipboard := Explorer_GetSelection()
return

Explorer_GetSelection(hwnd="") {
	hwnd := hwnd ? hwnd : WinExist("A")
	WinGetClass class, ahk_id %hwnd%
	if (class="CabinetWClass" or class="ExploreWClass" or class="Progman" or class="#32770") {
		for window in ComObjCreate("Shell.Application").Windows {
			if (window.hwnd==hwnd) {
				sel := window.Document.SelectedItems
			}
		}
	}
	for item in sel
		ToReturn .= item.path "`n"
	return RTrim(ToReturn,"`n")
}

ExitApp
*Esc::
	ExitApp
____________________________________________________________________________
Windows 10 Pro 64 bit - Autohotkey v1.1.30.01 64-bit Unicode
User avatar
Kellyzkorner_NJ
Posts: 84
Joined: 20 Oct 2017, 18:33

Re: Adress File or Folder to Clipboard

17 Sep 2019, 12:33

I don't mean to hijack this post but I'm wondering if this is something that is a component of what I've been trying to do for at least a year. What I want to do is, in Windows Explorer I'm highlighting files/folders I want to move and selecting move (unless this can be made part of the hotkey). Then, the main thing I can't figure out is once I've placed the cursor at the folder of where I want these pasted, with a hotkey send the right click, have that right click determine the address of that folder and paste to that folder from there. This would shorten my steps. Hopefully that makes sense.
Kobaltauge
Posts: 264
Joined: 09 Mar 2019, 01:52
Location: Germany
Contact:

Re: Adress File or Folder to Clipboard

17 Sep 2019, 16:48

@Kellyzkorner_NJ I don't get your "wish". You can mark files and folders in the explorer window. Press ctrl+x to "cut", select your destination folder and press ctrl+v to paste. This moves all selected. If you press ctrl+c the selected items were copied not moved.
You don't need to use the right mouse button context menu.
User avatar
Kellyzkorner_NJ
Posts: 84
Joined: 20 Oct 2017, 18:33

Re: Adress File or Folder to Clipboard

18 Sep 2019, 23:26

@Kobaltauge I'm aware of the cut and paste, I left out a step there, I'm pasting often to a file that is IN the folder I want to paste to, as I'm using usually Voidtools' Everything program and the folder isn't necessary there. So I'm right clicking on a file and wanting to find the folder that file is in and paste there. I'm sorry I misspoke and caused confusion. Thank you for your reply.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: AlFlo and 213 guests