Page 1 of 1
Refresh a single file's thumbnail in a script.
Posted: 15 Nov 2012 21:27
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
Re: Refresh a single file's thumbnail in a script.
Posted: 15 Nov 2012 21:31
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.
Re: Refresh a single file's thumbnail in a script.
Posted: 15 Nov 2012 23:40
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
Re: Refresh a single file's thumbnail in a script.
Posted: 16 Nov 2012 09:12
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.
Re: Refresh a single file's thumbnail in a script.
Posted: 16 Nov 2012 14:49
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
Re: Refresh a single file's thumbnail in a script.
Posted: 16 Nov 2012 15:17
by admin
Yes, exactly. I already added it. Will be #506;

Re: Refresh a single file's thumbnail in a script.
Posted: 17 Nov 2012 02:23
by klownboy
Absolutely great! Thanks Don
Re: Refresh a single file's thumbnail in a script.
Posted: 18 Nov 2012 20:46
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
Re: Refresh a single file's thumbnail in a script.
Posted: 19 Nov 2012 08:04
by admin
The scripting command selectitems could be used before calling 506.
Re: Refresh a single file's thumbnail in a script.
Posted: 19 Nov 2012 21:17
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