Page 1 of 1

Setting not supported by Tweak

Posted: 27 Oct 2021 14:38
by c0thirty
Hello, I'm trying to create a button that will toggle the "Apply to files only" option for visual filters. I found a forum thread suggesting the Tweak function and tried that after looking up the setting in the ini:
::tweak("VFApplyToFilesOnly", "");
but I get "Key 'VFApplyToFilesOnly' is not supported by Tweak." I checked the scripting reference and found the setting and settingp commands but those don't seem to work either.
::settingp("VFApplyToFilesOnly", 1);
"vfapplytofilesonly" is not a known parameter of command "settingp".

I'm curious why every setting can't be changed by the tweak command? Later on I'd also like to make a script to toggle multiple settings at once, for example, simultaneously turning off thumbnail captions, reducing the padding to 0, and setting the style to Plain, and clicking again to enable caption, set padding to 2, and set the style to Frame with Shadow. Is such a thing possible?

Re: Setting not supported by Tweak

Posted: 27 Oct 2021 14:50
by highend
1. viewtopic.php?p=120052#p120052
Supported keys

2. The same, setting / settingp support the listed names in that help file entry

Use thumbsconf / setkey for everything else
Is such a thing possible
Sure but you are aware that this will require a XY restart (for things that would require setkey)?

Re: Setting not supported by Tweak

Posted: 27 Oct 2021 14:56
by klownboy
Only certain tweaks can be changed on the fly and the same with SC setting. Refer to viewtopic.php?p=120052#p120052 for the undocumented tweak command and refer to the Help > Scripting Commands Reference for information on SC setting.

Refer to the Help > Scripting Commands Reference for information on SC thumbsconf. You can change these thumbnail related settings on the fly with thumbsconf([settings="ShowCaption,ZoomToFill,Style,Padding"], [separator=","]).

I see highend beat me to it. :)

Re: Setting not supported by Tweak

Posted: 27 Oct 2021 20:11
by c0thirty
Thanks fellows, here's what I ended up with. The thumbnail toggle works great, but the toggle apply to files feels a little clunky, and seems to open duplicate windows rather than purely restarting sometimes. Is there a better way to handle it?

Code: Select all

"Toggle Thumbnail Captions"
	$tc = thumbsconf();
	$tcShowCaption = gettoken($tc, 1, ",");
	if ($tcShowCaption == 1) {
		thumbsconf("0,1,3,2");
	} else {
		thumbsconf("1,1,4,2");
	}

"Toggle Apply to Files"
	savesettings;
	$a = getkey("VFApplyToFilesOnly", "General");
	if ($a == 1) {
		setkey(0, "VFApplyToFilesOnly", "General");
	} else {
		setkey(1, "VFApplyToFilesOnly", "General");
	}
	exit "nr";