Copy file contents

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
eurytos
Posts: 200
Joined: 29 Jan 2008 15:53

Copy file contents

Post by eurytos »

Is it possible to copy a file's contents to the clipboard without opening it? Preferably from the context menu or keyboard shortcut.

I am only interested in plain text saved from a text editor. No fancy Office formatting or anything...


Thanks,

admin
Site Admin
Posts: 60538
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Copy file contents

Post by admin »

eurytos wrote:Is it possible to copy a file's contents to the clipboard without opening it? Preferably from the context menu or keyboard shortcut.

I am only interested in plain text saved from a text editor. No fancy Office formatting or anything...


Thanks,
You mean without you opening it. Will be possible soon via scripting. But of course a file must be opened to get the contents.

eurytos
Posts: 200
Joined: 29 Jan 2008 15:53

Re: Copy file contents

Post by eurytos »

admin wrote:
eurytos wrote:Is it possible to copy a file's contents to the clipboard without opening it? Preferably from the context menu or keyboard shortcut.

I am only interested in plain text saved from a text editor. No fancy Office formatting or anything...


Thanks,
You mean without you opening it. Will be possible soon via scripting. But of course a file must be opened to get the contents.
yeah without me opening it. I have a folder (named _scripts go figure :) ) that contains a bunch of scripts or syntax I use alot. For a large portion of them I open them for the sole purpose of copy/paste into whatever app I am going to run them from so it would be nice if I could throw the contents to the clipboard.

Or possibly even copy/paste from the preview window?

Thanks,

j_c_hallgren
XY Blog Master
Posts: 5824
Joined: 02 Jan 2006 19:34
Location: So. Chatham MA/Clearwater FL
Contact:

Re: Copy file contents

Post by j_c_hallgren »

eurytos wrote:For a large portion of them I open them for the sole purpose of copy/paste into whatever app I am going to run them from so it would be nice if I could throw the contents to the clipboard.
Have you checked out the idea of using a clipboard manager for this task?
So that you can maintain a bunch of various items within it and move to clipboard as needed?
The one that I use is called CLCL (freeware) and it's only problem is a lack of documentation so there are a number of things/features I've no idea on what they do! :roll:
However, I can right-click on the tray icon for it, see the list of all items I've saved (via previous Cntl-C), select one and left-click it, and it's then pasted at current cursor plus copied to actual "clipboard"....You can review these entries and delete as needed.
Still spending WAY TOO much time here! But it's such a pleasure helping XY be a treasure!
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Re: Copy file contents

Post by jacky »

admin wrote:You mean without you opening it. Will be possible soon via scripting. But of course a file must be opened to get the contents.
mmm... "soon" ! :D ;)
eurytos wrote:Or possibly even copy/paste from the preview window?
No paste, no, as it's a viewer only, but you can right-click and copy from the preview, yes. (Given that it's done through XY's internal (Raw) viewer, otherwise it may depend on the app actually used, eg. Office for *.doc files, etc)
Proud XYplorer Fanatic

eurytos
Posts: 200
Joined: 29 Jan 2008 15:53

Re: Copy file contents

Post by eurytos »

jacky wrote:
admin wrote:You mean without you opening it. Will be possible soon via scripting. But of course a file must be opened to get the contents.
mmm... "soon" ! :D ;)
eurytos wrote:Or possibly even copy/paste from the preview window?
No paste, no, as it's a viewer only, but you can right-click and copy from the preview, yes. (Given that it's done through XY's internal (Raw) viewer, otherwise it may depend on the app actually used, eg. Office for *.doc files, etc)

I didn't mean paste into the preview, just the ability to copy from it and paste into another app. I didn't think about right-click --> select all because I usually cntrl-a, cntrl-shift-home or cntrl-shift-end when I select all and that did not appear to work. But, right-click --> select all, cntrl-c does and I think I will be able to get used to that fairly easily.

Thanks,

I think I need to work on some custom keyboard shortcuts.

edit: the cntrl-a not working was because the preview format was not associated with anything so it was doing raw preview. If I try the same on a file with a .txt extension it works fine.

hmm

now to find a way to tell it .sql files should be previewed same way .txt files....

serendipity
Posts: 3358
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: Copy file contents

Post by serendipity »

eurytos wrote:
jacky wrote:
admin wrote:You mean without you opening it. Will be possible soon via scripting. But of course a file must be opened to get the contents.
mmm... "soon" ! :D ;)
eurytos wrote:Or possibly even copy/paste from the preview window?
No paste, no, as it's a viewer only, but you can right-click and copy from the preview, yes. (Given that it's done through XY's internal (Raw) viewer, otherwise it may depend on the app actually used, eg. Office for *.doc files, etc)

I didn't mean paste into the preview, just the ability to copy from it and paste into another app. I didn't think about right-click --> select all because I usually cntrl-a, cntrl-shift-home or cntrl-shift-end when I select all and that did not appear to work. But, right-click --> select all, cntrl-c does and I think I will be able to get used to that fairly easily.

Thanks,

