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
Rafaello
Junior Member
Junior Member
Posts: 63
Joined: 2025-04-01, 17:48 UTC

Re: QuickSwitch and JumpToFolder AHK scripts

Post by *Rafaello »

TC didn't add environmental variables. This means that other users may not have them! These are difficult steps just to make sure.

My script works externally and cannot be run from TC. so it can't access variables?..
User avatar
Dalai
Power Member
Power Member
Posts: 9945
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: QuickSwitch and JumpToFolder AHK scripts

Post by *Dalai »

2Rafaello
TC definitely adds the environment variables for its current process. They're NOT added for the user or even system-wide. You won't see them in Windows control panel. But you will be able to see them when launching a CMD from a TC instance and use the "set" command as Horst.Epp suggested. Another way to see them is to use Process Hacker or Process Explorer and check the environment variables of the running totalcmd.exe/totalcmd64.exe process via the "Environment" tab.

One important thing is that there's not just one set of environment variables like in the old days in DOS. Each process can have its own set of them. And child processes inherit the environment variable set (usually).

Anyway, if your tool is not launched from a running TC, its environment variables won't be helpful in any way.
#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 »

Rafaello wrote: 2025-04-09, 06:06 UTC TC didn't add environmental variables. This means that other users may not have them! These are difficult steps just to make sure.

My script works externally and cannot be run from TC. so it can't access variables?..
TC create the variable for the current process and you an access it using the getenv. Even if your main tool cannot run inside TC you can have secondary script launched inside TC to do the configuration or communicate with it. Some TC USER are conservative and prefer to do manual change than having other tools changing configuration or command files without notice.
Rafaello
Junior Member
Junior Member
Posts: 63
Joined: 2025-04-01, 17:48 UTC

Re: QuickSwitch and JumpToFolder AHK scripts

Post by *Rafaello »

Dalai wrote: 2025-04-09, 06:36 UTC Anyway, if your tool is not launched from a running TC, its environment variables won't be helpful in any way.
That's bad: script should be fully automatic.
nsp wrote: 2025-04-09, 08:22 UTC Some TC USER are conservative and prefer to do manual change
The script doesn't change or break anything. It should be fully automatic: the user doesn't have to do anything. I'll think about how to read CMD contents from TC to access process variables autonomously...
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6951
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: QuickSwitch and JumpToFolder AHK scripts

Post by *Horst.Epp »

Rafaello wrote: 2025-04-09, 10:03 UTC
Dalai wrote: 2025-04-09, 06:36 UTC Anyway, if your tool is not launched from a running TC, its environment variables won't be helpful in any way.
That's bad: script should be fully automatic.
nsp wrote: 2025-04-09, 08:22 UTC Some TC USER are conservative and prefer to do manual change
The script doesn't change or break anything. It should be fully automatic: the user doesn't have to do anything. I'll think about how to read CMD contents from TC to access process variables autonomously...
The original Quick Switch has no need for any script from inside of supported file managers.
It runs in the background, detects Open/Save dialogs
and queries the running file managers without changing anything of their settings.
That way it works perfect.
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: 63
Joined: 2025-04-01, 17:48 UTC

Re: QuickSwitch and JumpToFolder AHK scripts

Post by *Rafaello »

It can't display all paths. New QS has completely new fast and useful core.
Rafaello
Junior Member
Junior Member
Posts: 63
Joined: 2025-04-01, 17:48 UTC

Re: QuickSwitch and JumpToFolder AHK scripts

Post by *Rafaello »

I want to select all the paths from TC, and this variety of possible wincmd.ini locations is very difficult to track. That's why I'm asking for help with Automation...
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 »

It can't display all paths. New QS has completely new fast and useful core.
Personally, I only want to see the current source and target directories of all open TC windows (XY or Opus). I do not want to see directories from all TC tabs from both sides.
Joe
Central Illinois, USA
Rafaello
Junior Member
Junior Member
Posts: 63
Joined: 2025-04-01, 17:48 UTC

Re: QuickSwitch and JumpToFolder AHK scripts

Post by *Rafaello »

This app will improve and display more features. I need help getting the TC configuration.
User avatar
Dalai
Power Member
Power Member
Posts: 9945
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: QuickSwitch and JumpToFolder AHK scripts

