[Q] How to make custom button to toggel configuration settings?

Discuss and share scripts and script files...
Post Reply
daniel_m
Posts: 131
Joined: 11 Apr 2010 11:47

[Q] How to make custom button to toggel configuration settings?

Post by daniel_m »

Hei!

I'd like to have a custom toolbar button that toggles a configuration setting. In particular, I would like to toggle "General > Tree and List > Tree > Check existence of subfolders in tree > In network locations as well".

Is there any way to do that?

klownboy
Posts: 4148
Joined: 28 Feb 2012 19:27

Re: [Q] How to make custom button to toggel configuration settings?

Post by klownboy »

There's no "setting" script command or tweak for what you're looking for, but you can achieve it using the sendkeys command. Of course, the Configuration dialog box will flicker a moment since the script is changing a Configuration setting and it's doing it in your face.

Code: Select all

// this script will cycle "In network locations as well" in Configuration > Tree and List regardless of the Check existence of subfolders in tree setting
  sendkeys '{PGUP}%w{ }{ENTER}';#600; // to cycle "In network locations as well"

// this script will cycle "Check existence of subfolders in tree" regardless of the "In network locations as well" setting
  sendkeys '{PGUP}%k{ENTER}';#600; // to cycle "Check existence of subfolders in tree"
You can assign the first one, which I believe is what you are after, to a UDC or CTB.
Windows 11, 23H2 Build 22631.3447 at 100% 2560x1440

daniel_m
Posts: 131
Joined: 11 Apr 2010 11:47

Re: [Q] How to make custom button to toggel configuration settings?

Post by daniel_m »

I don't need to toggle this setting often, and your sendkeys approach is doing a perfectly fine job.
Thank you so much 💝

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

Re: [Q] How to make custom button to toggel configuration settings?

Post by admin »

klownboy, could you explain what the script is doing?

klownboy
Posts: 4148
Joined: 28 Feb 2012 19:27

Re: [Q] How to make custom button to toggel configuration settings?

Post by klownboy »

It's not doing anything too exciting just sending keystrokes into the Configuration dialog which I've found in the past you have to send or feed before the CID #600 that opens Configuration.
- {PgUp} makes sure we are at the Tree and List in the General section (i.e., the top). I'd use {Home} instead but it does not work properly.
- %w sends the cursor down to the first "w" accelerator, "In network locations as well"
- { } sends a space character to check that setting. {Space} does not work.
- {Enter} is then sent to finalize and close the Configuration dialog.

There was a lot of trial and error took place before I posted this - mostly "Error 5" concerning the use of sendkeys {Home} and {Space}. :)
"%w" would activate the setting as well if there was only one instance of accelerator "w", but you have 2 "w" accelerators in that section, so it only goes to the setting and does not activate or check it. It does in the case of "%k" in the other example since there is only one instance of "k".
Windows 11, 23H2 Build 22631.3447 at 100% 2560x1440

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

Re: [Q] How to make custom button to toggel configuration settings?

Post by admin »

Pretty confusing that you feed the keystrokes before opening the dialog. :mrgreen:

GreetingsFromPoland
Posts: 225
Joined: 29 Sep 2022 14:20
Location: Win10 @125%

Re: [Q] How to make custom button to toggel configuration settings?

Post by GreetingsFromPoland »

is this a chance for a new scripting command ? maybe togglesetting() ? i am assuming that every configuration setting has a number assigned to it internally. if that is the case you could togglesetting(600); and it would flip the existing setting regardless of what it is set. if checked, uncheck. if unchecked, check.

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

Re: [Q] How to make custom button to toggel configuration settings?

Post by admin »

Your assumption is true for menu commands but not for settings.

klownboy
Posts: 4148
Joined: 28 Feb 2012 19:27

Re: [Q] How to make custom button to toggel configuration settings?

Post by klownboy »

admin wrote: 19 Dec 2022 12:53 Pretty confusing that you feed the keystrokes before opening the dialog. :mrgreen:
Yes, it is a bit odd, but I assume those keystrokes are are being saved in memory to be fed into the Configuration dialog when it opens. It just doesn't work the other way around...too late I guess. I found that out using List Management CIDs as well (e.g., #614, #632, #624.). You have to feed the keystrokes into those dialog boxes before you call the CID.
Windows 11, 23H2 Build 22631.3447 at 100% 2560x1440

Post Reply