How to copy basic file properties to clipboard?

Most probably I have been looking at the wrong place, but i have vainly been searching for a script that copies basic file properties to clipboard.
Such as filename.ext, path, modified date, size

thanks

Look under Edit/Copy Other/complete folder listing this might be what you are looking for or something to adapt.

I think its a default button.. if not here it is.


Print FOLDER AS=txt TO=clip FLATVIEW=no QUIET

Thanks. However, I would like to print the file properties of a single file to clipboard.

=

Hover over a file to show its infotip. While it is still showing, push Ctrl-Shift-Alt C and the text of the infotip will be copied to the clipboard.

You can customize which information is in the infotips via Settings > File Types.

That is probably the easiest way to get custom information for a single file into the clipboard. Using scripting would let you do something more esoteric.

(There are built-in menu items if you just want the file names or paths, of course. And the Print/Export Folder Listing tool is good for getting details of multiple files.)

The Print FOLDER command can also be made to only print selected files.

Nice. First time I hear of that capability. That key combination does not appear on the Keyboard Map (Prefs KEYS). I also don't see it on the manual. I could not reproduce it with Explorer, so I guess it is an exclusivity of Opus. Is that correct? If yes, is it mentioned anywhere on the manual? (As I could not find any mention there).

Thanks Leo.
I wasn't aware of this key combination either. That aside, I am afraid, with me, nothing happens. Like with andersonnnunes it is not listed as a hotkey (Preferences->Toolbars->Keys).
Tried other combinations (shift-ctrl-c, alt-shift-c, etc.) nothing..

The below is what I am looking for:

File: custom_menu.ini
Path: E:\blabla\folder\subfolder\Settings
Size: 137 bytes
Creation Date: 06-09-2014 β€β€Ž14:50:41
Modified Date: β€Ž11-06-2015 β€β€Ž07:04:25

Right now, I copy each separate item to clipboard and then 'merge' the items to a single clip.

=

It's not a command so it doesn't have a hotkey. It's just a little feature of the info tip.

Okay, thanks.
Bad luck then.

Paste below into a jscript, script function in new button/shortcut.

function OnClick(data)
{
	data.func.command.deselect = false;
	var clipboard = "";

	var sel = new Enumerator(data.Func.sourcetab.selected_files);
	sel.moveFirst();
	while (sel.atEnd() == false)
	{
		clipboard += "File: " + sel.item().name + "\r\n" +
					 "Path: " + sel.item().path + "\r\n" +
					 "Size: " + sel.item().size.fmt + "\r\n" + 
					 "Creation Date: " + formatDate(sel.item().create) + "\r\n" + 
					 "Modified Date: " + formatDate(sel.item().modify) + "\r\n\r\n";
		sel.moveNext();
	}
	DOpus.SetClip(clipboard);
}
function formatDate(date) {return date.Format("D#MM-dd-yyyy T#HH:mm:ss");}

Script doesn't copy directories.

created a button, script type JScript, pasted above into the box.
when running: no errors "script completed" but regretfully nothing happens.
nothing in clipboard.
what is supposed to happen?

=

Do you have some files selected when you click the button?

Where does it say "script completed"?

  1. Yes
  2. In the logfile (Other logs -> Script Output)

=

The script log would not normally display "Script Completed", at least not for the script above when run from a button or hotkey.

Can you show a screenshot of the button editor so we can see how the script has been set up?

It is rather big screenshot, I am sorry.
The 'green lines' are removed so to reduce the size of the screenshot.
Pasted 'script completed ' right hand top.

=

You don't seem to have pasted the script that @yonder gave you in at all.

AI !
I should take the first plane to Georgia, go and hide in the deepest cave out there.
Else I honestly wouldn't know where to hide...

Actually I clipboard copied the script, then created a toolbar button, selected 'script', then the contents above showed up automatically and at that point, I have to confess and that with a lot of shame, one way or the other I assumed it was copied or so automatically. Felt the code looked different, but didn't check further - was more eager to see the results. tsk, tsk, tsk...

The button works fine now!

@yonder: Many thanks indeed, this is exactly what I was looking for. Perfect.

Deeply sorry for the confusion ...

=

@yonder
I know this is an old thread.

Is there a way to add MD5 and/or SHA1 to the above?

Say, below "Modified Date: " .... a new line:
"MD5": ...

Thanks

The script is reading properties of the Item. The item has many metadata properties, perhaps you can find what you want int there.
Else you might need to get the value another way and add it to the clipboard.
See these

I didn't use DOpus.FSUtil.Hash because the Clipboard COPYNAMES=hash3 command pops up a progress bar so you'll know when the clipbaord is ready to paste when calculating bigger files.

Reminding you that this script only works with files (as I pointed out in my first post)

The way this script was written folders cannot be considered while performing the hash calculations. Otherwise the md5 assigned to a given file would be offset in the list, in other words not correct.

function OnClick(data)
{
	var hash = [], clipboard = "", nl = "\r\n";
	var tclip = DOpus.GetClip();
	var cmd = data.func.command;
	cmd.deselect = false;

	cmd.ClearFiles();
	cmd.AddFiles(data.func.sourcetab.selected_dirs);
	cmd.RunCommand("Select DESELECT FROMSCRIPT")

	var sel_files = data.func.sourcetab.selected_files;
	cmd.ClearFiles();
	cmd.AddFiles(sel_files);
	cmd.RunCommand("Clipboard COPYNAMES=hash3");
	hash = String(DOpus.GetClip("text")).split(nl);

	if (sel_files.count != hash.length)
	{
		DOpus.Output("Unknown error while calculating hashes", true, true);
		cmd.RunCommand("Set UTILITY=otherlog");
		DOpus.SetClip(tclip);
		return;
	}
	
	for (var i=0; i<sel_files.count; i++)
	{
		clipboard += "File: " + sel_files(i).name +nl+
					 "Path: " + sel_files(i).path +nl+
					 "Size: " + sel_files(i).size.fmt +nl+
					 "Creation Date: " + formatDate(sel_files(i).create) +nl+
					 "Modified Date: " + formatDate(sel_files(i).modify) +nl+
					 "MD5: " + hash[i] +nl+nl;
	}
	DOpus.SetClip(clipboard);
}

function formatDate(date) {return date.Format("D#MM-dd-yyyy T#HH:mm:ss");}

The actual deselecting of the folders is not required and was added in for visual reasons. If you want folders to remain selected you can just comment out the three lines below and the folders still will not be accounted for in the hash calculations

//cmd.ClearFiles();
//cmd.AddFiles(data.Func.sourcetab.selected_dirs);
//cmd.RunCommand("Select DESELECT FROMSCRIPT")