Script to toggle "main contents" font size?

Discuss and share scripts and script files...
ghost zero
Posts: 842
Joined: 26 Apr 2010 17:48

Re: Script to toggle "main contents" font size?

Post by ghost zero »

a script to toggle "main contents" font size between default size and size 14? I want to make a button to toggle it.
i was hoping that was possible. but turns out it's not. the only other ways are workarounds that aren't quite the same.

ideally, i want this as a toolbar button and i'd make a custom icon for it, etc. i'm a mousey user.

ghost zero
Posts: 842
Joined: 26 Apr 2010 17:48

Re: Script to toggle "main contents" font size?

Post by ghost zero »

i appreciate your efforts to solve this. but unfortunately, the possibilities at the moment are not desirable to me. here's why...

the first suggestion to use the AHK program is no good, because it requires the use of an additional program--which hinders portability and also makes things too complicated.

the second suggestion with the current XY scripting capabilities is not ideal due to the need to always poke around in a right click menu to workaround its limitations. my ideal choice is a toggle button that can always do my requested functionality with the efficiency of 1-click, without this cumbersome workflow...
TheQwerty wrote: Note however that strictly speaking this will not toggle between the default size and 14, but rather it will increase/decrease the current size 5 times. So if you use this to toggle to large fonts and then zoom out on your own the next time you press the button it will zoom out even further.

For that reason I've given the button some right-click scripts to quickly access the normal zoom in/out buttons and also to set the state of the button without adjust the font size.
that's why i would prefer don add a script command to make my original request possible.

highend
Posts: 14560
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Script to toggle "main contents" font size?

Post by highend »

Have some fun while waiting on that to happen...
One of my scripts helped you out? Please donate via Paypal

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Script to toggle "main contents" font size?

Post by TheQwerty »

The limitations of the script that I mentioned back then could be eliminated by using Get('Status', 2); to retrieve the new font size.

ghost zero
Posts: 842
Joined: 26 Apr 2010 17:48

Re: Script to toggle "main contents" font size?

Post by ghost zero »

please unlock my other topic in which i'm officially requesting this feature...
http://www.xyplorer.com/xyfc/viewtopic. ... 644#p99644

the request is similar but different, so don't get them confused. this topic is an attempt to request a script. the other topic requests an official feature that makes the functionality universally built-in for all users, and easily tweakable via configuration.

just because i've attempted to script this function before doesn't mean i not allowed to request it as an official feature. so please unlock it since it's a valid feature request.

ghost zero
Posts: 842
Joined: 26 Apr 2010 17:48

Re: Script to toggle "main contents" font size?

Post by ghost zero »

TheQwerty wrote:The limitations of the script that I mentioned back then could be eliminated by using Get('Status', 2); to retrieve the new font size.
if the efficient 1-click functionality is now possible to do via scripting, can you please post an updated script? since i'm not a scripter, i wouldn't know how to edit it.

also, i still want the other official request topic to be unlocked, since it is to be discussed as an official feature instead of a script.

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Script to toggle "main contents" font size?

Post by TheQwerty »

Code: Select all

"Toggle Font Size"
	$minSize = 9;
	$maxSize = 14;

	// Determine the current font size.
	Button('zoomin', 1);
	Button('zoomout', 1);
	$sizeRegex = '^.*?(\d*[.,]?\d+).*$';
	$size = RegexReplace(Get('Status', 2), $sizeRegex, '$1');

	if ($size > $minSize) {
		// Zoom out until the current size is smaller.
		while ($size > $minSize) {
			Button('zoomout', 1);
			$size = RegexReplace(Get('Status', 2), $sizeRegex, '$1');
		}
	} else {
		// Zoom in until the current size is bigger.
		while ($size < $maxSize) {
			Button('zoomin', 1);
			$size = RegexReplace(Get('Status', 2), $sizeRegex, '$1');
		}
	}

ghost zero
Posts: 842
Joined: 26 Apr 2010 17:48

Re: Script to toggle "main contents" font size?

Post by ghost zero »

thanks TheQwerty. aside from the 1 second delay it takes to run, it works pretty well. :)

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

Re: Script to toggle "main contents" font size?

Post by admin »

ghost zero wrote:thanks TheQwerty. aside from the 1 second delay it takes to run, it works pretty well. :)
Hm, you are looking for it, dont' you? ghost zero, one more "request topic to be unlocked" from you and you will have to leave. :naughty:

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

Re: Script to toggle "main contents" font size?

Post by klownboy »

