Refresh a single file's thumbnail in a script.

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
klownboy
Posts: 4481
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.8737 at 100% 2560x1440

Refresh a single file's thumbnail in a script.

Post by klownboy »

Is it possible to refresh a thumbnail for a single file in a script? In an earlier post I asked a similar question about doing a single file/thumbnail refresh within XYplorer and Don replied stating:
is there any way to refresh the thumbnail for a single file?
Yep, right click the Views or Toggle Thumbnails button on the toolbar to get the commands.
I'd like to be able to do this in a script however. I've been working on a number of scripts which crop photos and wallpaper, but typically the resultant thumbnail is bad (i.e., I receive a "bad image" instead of a new thumbnail). In every case the image is fine, it's the thumbnail that's bad. I've placed "waits" in the script, but after a large image is modified and new file generated, the thumbnail is usually bad...until it's refreshed. I didn't see it in the commands list.
Any thoughts?
Don if it's not possible to refresh a thumbnail for a specific file in a script, could a command be added (a quality refresh)?
Thanks,
Ken

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

Re: Refresh a single file's thumbnail in a script.

Post by admin »

It could be added, but there is no time for it now. Sorry, but MLS has total priority now, probably at least for the rest of the year.

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

Re: Refresh a single file's thumbnail in a script.

Post by klownboy »

I assume that means it's not currently possible in scripting. Thanks for keeping it in mind when MLS is not occupying so much of your time.
Ken

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

Re: Refresh a single file's thumbnail in a script.

Post by admin »

klownboy wrote:I assume that means it's not currently possible in scripting. Thanks for keeping it in mind when MLS is not occupying so much of your time.
Ken
It might an idea to add this command (Refresh Selected Thumbnails) to the main menu (View | Caches | ...). Then you could also have a KS for it.

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

Re: Refresh a single file's thumbnail in a script.

Post by klownboy »

Being on the Main Menu with a KS as you said, does that mean you would have a command # associated with it as well which could be invoked in a script? Probably a stupid question because it does appear you have command numbers for most or all Main Menu commands.
Thanks Don

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

Re: Refresh a single file's thumbnail in a script.

Post by admin »

Yes, exactly. I already added it. Will be #506; :)

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

Re: Refresh a single file's thumbnail in a script.

Post by klownboy »

Absolutely great! Thanks Don

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

Re: Refresh a single file's thumbnail in a script.

Post by klownboy »

Thanks Don for the addition of thumbnail refresh of selected files (#506). Unfortunately for my situation where I am converting an image file into a new file with a different aspect ratio via cropping (and keeping the original intact), the new #506 command does not update the thumbnail for the newly generated file (via Irfanview or Image Magick) only the currently selected file or files.

Is there someway I can apply the the new thumbnail refesh to a specific file of which I would have the names generated in the script. For example after using a command similar to:

Code: Select all

run """$g_IrfanPath"" $file /aspectratio /jpgq=100 /crop=($x_crop, $y_crop, $width, $height) /convert=$path\". $base ."_$xy.$ext", , 2,0;
#506;
Or if that's not possible, there must be a way via scripting to add a newly generated file to the selected file(s) such that it is then refreshed via command #506? Maybe through use of "selectitems" but I don't want to affect the original list of selected image files that I would be modifying in the script via foreach command. So I suppose the thumbnail refresh would have to be accomplished at the end of the script after all files have been updated.
Thanks again,
Ken

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

Re: Refresh a single file's thumbnail in a script.

Post by admin »

The scripting command selectitems could be used before calling 506.

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

Re: Refresh a single file's thumbnail in a script.

Post by klownboy »

I did have success with "selectitems" command to refresh thumbnails. The only difficult part was restoring the original selected items after the "foreach" loops were completed. Your example in the "Help on scripting commands" did it.
Thanks Don,
Ken

Post Reply