QuickSwitch and JumpToFolder AHK scripts

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: Hacker, petermad, Stefan2, white

Post Reply
jberry910
Junior Member
Junior Member
Posts: 28
Joined: 2010-02-08, 02:43 UTC
Location: Illinois, USA

Re: QuickSwitch and JumpToFolder AHK scripts

Post by *jberry910 »

The function is quite complex, but it is executed once when the application is launched, and therefore it is not scary.
Does this mean the menu is static and not dynamic? Executed once implies that it is executed only on startup of the script and not when a dialog for saving is opened.

I also use PeterMad's menus and do not have a usercmd.ini, instead I use the menu ini file instead. Both the menu file and its ini file are located in a directory different from the wincmd.ini file.

Finding the ini does not guarantee the list of tabs will be correct. I always have a few tabs on each side that are "Locked, but directory changes allowed." Any of these tabs could be active and the directory changed from the saved value. When the tabs are saved the file shows the "saved" location, not the current location.

What happens when I start TC with a different ini file? I have one TC started with my usual ini file and another started with a different ini file. Will I get all tabs from both?
Joe
Central Illinois, USA
User avatar
Dalai
Power Member
Power Member
Posts: 9941
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: QuickSwitch and JumpToFolder AHK scripts

Post by *Dalai »

Rafaello wrote: 2025-04-10, 18:11 UTCI can read the contents of the startup parameters (including the /i=name.ini parameter) and find the desired configuration.
Well, if you can read the command line of the started TC process, you could read its environment variables instead, specifically the variable %COMMANDER_INI% which points to the correct config file regardless of which way was used to point TC to a config file. Please note that retrieving the environment variables or the process command line won't work when TC is ran elevated (as administrator) or as another user.
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
nsp
Power Member
Power Member
Posts: 1912
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Re: QuickSwitch and JumpToFolder AHK scripts

Post by *nsp »

The usercmd.ini next to the loaded TotalCommander_wincmd.ini is always loaded even if most of the em_ commands are defined in the wcmd_<Menu>_<lang>.ini (as used in petermad extended menu or localized as Horst.Epp suggested) you can be lucky if you just search for it and test if an added command can be executed from ahk.
Keep also in mind that using /i you can have multiple TC instances (process) running in // even 32bit side to 64bit with almost same caption.
Some of us also use XYplorer, Dopus, DoubleCmd.. side to TC You should probably keep it as simple as possible to be usable and not too complex.
Rafaello
Junior Member
Junior Member
Posts: 62
Joined: 2025-04-01, 17:48 UTC

Re: QuickSwitch and JumpToFolder AHK scripts

Post by *Rafaello »

jberry910 wrote: 2025-04-10, 18:43 UTC Does this mean the menu is static and not dynamic? Executed once implies that it is executed only on startup of the script and not when a dialog for saving is opened.
The menu is dynamic. But the function that will search for the configuration will search for it once when running the script. Then the result will be saved and it will be used every time the menu is launched.
I always have a few tabs on each side that are "Locked,
I will try to take this into account in the future.
What happens when I start TC with a different ini file? I have one TC started with my usual ini file and another started with a different ini file. Will I get all tabs from both?
Yes, QuickSwitch gets tabs for each instance of each file manager. Moreover, you can open the file dialog, open the menu, open the file manager again and change any tab. After switching back (Alt+Tab) to the file dialog, you will see your tab in the menu.
Last edited by Rafaello on 2025-04-11, 06:20 UTC, edited 1 time in total.
Rafaello
Junior Member
Junior Member
Posts: 62
Joined: 2025-04-01, 17:48 UTC

Re: QuickSwitch and JumpToFolder AHK scripts

Post by *Rafaello »

Dalai wrote: 2025-04-10, 23:10 UTC Please note that retrieving the environment variables or the process command line won't work when TC is ran elevated (as administrator) or as another user.
That's why I like your suggestion above: I haven't been able to solve this "elevated app" problem with Dopus. So I just rewrote it's algorithm for getting tabs... But with TC, everything turned out to be more complicated.
Rafaello
Junior Member
Junior Member
Posts: 62
Joined: 2025-04-01, 17:48 UTC

Re: QuickSwitch and JumpToFolder AHK scripts

Post by *Rafaello »

nsp wrote: 2025-04-11, 05:51 UTC The usercmd.ini is always loaded
It's wonderful! All I need is to force TC to execute the built–in SaveTabs2 command, and it doesn't matter how TC does it. BTW the name EM_____ in usercmd.ini will be more unique.
Keep also in mind that using /i you can have multiple TC instances
QuickSwitch operates separately for each instance using its unique number (hwnd). I planned to speed up the search algorithm for these instances in the next version.
User avatar
petermad
Power Member
Power Member
Posts: 15997
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: QuickSwitch and JumpToFolder AHK scripts

Post by *petermad »

I have recived this as a forum email from Rafaello
email wrote:To execute the SaveTabs2 command, the app must find wincmd.ini and create a
usercmd.ini next to it with the SaveTabs2 parameters. In this thread, users
say that your add-ons use the changed location and name of usercmd.ini:
viewtopic.php?p=470241#p470241

How do I find the path to wincmd.ini or how do I execute SaveTabs2 without
a user-defined command?
Well, TC's set these environment parameters:
%COMMANDER_INI% that points directly to the currently used wincmd.ini - also if it is set with the /i start parameter and if it has a different name.
%COMMANDER_INI_PATH% which points to the directory where wincmd.ini (and usercme.ini) is located.

