Page 1 of 1

How to make clipboard paste support for file/folder

Posted: 18 Apr 2019, 04:44
by MonuKashyap
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

Re:

Posted: 18 Apr 2019, 05:11
by Tigerlily
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

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

Posted: 18 Apr 2019, 10:35
by MonuKashyap
not for text file friend.
another suggestion??

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

Posted: 18 Apr 2019, 10:39
by swagfag
its unclear what u want to happen

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

Posted: 18 Apr 2019, 10:46
by Klarion
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

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

Posted: 18 Apr 2019, 10:49
by Klarion
or

If you want vomit the contents of current clipboard into a text file
https://www.autohotkey.com/docs/commands/FileAppend.htm

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

Posted: 18 Apr 2019, 11:26
by Kobaltauge
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.

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

Posted: 18 Apr 2019, 11:34
by Klarion
ah, this one is good too

ClipboardALL with *c option
https://www.autohotkey.com/docs/misc/Clipboard.htm#ClipboardAll

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

Posted: 18 Apr 2019, 11:46
by ahk7
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

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

Posted: 18 Apr 2019, 20:21
by Tigerlily
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.

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

Posted: 19 Apr 2019, 03:14
by swagfag
now ure just describing normal copypaste behavior

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

Posted: 19 Apr 2019, 03:20
by ahk7
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).

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

Posted: 01 May 2019, 04:48
by MonuKashyap
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

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

Posted: 01 May 2019, 04:50
by MonuKashyap
swagfag wrote:
18 Apr 2019, 10:39
its unclear what u want to happen
Specially to you friend, swagfag.

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

Posted: 01 May 2019, 06:35
by vsub
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

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

Posted: 01 May 2019, 08:42
by AHKStudent
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

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

Posted: 01 May 2019, 09:01
by vsub
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

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

Posted: 04 May 2019, 06:16
by swagfag
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

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

Posted: 12 May 2019, 10:07
by MonuKashyap
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:

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

Posted: 12 May 2019, 13:46
by ahk7
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