Need script for collect item/s path/s (#101), to text file

Discuss and share scripts and script files...
admin
Site Admin
Posts: 66299
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Need script for collect item/s path/s (#101), to text fi

Post by admin »

I haven't read this thread very carefully but note that I have (probably) posted something similar (as toolbar button made by a snippet) some time ago: http://www.xyplorer.com/xyfc/viewtopic. ... 045#p59045

Marco
Posts: 2354
Joined: 27 Jun 2011 15:20

Re: Need script for collect item/s path/s (#101), to text fi

Post by Marco »

klownboy wrote:Thanks Marco and Stefan, the small script makes it easy to add selected files to a file list. Irfanview has a great wallpaper feature that allows you to change wallpaper on-the-fly using command line parameters similar to this example:

Code: Select all

D:\Graphics\IrfanView\i_view32.exe /filelist=G:\Pictures\Ireland Trip 2011\Ireland_16x9.txt /random /wall=3 /killmesoftly
So using your little script and assigning it a catalog item or toolbar button allows me to quickly add files to the list. I've assigned the above irfanview command as a pinned item on the taskbar so one click on its icon and the wallpaper changes and without background resources overhead. Very slick!
Thanks,
Ken
It's curious, one of my first XY scripts was just a wallpaper changer!
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

klownboy
Posts: 4459
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.8037 at 100% 2560x1440

Re: Need script for collect item/s path/s (#101), to text fi

Post by klownboy »

Hi Don, thanks for the pointer to "Item Store". As it turns out I had a Customized Toolbar Button for "Item Store" and just lost track of it and it's purpose. I've now combined the scripts for "Item Store" and what I call "Irfanview JPG collector" from this thread into one script since they serve similar purposes.
Thanks,
Ken

kiwichick
Posts: 675
Joined: 08 Aug 2012 04:14
Location: Windows 10 Pro 22H2, 150% scaling

Re: Need script for collect item/s path/s (#101), to text fi

Post by kiwichick »

klownboy wrote:

Code: Select all

run D:\Tools\TextPad\TextPad.exe $file;
Oh thank you to the gods that sent klownboy :appl: I was specifically looking for something like this and was stoked when I found your post! Had to fiddle a bit with the quotes but got it sorted. Now I can change my wallpaper at the click of a button :biggrin: This ROCKS!!!
Windows 10 Pro 22H2

klownboy
Posts: 4459
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.8037 at 100% 2560x1440

Re: Need script for collect item/s path/s (#101), to text fi

Post by klownboy »

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

klownboy
Posts: 4459
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.8037 at 100% 2560x1440

Re: Need script for collect item/s path/s (#101), to text fi

Post by klownboy »

I finally got the formatting to work in my above post. It simply took a "<crlf>" in the last writefile. By doing that, the newly appended files to the file listing are not added to the last file but on a new line.

Code: Select all

writefile($file, $b.<crlf>, "o");
Thanks,
Ken

Post Reply