Page 1 of 1
To Clipboard - > comma separated values
Posted: 08 Dec 2011 00:57
by bugger
Select a file(s) and then do a File -> To Clipboard -> Names, Bytes, Modified, Version.
This would be great for importing as CSV file, but the problem is that the Bytes field also use commas so a file with size 1,333,222 will have more commas than a file with 1,023 bytes, making for problems when importing into a spreadsheet.
Re: To Clipboard - > comma separated values
Posted: 08 Dec 2011 01:05
by highend
Write a simple script that uses regexreplace() to replace the commas with dots?
Re: To Clipboard - > comma separated values
Posted: 08 Dec 2011 01:14
by bugger
Ok, been a while since I played with scripts... Could just replace them with nothing and I'd be happy

Re: To Clipboard - > comma separated values
Posted: 08 Dec 2011 01:18
by PeterH
Switch to German?
Mine says: ..., 13.215.088 bytes, 11.01.2008 21:49:14, ...
i.e. it's dependent from localization.
How do you import? Comma-separated fields?
Re: To Clipboard - > comma separated values
Posted: 08 Dec 2011 01:28
by highend
Code: Select all
$input = "<clipboard>";
$output = "";
foreach($line, "$input", "<crlf>"){
$number = gettoken("$line", 2, ", ");
$newnumber = replace("$number", ",", "");
$newline = replace("$line", "$number", "$newnumber");
$output = $output . $newline . <crlf>;
}
text $output;
Outputs this:
Code: Select all
Fabia_MonteCarlo_2011_06.pdf, 1402218 bytes, 06.12.2011 03:42:39
linuxmint-12-gnome-dvd-64bit.iso, 1066518528 bytes, 27.11.2011 20:06:36
RENESAS-USB3-Host-Driver-21280-setup.exe, 9742464 bytes, 11.11.2011 11:22:52, ver 2.1.28.0
From this:
Code: Select all
Fabia_MonteCarlo_2011_06.pdf, 1,402,218 bytes, 06.12.2011 03:42:39
linuxmint-12-gnome-dvd-64bit.iso, 1,066,518,528 bytes, 27.11.2011 20:06:36
RENESAS-USB3-Host-Driver-21280-setup.exe, 9,742,464 bytes, 11.11.2011 11:22:52, ver 2.1.28.0
Ack?
Re: To Clipboard - > comma separated values
Posted: 08 Dec 2011 08:40
by bugger
Ack, I'd say so thanks

Now is there a way to save $output back to the <clipboard>? So I don't have to bother with the dialog box.
Re: To Clipboard - > comma separated values
Posted: 08 Dec 2011 09:49
by highend
Re: To Clipboard - > comma separated values
Posted: 08 Dec 2011 12:33
by TheQwerty
Erm.. if you're going to use scripting why not just use report instead?
Code: Select all
"Name(s), Raw Bytes, Modified, FileVersion"
// Get information on all items in list when nothing is selected.
$useSelection = Get('CountSelected') > 0;
$csv = Report("{Name}, {Size RAW}, {Modified}, {FileVersion}<crlf>", $useSelection);
CopyText $csv;
Then you can fully control the formatting of the size and date, plus customize it for your needs.
Re: To Clipboard - > comma separated values
Posted: 10 Dec 2011 20:46
by bugger
Ah very nice TheQwerty, thanks much.