How to make clipboard paste support for file/folder

Get help with using AutoHotkey and its commands and hotkeys
MonuKashyap
Posts: 48
Joined: 06 Jun 2016, 21:32

How to make clipboard paste support for file/folder

18 Apr 2019, 04:44

How to make clipboard paste support for file/folder

I would like to do..

clipboard:="D:\myfile"



I thought, when i press ctrl+v, it will paste the file to my location dir.,,But not.
How Can i ?? Help pls..


Edit: Topic subject added ~ gregster
User avatar
Tigerlily
Posts: 281
Joined: 04 Oct 2018, 22:31

Re:

18 Apr 2019, 05:11

MonuKashyap wrote:
18 Apr 2019, 04:44
How to make clipboard paste support for file/folder

I would like to do..

clipboard:="D:\myfile"



I thought, when i press ctrl+v, it will paste the file to my location dir.,,But not.
How Can i ?? Help pls..
Try this:

Code: Select all

FileRead, Clipboard, D:\myfile.txt
Oh nvm, looks like you are looking to do something else xD
-TL
MonuKashyap
Posts: 48
Joined: 06 Jun 2016, 21:32

Re: How to make clipboard paste support for file/folder

18 Apr 2019, 10:35

not for text file friend.
another suggestion??
swagfag
Posts: 2515
Joined: 11 Jan 2017, 17:59

Re: How to make clipboard paste support for file/folder

18 Apr 2019, 10:39

its unclear what u want to happen
Klarion
Posts: 176
Joined: 26 Mar 2019, 10:02

Re: How to make clipboard paste support for file/folder

18 Apr 2019, 10:46

Garbage In Garbage Out
-though above sentence is so strong, but it reveals truth

You have the name of a file you want to copy from here to there
But, you want to copy the content of a file from here to there

So..

You have to use proper FileCopy command with proper usage rules
https://www.autohotkey.com/docs/commands/FileCopy.htm

Regards
Klarion
Posts: 176
Joined: 26 Mar 2019, 10:02

Re: How to make clipboard paste support for file/folder

18 Apr 2019, 10:49

or

If you want vomit the contents of current clipboard into a text file
https://www.autohotkey.com/docs/commands/FileAppend.htm
Kobaltauge
Posts: 140
Joined: 09 Mar 2019, 01:52
GitHub: MassimoCastell
Location: Germany
Contact:

Re: How to make clipboard paste support for file/folder

18 Apr 2019, 11:26

If you only need the complete path, just right click with pressed shift key. In the context menu there is the option "copy as path". You don't need AHK for that.
ahk7
Posts: 174
Joined: 06 Nov 2013, 16:35

Re: How to make clipboard paste support for file/folder

18 Apr 2019, 11:46

I'm guessing you want to copy file paths to the clipboard so you can paste these files elsewhere, if so you need ClipboardSetFiles() by just me, see here https://www.autohotkey.com/boards/viewtopic.php?p=63914#p63914

Alternatively:
- copy file path(s) the clipboard
- parse the clipboard and use the FileCopy command to copy the files to the destination
- See the first example on the doc here https://www.autohotkey.com/docs/misc/Clipboard.htm (replace MsgBox with FileCopy of course)
- There are also COM and other methods to work with files + explorer - more info collected here https://www.autohotkey.com/boards/viewtopic.php?p=252125
User avatar
Tigerlily
Posts: 281
Joined: 04 Oct 2018, 22:31

Re: How to make clipboard paste support for file/folder

18 Apr 2019, 20:21

MonuKashyap wrote:
18 Apr 2019, 04:44
How to make clipboard paste support for file/folder

I would like to do..

clipboard:="D:\myfile"



I thought, when i press ctrl+v, it will paste the file to my location dir.,,But not.
How Can i ?? Help pls..


Edit: Topic subject added ~ gregster
I could be wrong but I think everyone is guessing at this wrong. What the OP wants is to be able to automate the task of manual copy/paste on an individual file. So say they click on a file, then press CTRL+C, then go to another folder and press CTRL+V and then that file now makes a copy in the new location.

How can they get that file into their clipboard (not the path, but the actual file), so that they can possibly press a hotkey at any given moment and it will load their clipboard with that file, then they can go to another folder and CTRL+V and a copy will pop into the active folder they are browsing in.
-TL
swagfag
Posts: 2515
Joined: 11 Jan 2017, 17:59

Re: How to make clipboard paste support for file/folder

19 Apr 2019, 03:14

now ure just describing normal copypaste behavior
ahk7
Posts: 174
Joined: 06 Nov 2013, 16:35

