Hi,
I forgot it was you [Stefan] who had coded this nice JPG collector script using HTML. I tinkered with it such that the file listing ($file) would get sorted after the new files were added/appended to the listing. Sorting makes it easier to review if I need to at some point. I also was trying to remove any duplicate entries. Please refer to the partial code additions below that I made to the script. However, if/when the existing last file entry in "$file" does not have a line return the first new file entry (in the $SelFiles list) is added to the end of the last existing file entry which is obviously not what I want and obviously because of that sorting is incorrect. See the example line entry and script change:
Code: Select all
G:\Wallpaper\1920x1080\Ireland\White Park Bay, Ireland_16x9.jpgG:\Downloads\porshe.jpg
Code: Select all
// see original code for what is before and after this...
if ($Action == "actCollOpen"){
writefile( $file, $SelFiles, "a" );
// I assume I have to append the new files first, read the new file to a variable, and then format it before rewriting.
$a = readfile($file);
$b = formatlist($a, "sde", "<crlf>");
writefile( $file, $b, "o");
run "D:\Tools\Textpad\TextPad.exe" $file;
end(1);
}
I'm part way there, but with the issue mentioned above though I'm sure my addition to the script could be substantially cleaner as well. How do I properly sort the file listing and have a line return at the end and no blank line returns in the front as well.
I also wanted to show how I tweaked the script up front to allow its use for multiple JPG collector files by using hidden labels called or loaded from a CTB menu. Maybe someone else could use something along these lines. I use it to collect JPG files (cropped for wallpaper) for different places visited and subsequently use it in a Windows taskbar icon via Irfanview to display wallpaper and photos in the JPG collector file(s). You can have a few different icons on your taskbar and when you're in the mood to see pictures of Hawaii you can click on that icon or if you're in the mood to see pictures of Guam or Ireland you can click the appropriate icon. One could use it for collecting files for a number of things. As an example, I call out the JPG collector file in another script as part of a larger menu as so:
Code: Select all
"Ireland JPG collector|:viewthumbs" load "D:\Tools\XYplorer\Scripts\JPG_collector.xys", "Ireland", f;
"Maine JPG collector|D:\Graphics\Icons\wallpaper.ico" load("D:\Tools\XYplorer\Scripts\JPG_collector.xys", "Maine", f);
And the beginning of your JPG collector script I have modified it as so:
Code: Select all
"_Ireland : Ireland";
global $file;
$file= "G:\Pictures\Ireland Trip 2011\Ireland_16x9.txt";
sub "_Exec_Code";
"_Maine : Maine";
global $file;
$file= "G:\Pictures\Maine\Maine_16x9.txt";
sub "_Exec_Code";
"_Exec_Code";
global $file;
$html = urldecode(html('<html><body><form method="get" action="xys:">
//the rest is the same with the exception of the formating lines I've added above.
Any ideas on what I'm doing wrong in "formatlist"? I've tried way too many combinations of parameters and it's still not what I'd like.
Thanks,
Ken