That was a nice idea TheQwerty using get('Status', 2) to obtain the current font size. :appl: I probably wouldn't use this much unless my eye sight gets even worse. :) It will go in my XY scripting techniques folder incase I want to refer or use it later. Just for kicks, I may modify it make the CTB icon changes with the font change (i.e., CTBstate & CTBicon) as you made on the previous version in this thread.
Thanks,
Ken

Edit: I meant to add that the default font size on my systems is 8.25. I say that only because I initially didn't see the min font size of "9" in the script so when it returned to the starting font it was larger than what I had initially at "9" in lieu of "8.25". All was well when I changed the value to 8.25.

ghost zero
Posts: 842
Joined: 26 Apr 2010 17:48

Re: Script to toggle "main contents" font size?

Post by ghost zero »

admin wrote:
ghost zero wrote:thanks TheQwerty. aside from the 1 second delay it takes to run, it works pretty well. :)
Hm, you are looking for it, dont' you? ghost zero, one more "request topic to be unlocked" from you and you will have to leave. :naughty:
i don't get it. i'm not even making trouble or anything--just normal posts. what is the problem you guys have with me?

j_c_hallgren
XY Blog Master
Posts: 5826
Joined: 02 Jan 2006 19:34
Location: So. Chatham MA/Clearwater FL
Contact:

Re: Script to toggle "main contents" font size?

Post by j_c_hallgren »

ghost zero wrote:please unlock my other topic in which i'm officially requesting this feature...
http://www.xyplorer.com/xyfc/viewtopic. ... 644#p99644

the request is similar but different, so don't get them confused. this topic is an attempt to request a script. the other topic requests an official feature that makes the functionality universally built-in for all users, and easily tweakable via configuration.

just because i've attempted to script this function before doesn't mean i not allowed to request it as an official feature. so please unlock it since it's a valid feature request.
I don't want to step into any of Don's territory but I'll take a guess at why your unlock request wasn't well received:
You had this thread going which maybe wasn't getting what you felt was the perfect solution...so...you then created a Wish thread as a spin-off...BUT...you've been here long enough to know that Don will act on wishes embedded in other threads on occasion as he's not quite that picky/precise on Wishes being ONLY in that subforum...and then that other thread got locked (which probably is appropriate given the duality of threads) and you came back here to complain...given that scenario, I think I understand why you got the reaction above, ok?

I think you should not have made that other thread because while it's true that it's a feature request, it could and was made HERE as well...had you been a rookie here, maybe the reaction would be a bit different but given you're a regular, you know not to do so, ok? I'm just trying to mediate a bit and help all calm down so nobody gets too upset.

That's what I'm percieving from reading this situation..may be wrong but suspect not.
Still spending WAY TOO much time here! But it's such a pleasure helping XY be a treasure!
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.

ghost zero
Posts: 842
Joined: 26 Apr 2010 17:48

Re: Script to toggle "main contents" font size?

Post by ghost zero »

well i've been here for a long time but mainly as a poster--not a lurker. i mainly only read replies to my own topics. i'm not savvy on don's preferences on these things, so the situation is confusing.
Last edited by ghost zero on 04 Feb 2014 08:50, edited 1 time in total.

j_c_hallgren
XY Blog Master
Posts: 5826
Joined: 02 Jan 2006 19:34
Location: So. Chatham MA/Clearwater FL
Contact:

Re: Script to toggle "main contents" font size?

Post by j_c_hallgren »

ghost zero wrote:well i've been here for a long time but mainly as a poster--not a lurker. i mainly only read replies to my own topics. i'm not savvy on don's preferences on these things, so the situation is confusing.
And even wilth all the time I've been here and the amount of interaction I've had here, I also sometimes can't predict what others (like Don) will do in a given situation but I DO know that while we all try to keep things as organized as possible, sometimes things are in places that aren't exactly correct but that doesn't mean they will get ignored, ok?

The one time when I feel a separate thread is valid is when a long discussion has taken place in one thread and we want to document some of that info for new users so a clean thread is created for reference...but try to keep things in only one thread at a time, ok?
Still spending WAY TOO much time here! But it's such a pleasure helping XY be a treasure!
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.

ghost zero
Posts: 842
Joined: 26 Apr 2010 17:48

Re: Script to toggle "main contents" font size?

Post by ghost zero »

ok. but having a ban threat coming from don over such a small thing, and with no prior personal communication about this from him, it is disheartening. the green mods may be forum helpers, who might not necessarily care much for the end user. but coming from don, i was expecting a much more friendly and professional customer experience.

Post Reply