Set TitleBar to ActivePath & Append TC Default Title
Moderators: Hacker, petermad, Stefan2, white
I'm using the v3.1 script with the latest changes, and I tested on two different systems.
On Win 7 Ultimate (x64):
- AHK v1.0.48.05 => behavior below
- AHK_L v1.0.48.05.L55 (x64) => similar behavior (I had updated to revision 58 in the meantime, so I don't have detailed results)
- AHK_L v1.0.48.05.L58 (x64 / x32 Unicode / x32 ANSI) => crash after TC close / at script exit
On WinXP Pro SP3 (x32):
- AHK v1.0.48.05 => behavior below
- AHK_L v1.0.48.05.L58 (x32 Unicode) => behavior below
TC 7.55a:
- left panel = C:\
- right panel = D:\
initially =>
Total Commander 7.55a - User Name
on script start =>
[1] C:\ -::- TC 7.55a - User Name
after refresh (Ctrl+R) =>
[1] C:\ -::- TC 7.55a - User Name
after change panel (TAB) =>
[1] D:\ -::- TC 7.55a - User Name
after TC close + restart =>
[2] C:\ -::- TC -
after refresh (Ctrl+R) =>
[1] C:\ -::- TC 7.55a - User Name
after change panel (TAB) =>
[2] D:\ -::- TC -
after TC close + restart =>
[3] C:\ -::- TC 0 - 0
after refresh (Ctrl+R) =>
[1] C:\ -::- TC 7.55a - User Name
after change panel (TAB) =>
[3] D:\ -::- TC 0 - 0
after TC close + restart =>
[4] C:\ -::- TC 0 - 0
after refresh (Ctrl+R) =>
[1] C:\ -::- TC 7.55a - User Name
after change panel (TAB) =>
[4] D:\ -::- TC 0 - 0
Note that after fisrt restart the TC version and User Name are empty strings, and after consecutive restart they're "0".
On Win 7 Ultimate (x64):
- AHK v1.0.48.05 => behavior below
- AHK_L v1.0.48.05.L55 (x64) => similar behavior (I had updated to revision 58 in the meantime, so I don't have detailed results)
- AHK_L v1.0.48.05.L58 (x64 / x32 Unicode / x32 ANSI) => crash after TC close / at script exit
On WinXP Pro SP3 (x32):
- AHK v1.0.48.05 => behavior below
- AHK_L v1.0.48.05.L58 (x32 Unicode) => behavior below
TC 7.55a:
- left panel = C:\
- right panel = D:\
initially =>
Total Commander 7.55a - User Name
on script start =>
[1] C:\ -::- TC 7.55a - User Name
after refresh (Ctrl+R) =>
[1] C:\ -::- TC 7.55a - User Name
after change panel (TAB) =>
[1] D:\ -::- TC 7.55a - User Name
after TC close + restart =>
[2] C:\ -::- TC -
after refresh (Ctrl+R) =>
[1] C:\ -::- TC 7.55a - User Name
after change panel (TAB) =>
[2] D:\ -::- TC -
after TC close + restart =>
[3] C:\ -::- TC 0 - 0
after refresh (Ctrl+R) =>
[1] C:\ -::- TC 7.55a - User Name
after change panel (TAB) =>
[3] D:\ -::- TC 0 - 0
after TC close + restart =>
[4] C:\ -::- TC 0 - 0
after refresh (Ctrl+R) =>
[1] C:\ -::- TC 7.55a - User Name
after change panel (TAB) =>
[4] D:\ -::- TC 0 - 0
Note that after fisrt restart the TC version and User Name are empty strings, and after consecutive restart they're "0".
aNDreas Bolotă
The truth always carries the ambiguity of the words used to express it. (Frank Herbert, God Emperor of Dune)
The truth always carries the ambiguity of the words used to express it. (Frank Herbert, God Emperor of Dune)
- Balderstrom
- Power Member
- Posts: 2148
- Joined: 2005-10-11, 10:10 UTC
@ ND: Thanks for the detailed info. Very easy to find the problem. Checked the script's variables after a couple TC Start/Restarts -- I forgot two arrays in the DeleteStruct() function.
I've tested with multiple TC start/restarts, and with multiple instances running and closing them in varied orders. As far as I can tell -- it appears to be working like it _USED_ to before I split up the overloaded _SETGLOBALS() function (and let a couple bugs creep in).
I've tested with multiple TC start/restarts, and with multiple instances running and closing them in varied orders. As far as I can tell -- it appears to be working like it _USED_ to before I split up the overloaded _SETGLOBALS() function (and let a couple bugs creep in).
- Balderstrom
- Power Member
- Posts: 2148
- Joined: 2005-10-11, 10:10 UTC
You can just comment the showTCNum1 - and it wont show the instance# for the first running instance of TC (like normal).
Personally, I only use one instance of TC most of the time. If I had of just coded it for my own habits, the script would be much smaller and I would of learned less
One part I really like is if you are running at least two instances and close one that is not the last, all remaining instances will get their titles updated with the proper (current) instance number.
(Version 3.25, but its just clean up, no bug fixes).
Personally, I only use one instance of TC most of the time. If I had of just coded it for my own habits, the script would be much smaller and I would of learned less

One part I really like is if you are running at least two instances and close one that is not the last, all remaining instances will get their titles updated with the proper (current) instance number.
(Version 3.25, but its just clean up, no bug fixes).
- Balderstrom
- Power Member
- Posts: 2148
- Joined: 2005-10-11, 10:10 UTC
I've added (to my own copy) changing the ButtonBar iconsize when TC's non-maximized width is below a user-definable pixel-width.
The problem is finding where the current wincmd.ini is.
Option 1: Requires SetEnv.exe.
--> Sends a command to TC's Command Prompt to set a Volatile Environment variable (Registry), so that the script can access it.
Option 2: Requires using an AHK script for launching Total Commander.
Option 3: Requires usage of my TC.ahk LIB and adding a User-Command to Total Commander:
Development Notes:
Will Release version 3.30 (without the buttonBar feature) that is AHK Library compatible. e.g. will be able to cleanly include into any other AHK Script, and just call the INIT() function.
The problem is finding where the current wincmd.ini is.
Option 1: Requires SetEnv.exe.
--> Sends a command to TC's Command Prompt to set a Volatile Environment variable (Registry), so that the script can access it.
Option 2: Requires using an AHK script for launching Total Commander.
Option 3: Requires usage of my TC.ahk LIB and adding a User-Command to Total Commander:
Option 1 is the least clean method, yet all pretty much require something external to the stand-alone script.em_CMDStart
Command: cmd.exe /c START "%comspec%" /MIN
and optionally check, [X] Run Minimized
Development Notes:
Will Release version 3.30 (without the buttonBar feature) that is AHK Library compatible. e.g. will be able to cleanly include into any other AHK Script, and just call the INIT() function.
- ghisler(Author)
- Site Admin
- Posts: 50421
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
To find the wincmd.ini location, you can use the environment variable %COMMANDER_INI% . It's only set in TC itself and all child processes, though.The problem is finding where the current wincmd.ini is.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
- Balderstrom
- Power Member
- Posts: 2148
- Joined: 2005-10-11, 10:10 UTC
Yes, to keep it stand-alone, I can basically write an AHK temp-file from the script, and paste the launching of it into TC's Command-Line.
But I think, I'll just require the user to create a small user-command if the ButtonBar feature is to be activated.
Thats the general idea, create a child process (cmd.exe) From which I can grab the COMMAND_INI for each running TC instance. MSDN talks about creating a child-process and modifying its contens -- but for my purposes a background cmd-prompt will work.
Thanks.
But I think, I'll just require the user to create a small user-command if the ButtonBar feature is to be activated.
Thats the general idea, create a child process (cmd.exe) From which I can grab the COMMAND_INI for each running TC instance. MSDN talks about creating a child-process and modifying its contens -- but for my purposes a background cmd-prompt will work.
Thanks.
*BLINK* TC9 Added WM_COPYDATA and WM_USER queries for scripting.
- Balderstrom
- Power Member
- Posts: 2148
- Joined: 2005-10-11, 10:10 UTC
Updated to version 3.50
Primarily fix of discovered bug.
Code for ToolBar icon resizing is currently disabled. No clean way to determine location of wincmd.ini for script not started from TC, and conflicts when multiple TC instances are running.
Primarily fix of discovered bug.
Code for ToolBar icon resizing is currently disabled. No clean way to determine location of wincmd.ini for script not started from TC, and conflicts when multiple TC instances are running.
*BLINK* TC9 Added WM_COPYDATA and WM_USER queries for scripting.
Does this script work?
Only works correctly with one instance, though.
HTH
Roman
Code: Select all
#Persistent
#NoEnv
WinGetTitle, OriginalTCTitle, ahk_class TTOTAL_CMD
SetTimer, ChangeTCTitle, 1000
ChangeTCTitle:
WinGetText, TCWindowText, ahk_class TTOTAL_CMD
RegExMatch(TCWindowText, "m)(?<=^).*?(?=>)", PathInTC)
WinSetTitle, ahk_class TTOTAL_CMD, , %PathInTC% :: %OriginalTCTitle%
Return
HTH
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
This code works for me (show only active folders):
TF_Find function is from Textfile & String Library for AutoHotkey (v3.6). But I think it does not matter and you guys see a point.
Code: Select all
#Persistent
#NoEnv
WinGetTitle, OriginalTCTitle, ahk_class TTOTAL_CMD
SetTimer, ChangeTCTitle, 1000
ChangeTCTitle:
WinGetText, TCWindowText, ahk_class TTOTAL_CMD
PathInTC := TF_Find(TCWindowText, 1, 0, "\*\.\*", 0, 1)
stringreplace, PathInTC, PathInTC, `n, %a_space%::%a_space%
stringreplace, PathInTC, PathInTC, *.*,, all
WinSetTitle, ahk_class TTOTAL_CMD, , %PathInTC% :: %OriginalTCTitle%
Return
Description of TF_Find function:
I would like to see Balderstroms script (first post here) fixed. If I rememeber it correctly I used it for a long time with 32-bit version of TC and everything worked flawlessly. I will be grateful for any help he (you - if Balderstrom himself is reading this post) can provide.
Code: Select all
TF_Find(Text, StartLine = 1, EndLine = 0, SearchText = "", ReturnFirst = 1, ReturnText = 0)
Purpose: Find text using RegExMatch, return line(s), text or lines and text
Parameters: Text, StartLine, EndLine, SearchText, ReturnFirst, ReturnText
TF_Find(Lines) uses Regular Expressions - This means that if you use certain characters which have a special meaning in a RegEx: *\.\?+[{|()^\$** they must be preceded by a backslash to be seen as literal. For example, \. is a literal period and \\ is a literal backslash. Escaping can be avoided by using \Q...\E. For example: \QLiteral Text\E.
ReturnFirst = 0 return multiple lines
ReturnFirst = 1 return first line only
ReturnText = 0 return line numbers only
ReturnText = 1 return entire line (text). This simulates a basic grep feature
ReturnText = 2 return line numbers + entire line (text). This simulates a basic grep feature
MsgBox % TF_Find("File.txt", "", "", "keys") ; return first line number with keys in it
MsgBox % TF_Find("File.txt", "", "", " c[a-z]+s ", 0, 1) ; find all lines with words that start with a c an end with an s
jathri,
It seems it does the same thing as my script except for shortening "Total Commander" to "TC" and adding " -::- " between the path and the title instead of " :: "?
Roman
It seems it does the same thing as my script except for shortening "Total Commander" to "TC" and adding " -::- " between the path and the title instead of " :: "?
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.