Post by *Dalai »

2Rafaello
You can get the current open/active locations in TC via WM_COPYDATA, but I assume you know that already. I doubt that it's possible to read the location of all (or inactive) open tabs. What kind of (other) TC configuration did you have in mind?
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Rafaello
Junior Member
Junior Member
Posts: 63
Joined: 2025-04-01, 17:48 UTC

Re: QuickSwitch and JumpToFolder AHK scripts

Post by *Rafaello »

Dalai wrote: 2025-04-10, 08:41 UTC I doubt that it's possible to read the location of all (or inactive) open tabs. What kind of (other) TC configuration did you have in mind?
If you add a custom command to usercmd.ini that executes the internal "SaveTabs2" command, Total Commander exports all tabs to a file that can be read: https://github.com/JoyHak/QuickSwitch/blob/fc3b39608920eca5850663fe384a9c1b759313ee/Libs/GetPaths.ahk#L250

The problem turned out to be that the path to the usercmd.ini configuration directly depends on the path of wincmd.ini. The user can change this path. So in order to create a usercmd.ini and Total Commander could read it, you need to get the path to wincmd.ini.

I don't understand how to get this path. The script is currently searching for this path in the current TC directory or taking the path from the registry: https://github.com/JoyHak/QuickSwitch/blob/fc3b39608920eca5850663fe384a9c1b759313ee/Libs/GetPaths.ahk#L216
User avatar
Dalai
Power Member
Power Member
Posts: 9945
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, 13:41 UTCI don't understand how to get this path. The script is currently searching for this path in the current TC directory or taking the path from the registry
There are a lot of locations where the wincmd.ini can be and how it's named. I'm not sure if there already is an explanation on the forum, but I'm not in the mood to search for it, so I'm just gonna write down how TC finds its configuration file. Maybe it's time to add a more recent post about this topic anyway.
  1. If TC is started with the /i switch it overrides any other location where the config file can be, including the one in the TC directory. In this mode, the file can have any custom name.
  2. If there's no /i switch, TC checks for a wincmd.ini in the TC directory. If it's present, it'll check if

    Code: Select all

    [Configuration]
    UseIniInProgramDir
    setting is present, and if it is (and its value is large enough), the wincmd.ini in the TC directory will be used regardless what the registry specifies. This is kind of a portable mode and is usually used for exactly that.
  3. When neither of the above is true, TC will check the registry (HKCU and HKLM) if a location is specified there. If there is one, TC uses that.
  4. If all of the above fail (no /i, no wincmd.ini in TC directory and no registry) TC will fall back to a default location. On Windows versions since Vista (IIRC) this will be %AppData%\Ghisler, on older Windows versions it might be %SystemRoot% (or %WindowsDir%).
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 ;).
#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
Horst.Epp
Power Member
Power Member
Posts: 6951
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: QuickSwitch and JumpToFolder AHK scripts

Post by *Horst.Epp »

It's even more complicated.
The user may not like entries in Usercmd.ini
but in its menu config related ini file under the Language subdir.
This is used in Petermad's configs, for example.
For me, it's wcmd_MyTCMenu_ENG.INI

The simple solution for all this was already suggested.
Tell the user what em_command and content to create.
In this case, there is no need for the QS script to do anything on its startup.
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: 63
Joined: 2025-04-01, 17:48 UTC

Re: QuickSwitch and JumpToFolder AHK scripts

Post by *Rafaello »

Dalai wrote: 2025-04-10, 15:11 UTC 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 ;).
This is the help I was looking for, thank you so much! I can read the contents of the startup parameters (including the /i=name.ini parameter) and find the desired configuration.

The function is quite complex, but it is executed once when the application is launched, and therefore it is not scary.
Rafaello
Junior Member
Junior Member
Posts: 63
Joined: 2025-04-01, 17:48 UTC

Re: QuickSwitch and JumpToFolder AHK scripts

Post by *Rafaello »

Horst.Epp wrote: 2025-04-10, 15:54 UTC For me, it's wcmd_MyTCMenu_ENG.INI
This means that I will send requests to open CMD in TC and read its contents after executing some commands. This is an alternative that I found as an addition to the steps described above.

Where did you change the configuration name?
Post Reply