I think I need to work on some custom keyboard shortcuts.

edit: the cntrl-a not working was because the preview format was not associated with anything so it was doing raw preview. If I try the same on a file with a .txt extension it works fine.

hmm

now to find a way to tell it .sql files should be previewed same way .txt files....
If its a text file ctrl+a and ctrl+c should work in preview mode (not Raw View).

eurytos
Posts: 200
Joined: 29 Jan 2008 15:53

Re: Copy file contents

Post by eurytos »

serendipity wrote:
eurytos wrote:
jacky wrote:
admin wrote:You mean without you opening it. Will be possible soon via scripting. But of course a file must be opened to get the contents.
mmm... "soon" ! :D ;)
eurytos wrote:Or possibly even copy/paste from the preview window?
No paste, no, as it's a viewer only, but you can right-click and copy from the preview, yes. (Given that it's done through XY's internal (Raw) viewer, otherwise it may depend on the app actually used, eg. Office for *.doc files, etc)

I didn't mean paste into the preview, just the ability to copy from it and paste into another app. I didn't think about right-click --> select all because I usually cntrl-a, cntrl-shift-home or cntrl-shift-end when I select all and that did not appear to work. But, right-click --> select all, cntrl-c does and I think I will be able to get used to that fairly easily.

Thanks,

I think I need to work on some custom keyboard shortcuts.

edit: the cntrl-a not working was because the preview format was not associated with anything so it was doing raw preview. If I try the same on a file with a .txt extension it works fine.

hmm

now to find a way to tell it .sql files should be previewed same way .txt files....
If its a text file ctrl+a and ctrl+c should work in preview mode (not Raw View).
I discovered that. Now I am trying to figure out how to preview a .sql extension just like it would a .txt extension instead of going to raw format.

I found:

; Tweak: user custom extensions, format eg: '.rm.ra.ext.'
ImagePreviewCustomExtensions=
MediaPreviewCustomExtensions=
OfficePreviewCustomExtensions=

but I do not seem to be having much luck after trying some variations of:
.sql, sql, 'sql', '.sql', "sql"

I will figure it out sooner or later

and of course thanks for all the help!


edit: I have had sql defined in the custom file associations to open with notepad for some time and that works perfectly.

serendipity
Posts: 3358
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: Copy file contents

Post by serendipity »

eurytos wrote: I found:

; Tweak: user custom extensions, format eg: '.rm.ra.ext.'
ImagePreviewCustomExtensions=
MediaPreviewCustomExtensions=
OfficePreviewCustomExtensions=

but I do not seem to be having much luck after trying some variations of:
.sql, sql, 'sql', '.sql', "sql"

I will figure it out sooner or later

and of course thanks for all the help!


edit: I have had sql defined in the custom file associations to open with notepad for some time and that works perfectly.
There should be dot after extension too. Like .sql.
See wiki reference below for explanation:
http://88.191.26.34/XYwiki/index.php/IN ... to_Preview

eurytos
Posts: 200
Joined: 29 Jan 2008 15:53

Post by eurytos »

Thanks!

I was just coming back to post that I found it on the wiki.

Although the behavior does not act as I expected. I don't think it is xyplorer's fault though.

If I add the extension I am prompted with an open/save/cancel dialog box when i click on a file with that extentsion. If I choose to open it Microsoft SQL Server Management Studio launches to display the file.

serendipity
Posts: 3358
Joined: 07 May 2007 18:14
Location: NJ/NY

Post by serendipity »

A general rule is that if you can open something with internet explorer then XY can preview it too.

eurytos
Posts: 200
Joined: 29 Jan 2008 15:53

Post by eurytos »

Yeah I know xyplorer can preview the files because they display correctly if I change the extension to .txt. It must be because the sql file extension is associated with SQL Management Studio outside of xyplorer even though I have it set in xyplorer to open with notepad.

I could just change all the extensions to .txt but then I would have to tell notepad++ to display the document as a sql file everytime I opened one instead of it doing it by default.

I think I may be back to right-click select all with the raw format which is still good. Especially if the ability to copy the file contents is on the way!

Thanks again to everyone who posted here for all their help.

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Post by TheQwerty »

If you get yourself AutoHotkey you can use the following compiled to an exe, and then use XY's open with to add the contents of any number of files to the clipboard.

Code: Select all

result := ""
Loop %0% {
	arg := %A_Index%
	FileRead input, %arg%
	result := result . input . "`r`n"

}
StringTrimRight result, result, 2
Clipboard := result

eurytos
Posts: 200
Joined: 29 Jan 2008 15:53

Post by eurytos »

TheQwerty wrote:If you get yourself AutoHotkey you can use the following compiled to an exe, and then use XY's open with to add the contents of any number of files to the clipboard.

Code: Select all

result := ""
Loop %0% {
	arg := %A_Index%
	FileRead input, %arg%
	result := result . input . "`r`n"

}
StringTrimRight result, result, 2
Clipboard := result
I appreciate the tip, thanks!

I will take a look at this

Post Reply