Making Quick Access Popup TC compatible

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

Moderators: white, Hacker, petermad, Stefan2

hi5
Power Member
Power Member
Posts: 551
Joined: 2012-11-03, 11:35 UTC
Contact:

Post by *hi5 »

You can read the open tabs (apart from the current one) from the INI but the trick is you need to save the INI first before you can accurately read the lefttabs and righttabs sections - you can simply loop through the ini starting from zero 0_path 1_path etc and if you have an error there are no more tabs - add the current tab as you've probably already figured it out and then you have all tabs per panel - the controlgetfocus will tell you which panel is active (use window spy)

Code: Select all

cm_ConfigSaveSettings=580 ; save INI to update the left/righttabs sections
SendMessage, 0x433, %cm_ConfigSaveSettings%, , , ahk_class TTOTAL_CMD
You can find a list of all cm_ in a file called TOTALCMD.INC in your totalcmd folder. You can also read the directory history from the ini as well.
F4MiniMenu (Forum) - Open selected file(s) from TC in defined editor(s) - A (minimalistic) clone of F4Menu
Source at GitHub (AutoHotkey). TCSyncComments (copy file comments)
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

@hi5: That will only work if there are any tabs in the wincmd.ini. I use tabs quite heavily, however, I don't have any tabs in my wincmd.ini because I only use .tab files which I load when needed.

Secondly, a program should never ever save the user's settings in another program!

Unfortunately, I don't have anything to add about reading the open tabs - I just don't see a way to do it.

Regards
Dalai
#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
JnLLnd
Junior Member
Junior Member
Posts: 53
Joined: 2014-10-01, 12:14 UTC
Location: Montreal, Canada
Contact:

Post by *JnLLnd »

hi5 wrote:You can read the open tabs (apart from the current one) from the INI but the trick is you need to save the INI first...
Dalai wrote:a program should never ever save the user's settings in another program!
It would have been a solution if I was writing an AHK script for myself only. But, in fact, my app is distributed to a rather large audience.

Thanks for trying to find a solution to that one.

Jean
Author of the TC compatible freeware Quick Access Popup
QAP: http://www.quickaccesspopup.com
Other apps: http://code.jeanlalonde.ca
hi5
Power Member
Power Member
Posts: 551
Joined: 2012-11-03, 11:35 UTC
Contact:

Post by *hi5 »

JnLLnd wrote:It would have been a solution if I was writing an AHK script for myself only. But, in fact, my app is distributed to a rather large audience.
I don't see anything wrong with it as long as you explain it to TC users during the install or first setup. You can simply try to detect TC if you find TC at first start up ask the user if they want to integrate TC and explain what it needs to do in order for you to read all the open tabs. You can even offer an intermediate solution by giving the option to "only use currently active TAB" so you could skip the save INI.

Just to note: if you have tabs open and close TC the tabs are also saved, so in fact there isn't much difference - if you no longer have any tabs open in TC and close TC (or save the INI) the sections are removed from the INI.
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

hi5 wrote:Just to note: if you have tabs open and close TC the tabs are also saved, so in fact there isn't much difference
That's not necessarily true. You can disable the option to save open tabs on TC's exit (Operation > Save on exit > Directories). BTW, I've always had this option disabled. So the user expressed to not save any directories and tabs - and I don't expect any other program to interfere with this. Even if it's explained why this would have to be done, I expect user's complaints about that...

If there were a command SAVETABS (as opposed to OPENTABS and APPENDTABS) this would be an easy task.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
hi5
Power Member
Power Member
Posts: 551
Joined: 2012-11-03, 11:35 UTC
Contact:

Post by *hi5 »

@Dalai: Agreed on SAVETABS - probably an easy addition to make for a future TC version. As JnLLnd has received requests from TC users I still say make it optional and leave it to the TC user to decide - start with opt-out by default. I would opt-in and you would opt-out and we'd both be happy.

@JnLLnd: re 2 - you can also use a more advanced technique to change directories in TC using WM_COPYData - see this thread http://ghisler.ch/board/viewtopic.php?t=32658#236499.
User avatar
JnLLnd
Junior Member
Junior Member
Posts: 53
Joined: 2014-10-01, 12:14 UTC
Location: Montreal, Canada
Contact:

Post by *JnLLnd »

I think the best would be to have this SAVETABS command. I added it to the Ghisler's wish list:
http://www.ghisler.ch/board/viewtopic.php?p=289074

In the mean time, I already have a lot of material to start working on the FP/TC integration. I'll let you know when it is ready if you accept to join the beta tests.

Thank you all.
Author of the TC compatible freeware Quick Access Popup
QAP: http://www.quickaccesspopup.com
Other apps: http://code.jeanlalonde.ca
hi5
Power Member
Power Member
Posts: 551
Joined: 2012-11-03, 11:35 UTC
Contact:

Post by *hi5 »

Just for fun - not saying it has practical use - you can get a list of all open tabs by cycling through them all using sendmessages. Example: make sure you have several tabs open in the LEFT panel - the script below will try to read the number of tabs, then simply cycle through all open tabs, store the path and restore the original active tab.

Code: Select all

; cm_LeftActivateTab1=5201

