Problem with clipboard and copied file

Get help with using AutoHotkey and its commands and hotkeys
Posts: 236
Joined: 10 Mar 2016, 21:19

Problem with clipboard and copied file

03 Jan 2019, 19:02


Let's say I copy a file using right click context menu in Windows file explorer.
After that, the context menu shows properly the paste command to paste the copied file.

But if I run this ahk code after I copy the file, then the paste command doesnt show up in the context menu, although the clipboard still has the full path of the file.

Code: Select all

I guess it has something to do with how Windows works, and if clear and refill the clipboard with the file path, the ability to paste the file is still lost.
Is there a way to address this problem and retain the ability to use Windows' paste command, after I copy the file and manipulate the clipboard?
Posts: 3
Joined: 03 Jan 2019, 18:52

Re: Problem with clipboard and copied file

03 Jan 2019, 19:33

Code: Select all

cliptemp:=clipboardAll ; use ClipboardAll
clipboard:= ""
Posts: 10
Joined: 03 Jan 2019, 18:55

Re: Problem with clipboard and copied file

03 Jan 2019, 20:04

This function will select the item from the context menu of the file the same way right click does.It does not copy the contents of the file but instead the actual file itself just as selecting "copy" from it's context menu would.

InvokeVerb(path, "Copy")

InvokeVerb(path, menu, validate=True) {

objShell := ComObjCreate("Shell.Application")
if InStr(FileExist(path), "D") || InStr(path, "::{") {
objFolder := objShell.NameSpace(path)
objFolderItem := objFolder.Self
} else {
SplitPath, path, name, dir
objFolder := objShell.NameSpace(dir)
objFolderItem := objFolder.ParseName(name)
if validate {
colVerbs := objFolderItem.Verbs
loop % colVerbs.Count {
verb := colVerbs.Item(A_Index - 1)
retMenu :=
StringReplace, retMenu, retMenu, &
if (retMenu = menu) {
Return True
Return False
} else

Return to “Ask For Help”

Who is online

Users browsing this forum: autohotkeycool, Bernuz, HiSoKa, Weshuggah and 63 guests