Script to toggle between two font sizes, for viewing from a distance.

Discuss and share scripts and script files...
Post Reply
KaNoobi
Posts: 3
Joined: 10 May 2021 19:11

Script to toggle between two font sizes, for viewing from a distance.

Post by KaNoobi »

I would like to create toolbar button or hotkey that will enable me to quickly toggle between two different font sizes. One for normal desktop browsing and one for when I'm a few feet away lying in bed. I'm aware you can use ctrl+scroll wheel to change font size. But would prefer a button or hotkey that would make it possible to quickly switch between two fonts sizes every time. I was able to to create a button and use this setkey "9000", "Millisize", "Font"; #190; I found someone else using it to reset it default font size. Don't know much about writing scripts and which commands I need to use. If someone could write a basic script that would enable switching between two different font sizes. I'm sure I would be able to figure out what numbers to change that would work best for my setup.

Any help would be greatly appreciated

admin
Site Admin
Posts: 51287
Joined: 22 May 2004 16:48
Location: Cologne, Win 8.1, Win 10
Contact:

Re: Script to toggle between two font sizes, for viewing from a distance.

Post by admin »

1) As you see in Configuration | Colors and Styles | Fonts, XYplorer distinguishes various font sizes. Which do you want to toggle?

2) Check out the "Touchscreen Mode" toolbar button (also menu View | Views | Touchscreen Mode), it might already do what you want.
FAQ | XY News RSS | XY Twitter | Stay home! 🎸 Or wear a mask! 😷

KaNoobi
Posts: 3
Joined: 10 May 2021 19:11

Re: Script to toggle between two font sizes, for viewing from a distance.

Post by KaNoobi »

1. The first one, Main Contents

2. The Touch Screen button works pretty well. The only down side is it re sizes the columns when you use it. Which sort of irritates my mild OCD. Would the prefer the Name column to stay larger to read long file names better. But till I find a better option it will do the job. It's almost perfect if it wasn't for the column resizing.

For others who are interested in trying the Touch screen button. I see when you right click on the button. You can choose to use Extra Large buttons and Scale toolbar. Which helps when viewing from further away.

Thank you for the suggestion and help

I'm sure there would be way to write a simple script to toggle between two different font sizes. I'm just not sure what commands I need to play around with.

highend
Posts: 10349
Joined: 06 Feb 2011 00:33

Re: Script to toggle between two font sizes, for viewing from a distance.

Post by highend »

One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

KaNoobi
Posts: 3
Joined: 10 May 2021 19:11

Re: Script to toggle between two font sizes, for viewing from a distance.

Post by KaNoobi »

Wow thank you very much that works perfectly.
I found a script that works great. I just changed the $minSize and $maxSize ; and then created a User button in the Toolbar and added a custom Icon

Here is what worked for me

Code: Select all

"Toggle Font Size"
	$minSize = 15;
	$maxSize = 30;

	// 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');
		}
	}
[/quote]

You guys rock :appl:

Post Reply