SendMessage, 0x1304,,, TMyTabControl1, ahk_class TTOTAL_CMD  ; 0x1304 is TCM_GETITEMCOUNT. 
TabCount = %ErrorLevel% ; if there are no TABs this will be FAIL
MsgBox % TabCount
If (TabCount <> "FAIL")
	{
	 ControlGet, WhichTab, Tab, , TMyTabControl1, ahk_class TTOTAL_CMD
	 Loop, % TabCount
	 	{
		 ActivateTab:=5200 + A_Index
		 SendMessage, 0x433, %ActivateTab%, , , ahk_class TTOTAL_CMD
		 ControlGetText, OutputVar, TPathPanel1, ahk_class TTOTAL_CMD
		 TabPaths .= SubStr(OutputVar,1,InStr(OutputVar,"\",false,0)) "`n"
	 	}
	 ActivateTab:=5200 + WhichTab ; restore original tab
	 SendMessage, 0x433, %ActivateTab%, , , ahk_class TTOTAL_CMD
	} 

MsgBox % TabPaths
User avatar
JnLLnd
Junior Member
Junior Member
Posts: 53
Joined: 2014-10-01, 12:14 UTC
Location: Montreal, Canada
Contact:

Post by *JnLLnd »

hi5 wrote:Just for fun - not saying it has practical use - you can get a list of all open tabs by cycling through them all using sendmessages.
Interesting. But when I run it (with 3 tabs on left side) SendMessage returns "FAIL". Using Window Spy, I can't find the TMyTabControl1 control in the TC window.
Author of the TC compatible freeware Quick Access Popup
QAP: http://www.quickaccesspopup.com
Other apps: http://code.jeanlalonde.ca
hi5
Power Member
Power Member
Posts: 551
Joined: 2012-11-03, 11:35 UTC
Contact:

Post by *hi5 »

Sorry, forgot to add it is for 32-bit TC, 64-bit has different classes. The Window Spy isn't very good (imho) - if you download (the portable) AutoIt you can find Au3Info.exe which is much better (can't believe I'm saying this) and then you will see the TMyTabControl1 and TMyTabControl2 when you hover your mouse over these controls (32-bit, for 64-bit it is SysTabControl321). For 64-bit try this

Code: Select all

SendMessage, 0x1304,,, SysTabControl321, ahk_class TTOTAL_CMD  ; 0x1304 is TCM_GETITEMCOUNT.
TabCount = %ErrorLevel% ; if there are no TABs this will be FAIL
MsgBox % TabCount
If (TabCount <> "FAIL")
	{
	 ControlGet, WhichTab, Tab, , SysTabControl321, ahk_class TTOTAL_CMD
	 Loop, % TabCount
	 	{
		 ActivateTab:=5200 + A_Index
		 SendMessage, 0x433, %ActivateTab%, , , ahk_class TTOTAL_CMD
		 ControlGetText, OutputVar, Window11, ahk_class TTOTAL_CMD
		 TabPaths .= SubStr(OutputVar,1,InStr(OutputVar,"\",false,0)) "`n"
	 	}
	 ActivateTab:=5200 + WhichTab ; restore original tab
	 SendMessage, 0x433, %ActivateTab%, , , ahk_class TTOTAL_CMD
	} 

MsgBox % TabPaths
User avatar
Hacker
Moderator
Moderator
Posts: 13052
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

hi5,
The Window Spy isn't very good (imho) - if you download (the portable) AutoIt you can find Au3Info.exe which is much better
What's the difference between those two? I never found any.

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.
hi5
Power Member
Power Member
Posts: 551
Joined: 2012-11-03, 11:35 UTC
Contact:

Post by *hi5 »

@Hacker: the AU3_Spy.exe that has come with AHK since the beginning was never changed afaik. The newer Au3Info.exe that comes with recent AutoIt versions shows the class names of the control under the mouse more accurately. Try it with the TAB controls in TC, you won't see it with AU3_Spy.exe but you will with Au3Info.exe or other Window Spy tools (WinCheat by Alin Constantin for example) - it also has a nice "finder" where you can drag a cross-hair over a control which then gets a highlighted border around it which is a nice addition. I don't use AutoIt - I only borrow(ed) the newer spy.
User avatar
JnLLnd
Junior Member
Junior Member
Posts: 53
Joined: 2014-10-01, 12:14 UTC
Location: Montreal, Canada
Contact:

Post by *JnLLnd »

Yes, I was using an old script included with AHK. In the latest AU3 package, this tool is now named Au3Info.exe (or Au3Info_x64.exe) and it shows more info. Thanks for the tip.

About your script, thanks again. But I had to change the class name (in the loop) from "Window11" to "Window9" to make it work. I'm not sure this approach is totally reliable if class name change from one version to the other (or between the 32-bit and 64-bit). I'd certainly prefer an internal command :-)
Author of the TC compatible freeware Quick Access Popup
QAP: http://www.quickaccesspopup.com
Other apps: http://code.jeanlalonde.ca
User avatar
Hacker
Moderator
Moderator
Posts: 13052
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

hi5,
The only difference I see is that the AHK version shows the panel class name for the left half of the tab control for some reason, otherwise they seem to show the same info. Is there any other difference I am missing?

JnLLnd,
As far as I know those class names (well, their numbers, as in Window9 vs Window11) are dynamically generated by AHK for the given window. Not 100% sure though.

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.
hi5
Power Member
Power Member
Posts: 551
Joined: 2012-11-03, 11:35 UTC
Contact:

Post by *hi5 »

@Hacker: Under Win 7 and 8 pressing Shift+Alt+Tab doesn't freeze the program (you can freeze it but it has be fiddly to do so) the other Spy's shortcut to freeze does work and it gives more info (style, handle) overall presentation is better and as you've noticed it "sees" a bit more in TC.
Post Reply