Custom variable wit...
 
Notifications
Clear all

We had a major storm through here recently and we suffered damage to the house roof and ceilings. I just received the quote to repair. I’m hoping that a small fraction of the 80,000 odd people that download SDIO and/or Desktop Info every month won’t mind chipping in a few dollars to help out. Click on the big blue button at the bottom of the page to help us keep a roof over our heads, literally!

Guests have read-only access to our forums. If you wish to participate you will need to register. Be sure to activate your account from the email sent to you when you register.

Custom variable with FONT-SIZE and WIDTH

4 Posts
2 Users
1 Reactions
59 Views
(@guillaume)
New Member Registered
Joined: 1 week ago
Posts: 2
Topic starter  

Hello!

I'm currently updating our configuration file, which is currently version 3.10.2, and I'm stuck on a few commands.

Here's my issue:
I'm using the BEGIN-IF function to set the font size, but the FONT-SIZE/WIDTH command doesn't seem to work with a custom variable.
The variable does take the correct value, but I can't get it to apply — if I replace %myfontsize% with the actual value, it works. Any idea why?

[items]

# Get current monitor information
MONITOR=set:resx=%4,hidden:1
MONITOR=set:resy=%5,hidden:1
MONITOR=set:dpi=%7,hidden:1

# "Default" scaling setting Windows
# 96 : 100%
# 120 : 125%
# 144 : 150%
# 192 : 200%
# 216 : 225%
# 240 : 250%

# Default font size and width
font-size=12
width=500

# Monitor with 192 DPI
BEGIN-IF=value1:%dpi%,comp:eq,value2:192
SET myfontsize=24
SET mywidth=950
END-IF

# Monitor with 144 DPI
BEGIN-IF=value1:%dpi%,comp:eq,value2:144
SET myfontsize=16
SET mywidth=650
END-IF

# Monitor with 120 DPI
BEGIN-IF=value1:%dpi%,comp:eq,value2:120
SET myfontsize=16
SET mywidth=650
END-IF

# Monitor with 96 DPI
BEGIN-IF=value1:%dpi%, comp:eq, value2:96
SET myfontsize=14
SET mywidth=600
END-IF

font-size=%myfontsize%
width=%mywidth%


   
Quote
Glenn
(@glenn)
Member Admin
Joined: 7 years ago
Posts: 1591
 

I'll check it out.


   
ReplyQuote
Glenn
(@glenn)
Member Admin
Joined: 7 years ago
Posts: 1591
 

I like your config but it's never going to work because those key words, "font-size", "width" etc are only used during config load to act as defaults for individual items that don't have those properties declared. On the other hand all the stuff above that doesn't evaluate until after the config is loaded and "n'er the twain shall meet".

However, because that config is an eminently sensible approach, I'm going to try to accommodate it by adding an item that will allow us to dynamically set colors and widths and things.


   
ReplyQuote
(@guillaume)
New Member Registered
Joined: 1 week ago
Posts: 2
Topic starter  

Thank you very much for your detailed explanation and especially for your willingness to adapt the system to accommodate this configuration approach. I really appreciate the clarity of your insights and the quality of your work, it's both efficient and thoughtful.


   
Glenn reacted
ReplyQuote
Glenn's Page