Custom variable for font-size not working
› Forums › Desktop Info › Custom variable for font-size not working
Tagged: IF
- This topic has 4 replies, 2 voices, and was last updated 5 months ago by
Glenn.
-
AuthorPosts
-
-
11 August, 2022 at 8:31 am #5445
So I am looking to have a variable for font size % based on the DPI that is detected. My issue is that when using a percent style design it does not apply and my thought is that the variable name trips it up because of the % in the nams.
So here is what I have:
MONITOR=set:DPI=%7,hidden:1
IF=value1:%DPI%,comp:eq,value2:96
SET=key:fontsize,value:60%
IF=value1:%DPI%,comp:eq,value2:96
SET=key:leftspace,value:130
IF=value1:%DPI%,comp:eq,value2:96
CONTROL=wide:1,left:%leftspace%,font-size:%fontsize%,button-color:%blue%,display:Get Help now,uri:https://service-now.com
comment=text:font-size:%fontsize% left:%leftspace%The comment section properly displays what I am attempting to do but the control item never loads and if I font-size: from %fontsize% to 60% it works.
I am working on cutting down the number of install config files I need due to all the hardware and vendors we have. The more variables I can use the better the experience will be when docking and undocking.
Also just to ask is there a way to have a single IF do multiple things, like in say powershell does?
say this:
IF=value1:%DPI%,comp:eq,value2:96
(SET=key:fontsize,value:60%
SET=key:leftspace,value:130)vs this:
IF=value1:%DPI%,comp:eq,value2:96
SET=key:fontsize,value:60%
IF=value1:%DPI%,comp:eq,value2:96
SET=key:leftspace,value:130Just have to ask and as always thanks in advance all!
-
11 August, 2022 at 9:10 am #5446
I’ll answer the second question first because I’ve been thinking about that for a while. Your proposed solution is, of course, the correct one. However, that makes for some really ugly code and that’s why I haven’t done it up until now.
Now it occurs to me that a slightly less obvious but more appealing (to the programmer) answer is to add an option to the IF item, “eval” (or something) that indicates how many of the following items to evaluate in the event the item returns TRUE. Your example in this format will evaluate the following 2 items if IF is TRUE:
IF=value1:%DPI%,comp:eq,value2:96,eval:2
SET=key:fontsize,value:60%
SET=key:leftspace,value:130where the default value is 1.
-
11 August, 2022 at 10:26 am #5447
and the answer to question 1 is, the font-size is not using variables and is crashing out on the %fontsize% value. I’ll add that.
-
12 August, 2022 at 7:57 am #5448
As always Glenn, AWESOME! I am soooo close to a single ini file to cover ~98% of the hardware we run and the %fontsize% is the last hurdle. The IF item while would help clean it up works. The control and control2 items are the reason I am looking to use such a variable as they will not resize accordingly with that. 🙁 every thing else the control items resize when I switch displays and even the dpi settings now.
Here is my latest ini file
# Config for workstations
[options]
# see the readme.txt file for detailed information
inimonitortime=10
ignore-setting-change=1
text-editor=C:\Windows\notepad.exe# position on the screen
bottom=10
right=5
column1width=-1
transparency=80
contextmenu=1
allowdrag=1
Nav=1
Nav-color=d0d0d0# Display Settings
#font-quality=4
#auto-scale=1
#font-size=12
#width=360[text]
noresults=<n/a>
error=[error]
null-result=<null>
unknown=Unknown
menu-export=Export
menu-reload=Reload
menu-configuration=Edit Configuration
menu-log=Open Log File
menu-manual=Read Manual
menu-about=About Desktop Info
menu-quit=Quit
nav-previous=Previous Page
nav-home=Home Page
nav-next=Next Page[items]
BEGIN-ONLOAD
MONITOR=set:Hres=%4
MONITOR=set:Vres=%5
MONITOR=set:DPI=%7# Settings for 3000 hres and 200% DPI
IF=value1:%Hres%,comp:eq,value2:3000
WIDTH=700
IF=value1:%DPI%,comp:eq,value2:192
font-size=20
IF=value1:%DPI%,comp:eq,value2:192
SET=key:HNfontsize,value:60%
IF=value1:%DPI%,comp:eq,value2:192
SET=key:HNLeft,value:215
IF=value1:%DPI%,comp:eq,value2:192
SET=key:ToolsLeft,value:20
IF=value1:%DPI%,comp:eq,value2:192
SET=key:Tools2Left,value:320
IF=value1:%DPI%,comp:eq,value2:192
SET=key:ToolsWidth,value:260
IF=value1:%DPI%,comp:eq,value2:192
SET=key:BRNWidth,value:280# Settings for 2880 hres and 200% DPI
IF=value1:%Hres%,comp:eq,value2:2880
WIDTH=700
IF=value1:%DPI%,comp:eq,value2:192
font-size=20
IF=value1:%DPI%,comp:eq,value2:192
SET=key:HNfontsize,value:60%
IF=value1:%DPI%,comp:eq,value2:192
SET=key:HNLeft,value:215
IF=value1:%DPI%,comp:eq,value2:192
SET=key:ToolsLeft,value:20
IF=value1:%DPI%,comp:eq,value2:192
SET=key:Tools2Left,value:320
IF=value1:%DPI%,comp:eq,value2:192
SET=key:ToolsWidth,value:260
IF=value1:%DPI%,comp:eq,value2:192
SET=key:BRNWidth,value:280# Settings for 150% DPI
IF=value1:%DPI%,comp:eq,value2:144
width=440
IF=value1:%DPI%,comp:eq,value2:144
font-size=12
IF=value1:%DPI%,comp:eq,value2:144
SET=key:HNfontsize,value:80%
IF=value1:%DPI%,comp:eq,value2:144
SET=key:HNLeft,value:150
IF=value1:%DPI%,comp:eq,value2:144
SET=key:ToolsLeft,value:10
IF=value1:%DPI%,comp:eq,value2:144
SET=key:Tools2Left,value:218
IF=value1:%DPI%,comp:eq,value2:144
SET=key:ToolsWidth,value:200
IF=value1:%DPI%,comp:eq,value2:144
SET=key:BRNWidth,value:226# Settings for 125% DPI
IF=value1:%DPI%,comp:eq,value2:120
width=480
IF=value1:%DPI%,comp:eq,value2:120
font-size=14
IF=value1:%DPI%,comp:eq,value2:120
SET=key:HNfontsize,value:60%
IF=value1:%DPI%,comp:eq,value2:120
SET=key:HNLeft,value:160
IF=value1:%DPI%,comp:eq,value2:120
SET=key:ToolsLeft,value:20
IF=value1:%DPI%,comp:eq,value2:120
SET=key:Tools2Left,value:240
IF=value1:%DPI%,comp:eq,value2:120
SET=key:ToolsWidth,value:200
IF=value1:%DPI%,comp:eq,value2:120
SET=key:BRNWidth,value:226# Settings for 100% DPI
IF=value1:%DPI%,comp:eq,value2:96
width=340
IF=value1:%DPI%,comp:eq,value2:96
font-size=10
IF=value1:%DPI%,comp:eq,value2:96
SET=key:HNfontsize,value:60%
IF=value1:%DPI%,comp:eq,value2:96
SET=key:HNLeft,value:115
IF=value1:%DPI%,comp:eq,value2:96
SET=key:ToolsLeft,value:12
IF=value1:%DPI%,comp:eq,value2:96
SET=key:Tools2Left,value:180
IF=value1:%DPI%,comp:eq,value2:96
SET=key:ToolsWidth,value:140
IF=value1:%DPI%,comp:eq,value2:96
SET=key:BRNWidth,value:150
END-ONLOAD# colors
set White = #ffffff
set Grey = #909090
set Cyan = #00ffff
set Magenta = #ff00ff
set Green = #00ff00
set Orange = #ffd000
set Yellow = #ffff00
set Silver = #d0d0d0
set Blue = #0000f0
set Red = #ff0000# battery status lookup table
set battery1 = Disconnected
set battery2 = Connected
set battery3 = Fully Charged
set battery<null> = Not In Use############################################################################################################
# page 1 – Main Page
PAGE=1
PAGE-TITLE=Computer Details
COMMENT=color:%White%,style:iwb,text:Desktop Info
#MONITOR=text:Display Settings,display:%4x%5 DPI:%7
HOST
USER
DOMAIN=hide-no-result:1
CMD=file:powershell.exe,parameters:-executionpolicy remotesigned -noprofile -file .\get-UserPasswordExpiration.ps1 ,color:%Green%,text:Password Expires,hide-no-result:1# needed to account for Windows 11 as there are some items that still report win 10 like productname
REG=interval:0,set:CurrentBuild,value:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentBuild,display:%1,hidden:1
REG=interval:0,set:EditionID,value:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\EditionID,display:%1,hidden:1
SET myProductName=Windows 10 %editionid%
IF=value1:%CurrentBuild%,comp:ge,value2:22000
SET MyProductName=Windows 11 %editionid%
OSBUILD2=color:%orange%,text:Operating System,display:%MYProductName% (%18)TIMEZONE
DATETIME=color:ffdd99,interval:1,text:Current Time,display:%1[dddd] %2[1.0d] %3[mmmm] %4[yyyy]\, %5[1.0a]:%6[2.0d] %5[2.0P]
BOOTTIME=display:%1[dddd] %2 %3[mmmm] %4[yyyy]\, %10
UPTIME=interval:120,display:%1 days %2 hrs %3 mins
NETWORKINTERFACES=interval:30,activeonly:1,operstatus:1,iftype:6 23 71 243,display:%8,friendlyfilter:-virtual# Hardware details (the if with eval option would be perfect here too :))
WMI=namespace:root\cimv2,query:Win32_ComputerSystem,set:MFG,display:%Manufacturer%,hidden:1
WMI=namespace:root\cimv2,query:Win32_ComputerSystem,set:PCModel,display:%Model%,hidden:1
IF=value1:%PCModel%,comp:ne,value2:”Virtual Machine”
WMI=Text:Manufacturer,namespace:root\cimv2,query:Win32_ComputerSystem,display:%Manufacturer%
IF=value1:%MFG%,comp:ne,value2:Lenovo
WMI=Text:Model Name,namespace:root\cimv2,query:Win32_ComputerSystem,display:%Model%
IF=value1:%MFG%,comp:eq,value2:Lenovo
WMI=Text:Model Name,namespace:root\cimv2,query:Win32_ComputerSystemProduct,display:%Version%
IF=value1:%PCModel%,comp:ne,value2:”Virtual Machine”
WMI=Text:Serial Number,namespace:root\cimv2,query:Win32_Bios,display:%SerialNumber%PHYSICALRAM=interval:5,threshold:90,tcolor:0000FF,display:%1[3.1B]B / %2[3.1B]B (%3% used)
LOGICALDRIVES=interval:10,diskio:1,row-text:Drive %1: (%2),display:%6[1.0B]B/%5[1.0B]B (%7[1.1f]% used)|
COMMENT=text:,font-size:50%CONTROL=wide:1,left:%HNLeft%,font-size:100%,button-color:%blue%,display:Goto Helpnow,uri:https://helpnow.companyname.com
COMMENT=text:,font-size:50%############################################################################################################
# page 2 – Security Info
PAGE=2
PAGE-TITLE=Security Info
COMMENT=text:Security Info,style:iwb,color:%white%
COMMENT=text:,font-size:50%# Domain firewall status
REG=interval:600,hide-no-result:1,text:Domain Firewall,value:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SharedAccess\Parameters\FirewallPolicy\DomainProfile\EnableFirewall,display:%1[b:Active:Not Active]
REG=interval:600,hide-no-result:1,text:Private Firewall,value:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\EnableFirewall,display:%1[b:Active:Not Active]
REG=interval:600,hide-no-result:1,text:Public Firewall,value:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SharedAccess\Parameters\FirewallPolicy\PublicProfile\EnableFirewall,display:%1[b:Active:Not Active]# UAC Status
REG=interval:600,text:UAC Status,value:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA,display:%1[b:Enabled:Disabled]# last successful update results
REG=interval:600,hide-no-result:1,text:Auto Update,value:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\Results\Install\LastSuccessTime,display:%1# workstation only settings
# Secureboot/UEFI status
REG=text:Secure Boot Status,value:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecureBoot\State\UEFISecureBootEnabled,display:%1[b:Enabled:Disabled]
# Anti-Malware tools status
WMI=namespace:root\SecurityCenter2,query:AntiVirusProduct,row-text:%DisplayName%,display:%productState%[bit:4096:Enabled:Disabled] and %productState%[bit:393216:up to date:not up to date]
# end workstation only settingsCOMMENT=text:,font-size:50%
COMMENT=text:System Tools,style:iwb,color:%white%
COMMENT=text:,font-size:50%# Useful System Tools
CONTROL =font-size:100%,width:%ToolsWidth%,left:%ToolsLeft%,wide:1, display:Control Panel,uri:control
CONTROL2=font-size:100%,width:%ToolsWidth%,left:%Tools2Left%,display:System Info,uri:msinfo32.exe
CONTROL =font-size:100%,width:%ToolsWidth%,left:%ToolsLeft%,wide:1, display:Task Manager,uri:taskmgr
CONTROL2=font-size:100%,width:%ToolsWidth%,left:%Tools2Left%,display:Device Manager,uri:control,args:hdwwiz.cpl
CONTROL =font-size:100%,width:%ToolsWidth%,left:%ToolsLeft%,wide:1, display:Devices / Printers,uri:control,args:printers
CONTROL2=font-size:100%,width:%ToolsWidth%,left:%Tools2Left%,display:Installed Software,uri:control,args:appwiz.cpl
CONTROL =font-size:100%,width:%ToolsWidth%,left:%ToolsLeft%,wide:1, display:Reliability Monitor,uri:%SystemRoot%\System32\perfmon.exe,args:/rel
CONTROL2=font-size:100%,width:%ToolsWidth%,left:%Tools2Left%,display:Print Management,uri:printmanagement.msc
CONTROL =font-size:100%,width:%ToolsWidth%,left:%ToolsLeft%,wide:1, display:Windows Updates,uri:explorer,args:ms-settings:windowsupdate
CONTROL2=font-size:100%,width:%ToolsWidth%,left:%Tools2Left%,display:Credential Manager,uri:control,args:/name Microsoft.CredentialManager
CONTROL =font-size:100%,width:%ToolsWidth%,left:%ToolsLeft%,wide:1, display:Network Connections,uri:control,args:ncpa.cpl
COMMENT=text:,font-size:50%CONTROL=wide:1,left:%HNLeft%,font-size:100%,button-color:%blue%,display:Goto Helpnow,uri:https://helpnow.companyname.com
COMMENT=text:,font-size:50%############################################################################################################
# page 3 – companyname and Support info
PAGE=3
PAGE-TITLE=companyname and Support info# Useful companyname links
COMMENT=color:%White%,style:iwb,text:companyname Information
COMMENT=text:,font-size:50%
COMMENT=color:%Green%,Text:companyname Links:
CONTROL=font-size:100%,width:%BRNWidth%,button-color:%blue%,display:companyname Connect,uri:https://companyname.sharepoint.com/sites/bcintranet
CONTROL=font-size:100%,width:%BRNWidth%,button-color:%blue%,display:companyname Policies,uri:https://companyname.sharepoint.com/sites/bcintranet/Resources/Policies/Pages/default.aspx
COMMENT=text:,font-size:50%# Solution Center info
COMMENT=style:ibw,text:Support Information
COLOR=%White%
COMMENT=text:,font-size:50%
COMMENT=color:%Green%,Text:Where to get help:
CONTROL=font-size:100%,width:%BRNWidth%,button-color:%blue%,display:Change your password,uri:https://passwordreset.microsoftonline.com/?whr=companyname.onmicrosoft.com
CONTROL=font-size:100%,width:%BRNWidth%,button-color:%blue%,display:Helpnow.companyname.com,uri:https://helpnow.companyname.com
CONTROL=font-size:100%,width:%BRNWidth%,button-color:%blue%,display:Support documents,uri:https://companyname.service-now.com/ess_portal/main_content.do?sysparm_content_url=knowledge_home_launcher.do
CONTROL=font-size:100%,width:%BRNWidth%,button-color:%blue%,display:Support contacts,uri:https://companyname.service-now.com/ess_portal/main_content.do?sysparm_content_url=kb_view.do?sysparm_article=KB0011965
COMMENT=text:,font-size:50%# Americas Info
COMMENT=color:%Green%,Text:Americas Info:
CONTROL=font-size:100%,type:1,control-style:,display:Phone: (555) 940-5697
CONTROL=font-size:100%,type:1,control-style:,display:Mitel: 7125-5697
CONTROL=font-size:100%,type:1,display:solutioncenter@companyname.com,uri:mailto:solutioncenter@companyname.com
# BAPG Info
COMMENT=color:%Green%,Text:BAPG Info:
CONTROL=font-size:100%,type:1,control-style:,display:Phone: +94 3 9767 6469
CONTROL=font-size:100%,type:1,control-style:,display:Mitel: 7512-6469
CONTROL=font-size:100%,type:1,display:bapg.servicedesk@company.com,uri:mailto:bapg.servicedesk@company.com
# EMEA Info
COMMENT=color:%Green%,Text:EMEA Info:
CONTROL=font-size:100%,type:1,control-style:,display:Phone: +99 87 323 333
CONTROL=font-size:100%,type:1,control-style:,display:Mitel: 7678-3333
CONTROL=font-size:100%,type:1,display:emea.helpdesk@companyname.com,uri:mailto:emea.helpdesk@companyname.com
# Navico Info
COMMENT=color:%Green%,Text:company Info:
CONTROL=font-size:100%,type:1,display:helpdesk@company.com,uri:mailto:helpdesk@company.com
COMMENT=text:,font-size:50% -
12 August, 2022 at 8:13 am #5450
wow! you’ve gone all out! 🙂 I see how the updated IF item can be useful to you.
I meant to post this yesterday and you’ve probably already worked this out. This is how your first example would look with the updated IF item:
INI123456789101112131415# defaultsfont-size=10# process once during load upbegin-onloadSET=key:fontsize,value:100%SET=key:leftspace,value:130MONITOR=set:DPI=%7,hidden:1IF=value1:%DPI%,comp:eq,value2:96,eval:2SET=key:fontsize,value:60%SET=key:leftspace,value:130end-onloadCONTROL=wide:1,left:%leftspace%,font-size:%fontsize%,button-color:%blue%,display:Get Help now,uri:https://service-now.comcomment=text:DPI:%DPI% font-size:%fontsize% left:%leftspace%your multiple MONITOR items can be consolidated to one:
[items]
BEGIN-ONLOAD
MONITOR=set:Hres=%4 Vres=%5 DPI=%7
…i’ll try and get that out in the next few days
-
-
AuthorPosts
- You must be logged in to reply to this topic.