Re: How to make clipboard paste support for file/folder

19 Apr 2019, 03:20

My post covered that.
If you copy a file in explorer you can paste it elsewhere.
If you want to use a script to populate the clipboard to paste one or more file(s) you need ClipboardSetFiles() OR you need to parse the clipboard "as text" as described in the help. Just setting a path (as text) into the clipboard won't make explorer paste it as it needs a "DropEffect" (see the code by just me).
MonuKashyap
Posts: 48
Joined: 06 Jun 2016, 21:32

Re: How to make clipboard paste support for file/folder

01 May 2019, 04:48

My question is very simple,

""" I just want to copy a file by an ahk script,
but, paste the file without ahk script

without browsing to the location of file.
"""

hope, I could understood you all
MonuKashyap
Posts: 48
Joined: 06 Jun 2016, 21:32

Re: How to make clipboard paste support for file/folder

01 May 2019, 04:50

swagfag wrote:
18 Apr 2019, 10:39
its unclear what u want to happen
Specially to you friend, swagfag.
vsub
Posts: 141
Joined: 29 Sep 2015, 03:39

Re: How to make clipboard paste support for file/folder

01 May 2019, 06:35

I was also wondering if there is a way to do that
To put is simply
1.Open Notepad and type the location to some file and set a variable to it
Var = C:\File.txt
2.Send that variable into the clipboard but not as a text(which AHK does)but as if you went to that file and copy it
3.Open any folder and since the file in sended to the clipboard in a Copy=>paste way,the Paste menu will be active and you will be able paste that file

As far as I know,AHK can't do this...maybe with some DllCall\COM but I don't understand that part of AHK
AHKStudent
Posts: 462
Joined: 05 May 2018, 12:23

Re: How to make clipboard paste support for file/folder

01 May 2019, 08:42

vsub wrote:
01 May 2019, 06:35
I was also wondering if there is a way to do that
To put is simply
1.Open Notepad and type the location to some file and set a variable to it
Var = C:\File.txt
2.Send that variable into the clipboard but not as a text(which AHK does)but as if you went to that file and copy it
3.Open any folder and since the file in sended to the clipboard in a Copy=>paste way,the Paste menu will be active and you will be able paste that file

As far as I know,AHK can't do this...maybe with some DllCall\COM but I don't understand that part of AHK
can file copy help?
https://autohotkey.com/docs/commands/FileCopy.htm
vsub
Posts: 141
Joined: 29 Sep 2015, 03:39

Re: How to make clipboard paste support for file/folder

01 May 2019, 09:01

FileCopy is a AHK function which is expecting a destination,you can't set "Clipboard" as destination to make the windows Paste function accept it as if went to that file and copy it.

For example,create a file named File.txt in C:\,copy the text from above and make ahk send something(whatever that code is)to windows so when you right click,paste will be active and pasting will paste the File.txt to the location you choose

ClipboardAll can save copied file to a variable and the send it again to the clipboard but you can't send text pointing file location and make it act as if I copied the file

Var := ClipboardAll
msgbox
Clipboard := Var
Exitapp
swagfag
Posts: 2515
Joined: 11 Jan 2017, 17:59

Re: How to make clipboard paste support for file/folder

04 May 2019, 06:16

seems like ur looking for lexikos' CopyFileToClipboard: https://autohotkey.com/board/topic/23162-how-to-copy-a-file-to-the-clipboard/?p=150209
idk if this works with 1.1.30.03
try it
MonuKashyap
Posts: 48
Joined: 06 Jun 2016, 21:32

Re: How to make clipboard paste support for file/folder

12 May 2019, 10:07

swagfag wrote:
04 May 2019, 06:16
seems like ur looking for lexikos' CopyFileToClipboard: https://autohotkey.com/board/topic/23162-how-to-copy-a-file-to-the-clipboard/?p=150209
idk if this works with 1.1.30.03
try it
that's not working for me :crazy: :crazy:
ahk7
Posts: 174
Joined: 06 Nov 2013, 16:35

Re: How to make clipboard paste support for file/folder

12 May 2019, 13:46

This is your answer - copy the function from just me's post and try it and it works - https://www.autohotkey.com/boards/viewtopic.php?p=273326#p273326

Return to “Ask For Help”

Who is online

Users browsing this forum: bangon2006, Bing [Bot], Breevz, Google [Bot], IIoPTeP, JaydeNpie, MannyKSoSo, Rohwedder, stargate, Taurus, teadrinker, theon and 185 guests