Boths parameters can only be seen from programs executed from TC, they are not visible to programs started from outside of TC.

If you load an alternative .mnu file in TC, named for example wcmd_savetabs_eng.mnu, then TC will also, besides from usercmd.ini, look for em_commands in a file with the corresponding name wcmd_savetabs_eng.ini - and that file will be looked for in the same directory as the wcmd_savetabs_eng.mnu file (usually %COMMANDER_PATH%\language).

But if you app is intended to being started at computer startup - the it wil not be able to see TC envinronment variables.
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Rafaello
Junior Member
Junior Member
Posts: 62
Joined: 2025-04-01, 17:48 UTC

Re: QuickSwitch and JumpToFolder AHK scripts

Post by *Rafaello »

petermad wrote: 2025-04-13, 23:41 UTC If you load an alternative .mnu file in TC, named for example wcmd_savetabs_eng.mnu, then TC will also, besides from usercmd.ini, look for em_commands in a file with the corresponding name...
Thanks for the quick and detailed reply. What is the .mnu format? Is this an example or an alias for an ini file? Loading means launching a new instance of TC with .mnu configuration?

Unfortunately, my application is launched by user/system and works with existing TC instances, so I can't work with environment variables...
Rafaello
Junior Member
Junior Member
Posts: 62
Joined: 2025-04-01, 17:48 UTC

Re: QuickSwitch and JumpToFolder AHK scripts

Post by *Rafaello »

Okay, let's change the topic from the core to the dialogues I'm currently working on. In which file dialogs that you use the menu does not appear? What kind of applications are these?

I added some checks so that the menu does not appear in various erroneous applications, but it seems that the "Blacklist" option is still needed. What should this option be in your opinion?
User avatar
petermad
Power Member
Power Member
Posts: 15997
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: QuickSwitch and JumpToFolder AHK scripts

Post by *petermad »

2Rafaello
What is the .mnu format
It is a text file holding the Main menu for TC - TC comes with .mnu files for 19 languages. The menu is automatically changed when to chnage the langauage of TC or you can set the menu explicitly in Configuration -> Language -> Main menu file.

The menu file can also be loaded with the internal TC command: OPENLANGUAGEFILE wcmd_XXX.mnu

Unfortunately, my application is launched by user/system
Then I don't see any way of detecting the location of TC's ini files
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Rafaello
Junior Member
Junior Member
Posts: 62
Joined: 2025-04-01, 17:48 UTC

Re: QuickSwitch and JumpToFolder AHK scripts

Post by *Rafaello »

Dalai wrote: 2025-04-10, 15:11 UTC There are a lot of locations where the wincmd.ini can be and how it's named. I
In summary: The algorithm is quite complex and if TC is started with the /i switch, you're probably out of luck to get the correct location. It's probably best to let the user decide or override the location in your tool.

PS: I hope I didn't forget anything in the list above. If I did, I'm sure others will chime in and correct me. Please feel free to do so ;).
Thanks so much for describing the search steps! I have released a beta version with this algorithm: https://github.com/JoyHak/QuickSwitch/releases/tag/1.4.1

Fixed problems with Menu and significantly improved performance. Full changelog will be available on release. If the new search algorithm will be reliable, I will add @Dalai's name to the Readme.

I ask all users to test this version and share their opinion in this thread. You can also create a bug report or send here a screenshot and Errors.log
Rafaello
Junior Member
Junior Member
Posts: 62
Joined: 2025-04-01, 17:48 UTC

Re: QuickSwitch and JumpToFolder AHK scripts

Post by *Rafaello »

The application is looking specifically for wincmd.INI (except the /i command line path). Perhaps I need a more versatile search?

Then, the name is removed from the path and replaced by usercmd.ini as the target configuration.
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6950
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: QuickSwitch and JumpToFolder AHK scripts

Post by *Horst.Epp »

This new version 1.4.1 still has major problems.
It tries to access a useless dir.
Here is the log, please note that my portable TC dir is C:\tools\wincmd.

Code: Select all

Report about error: https://github.com/JoyHak/QuickSwitch/issues/new?template=bug-report.yaml
AHK 1.1.37.02
Windows 10 Home 24H2 | 26100 de-DE

Script is compiled. Version: 0.0.0.0
64-bit script for 64-bit system 

21.04 05:55:52    [TotalCmd console]    Unable to find console    
21.04 05:55:52    Found Total Commander config: 'C:\Tools\Wincmd\wincmd.ini'
21.04 05:55:52    [TotalCmd config]    Please create this file manually: 'C:\Tools\usercmd\usercmd.ini'    FileAppend 1 
21.04 05:57:10    Found Total Commander config: 'C:\Tools\Wincmd\wincmd.ini'
21.04 05:57:10    [TotalCmd config]    Please create this file manually: 'C:\Tools\usercmd\usercmd.ini'    FileAppend 1 

Windows 11 Home, Version 24H2 (OS Build 26100.3915)
TC 11.51 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.2.1 x64
Rafaello
Junior Member
Junior Member
Posts: 62
Joined: 2025-04-01, 17:48 UTC

Re: QuickSwitch and JumpToFolder AHK scripts

Post by *Rafaello »

Restart the script. First of all, it should run the console (if no child windows are open in the TC)
Rafaello
Junior Member
Junior Member
Posts: 62
Joined: 2025-04-01, 17:48 UTC

Re: QuickSwitch and JumpToFolder AHK scripts

Post by *Rafaello »

Can you record some demo of what happens when opening the menu? TC window should be visible on the video. I don't understand why the console didn't open.
Post Reply