Use a single command to switch between two views?

English support forum

Moderators: white, Hacker, petermad, Stefan2

User avatar
yyang
Member
Member
Posts: 155
Joined: 2007-03-27, 11:41 UTC
Location: China

Use a single command to switch between two views?

Post by *yyang »

Hi,

I'd like to switch between two views, the default side-by-side 50% double panels, and a 100% single vertical source panel.

It's easy to use 2 separate commands, but a single command works better with a custom shortcut key.

I came up with the following user command, but the "|" character didn't work there:

Code: Select all

cmd=cm_VerticalPanels,cm_100percent|cm_50percent
Is it possible to define such a command so that a single shortcut key can be used to switch between these two views? Thanks!
Last edited by yyang on 2023-01-26, 14:07 UTC, edited 1 time in total.
#147523
User avatar
tuska
Power Member
Power Member
Posts: 3755
Joined: 2007-05-21, 12:17 UTC

Re: Use a single command to switch between two views?

Post by *tuska »

Hi,

I have a similar solution for this topic.

It must be mentioned, however, that this method has an impact on the subsequent View mode with Auto Switch Mode.
However, the View mode with Auto Switch Mode can be restored with the command: cm_RereadSource 2 by button-click.

If you are still interested in this solution, let me know.
User avatar
Stefan2
Power Member
Power Member
Posts: 4158
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Use a single command to switch between two views?

Post by *Stefan2 »

yyang wrote: 2023-01-26, 06:10 UTC Hi,

I'd like to switch between two views, the default side-by-side 50% double panels, and a 100% single vertical source panel.
...

Is it possible to define such a command so that a single shortcut key can be used to switch between these two views? Thanks!

See viewtopic.php?t=53536

( in German language ) for a AHK solution and the tip to use TCFS2 Tool by MVV.


Maybe that will help you?






 
Fla$her
Power Member
Power Member
Posts: 2296
Joined: 2020-01-18, 04:03 UTC

Re: Use a single command to switch between two views?

Post by *Fla$her »

2yyang
TCFS2 + TCFS2Tools:

Code: Select all

TOTALCMD#BAR#DATA
%COMMANDER_PATH%\Utils\TCFS2\TCFS2.exe
/ef tcm(305) if(tcm(65555),tcm(910),tcm(909))
wcmicons.dll,86
Switch between one horisontal and two vertical panels
Overquoting is evil! 👎
User avatar
yyang
Member
Member
Posts: 155
Joined: 2007-03-27, 11:41 UTC
Location: China

Re: Use a single command to switch between two views?

Post by *yyang »

Thank you all so much! Problem solved nicely. It turns out yet again that almost everything I can imagine has its answer in one or multiple old threads. Reading through them and having something to copy and test are both great pleasure. TCFS2 is flexible and powerful indeed... No excuse to ignore it any more. :)
#147523
User avatar
tuska
Power Member
Power Member
Posts: 3755
Joined: 2007-05-21, 12:17 UTC

Re: Use a single command to switch between two views?

Post by *tuska »

2yyang

Interesting :)

Out of interest, I tested these two buttons: Fla$her, Horst.Epp
but without success, because I received this error message, for example: "Function not implemented! 65555".

Which button worked for you?

PS:
I am not clear how TCFS2Tools communicates with TCFS2.
I have created two separate folders for this.
Maybe the .ini files in %COMMANDER_PATH%\Tools\TCFS2\ need to be adjusted?
(This is the first time I have used these tools).


Windows 11 Pro (x64) Version 22H2 (OS build 22621.1105) | TC 10.52 x64/x86
sa16
Senior Member
Senior Member
Posts: 217
Joined: 2021-09-10, 07:15 UTC

Re: Use a single command to switch between two views?

Post by *sa16 »

2tuska
Readme.txt wrote:4. Loading module on TC start

There are at least two ways to load module on TC start. First way is to register TCFS2Tools.dll as WDX plugin and to define special 'color by file type' preset (Configuration, Color, by file type, Add, Define, Plugins tab, "TCFSTools.Autorun > 0", save with any name, select any color, apply all changes) to cause TC to load TCFS2Tools automatically.

You may also use Autorun.wdx content plugin in order to load HideMenu module on TC start. You need to add following line to Autorun.cfg file:

LoadLibrary "X:\Path\To\TCFS2Tools.dll"
User avatar
tuska
Power Member
Power Member
Posts: 3755
Joined: 2007-05-21, 12:17 UTC

Re: Use a single command to switch between two views?

Post by *tuska »

2sa16
Thank you.
I have also read this in the meantime.

Unfortunately, I don't understand how to register TCFS2Tools.dll as WDX plugin, because it requires the file extension .wdx.
User avatar
Stefan2
Power Member
Power Member
Posts: 4158
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Use a single command to switch between two views?

Post by *Stefan2 »

tuska wrote: 2023-01-27, 13:47 UTC Unfortunately, I don't understand how to register TCFS2Tools.dll as WDX plugin, because it requires the file extension .wdx.
Yes and no.
Not if you follow the readme and modify the WINCMD.INI
TCFS2Tools_1.4.3.188 own Readme.txt

4. Loading module on TC start

First way is to register TCFS2Tools.dll as WDX plugin

WINCMD.INI
[ContentPlugins]
xx=%Commander_Path%\plugins\TCFS2\TCFS2Tools.dll
xx_detect=
where xx is the next free number of ContentPlugins entries

Example for my ini:
29=%Commander_Path%\plugins\TCFS2\TCFS2Tools.dll
29_detect=



and to define special 'color by file type' preset

Configuration, Color,
by file type, Add,
[Define],
Plugins tab,
"TCFSTools | Autorun | > | 0",

save with any name ( e.g. "TCFSToolsDummy"),
apply all changes (color choosing can be cancelled))
to cause TC to load TCFS2Tools automatically.
(Maybe need to restart TC here?) NO, not for me.

TEST
To test if this works try e.g. this command:
Command: %Commander_Path%\plugins\TCFS2\TCFS2.exe
Parameters: /ei "sp_set_active(80)"

-------------------------
TOTALCMD#BAR#DATA
"%Commander_Path%\plugins\TCFS2\TCFS2.exe"
/ei "sp_set_active(80)"
plugins\TCFS2\TCFS2.exe
TEST -- plugins\TCFS2\TCFS2.exe /ei "sp_set_active(80)"


-1

-------------------------




 
sa16
Senior Member
Senior Member
Posts: 217
Joined: 2021-09-10, 07:15 UTC

Re: Use a single command to switch between two views?

Post by *sa16 »

2tuska
Rename the .dll to .wdx.
User avatar
tuska
Power Member
Power Member
Posts: 3755
Joined: 2007-05-21, 12:17 UTC

Re: Use a single command to switch between two views?

Post by *tuska »

2Stefan2
Thanks for the support! :)

I hope I can implement this, because in the meantime I have installed the plugin "Autorun 2.1.1".
(Norton 360 has irretrievably deleted the file "C:\totalcmd\Plugins\wdx\Autorun\Plugins\Autorun_Sysinfo.dll".
However, the file C:\totalcmd\Plugins\wdx\Autorun\Plugins\Autorun_Sysinfo.dll64 is still present).

I created the file "Autorun.cfg" with the following content:

Code: Select all

LoadLibrary "C:\totalcmd\Tools\TCFS2Tools\TCFS2Tools.dll"
The buttons listed above still do not work.
I then removed the Autorun plugin.
---
However, I have made one piece of progress, and that is

Code: Select all

;%COMMANDER_PATH%\Tools\TCFS2\TCFS2.exe /ef tcm(305) if(tcm(65555),tcm(910),tcm(909)) -> changed to...
%COMMANDER_PATH%\Tools\TCFS2\TCFS2.exe /ef tcm(305) if(tcm(910),tcm(909))
switches to cm_100Percent after clicking the button (without error message).
After clicking the button again, cm_100Percent remains and shows only content of left panel.


2sa16
Thanks, but the renaming

Code: Select all

FROM: C:\totalcmd\Tools\TCFS2Tools\TCFS2Tools.dll
TO:   C:\totalcmd\Tools\TCFS2Tools\TCFS2Tools.wdx
has unfortunately not brought the desired success.
(I also had this idea and duplicated and renamed the file).



I am now trying to implement Stefan's solution...
sa16
Senior Member
Senior Member
Posts: 217
Joined: 2021-09-10, 07:15 UTC

Re: Use a single command to switch between two views?

Post by *sa16 »

2tuska
For TCx64, you probably need to rename .dll64 to .wdx64.
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6480
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Use a single command to switch between two views?

Post by *Horst.Epp »

For me there is no need for registering any wdx to use the button from Fla$her above.

My Autorun.cfg looks like this

Code: Select all

if "%AUTORUN_TCARCH%" = "64" then
LoadLibrary "c:\Tools\Wincmd\PLUGINS\TCFS2\TCFS2Tools64.dll"
else
LoadLibrary "c:\Tools\Wincmd\PLUGINS\TCFS2\TCFS2Tools.dll"
endIf
The TCFS2.ini is as follows

Code: Select all

[Items]
; Commands
; Id=apply_cmd1(...) [apply_cmd2(...) ...] [, check_cmd(...) [, undo_id1 [undo_id2 ...] [, undo_check_cmd(...)]]] [| apply_cmdN(...) ...] [; Description]
; You may specify more than one command line in single id, just divide them with '|' - only one will be executed (w/o condition or with true condition)

tcopy=set_tcini(Configuration,ShowCopyOptions,1) tcm(905,1) eval(select_wait(`#1`,findwnd(LCLComboBox,,findwnd(Button,,findwnd(TInpComboDlg),0)),1))

; Window Management Commands
m0=show(9), eval(isMaximized), m1					; Restore Window
m1=show(3), eval(!isMaximized), m0					; Maximize Window
m2=show(isMaximized ? 9 : 3), , m2					; Maximize/Restore Switch
c0=set_style(# & ~$00C00000), eval(hasCaption), c1	; Caption Off
c1=set_style(# | $00C00000), eval(!hasCaption), c0	; Caption On
c2=set_style(# ^ $00C00000), , c2					; Caption Switch
t0=move(, , , , 0), eval(isTopmost), t1				; Disable On Top
t1=move(, , , , 1), eval(!isTopmost), t0			; Enable On Top
t2=move(, , , , isTopmost ? 0 : 1), , t2			; Switch On Top
locktc=msg($0B, #1-0 > 0 ? 0 : 1, 0)				; Disable/enable TC window redraw (1 or 0 as parameter)
redraw=redraw()										; Redraw entire TC window
update=redraw() tcm(2918)							; Redraw TC window and active panel's cursor (it may disappear after redraw locking)


; Built-in TC Commands
rr=tcm(540)											; Reread
tb0=tcm(2901), eval(hasButtonBar), tb1				; Buttonbar Hide
tb1=tcm(2901), eval(!hasButtonBar), tb0				; Buttonbar Show
db0=tcm(2902), eval(hasDriveBar), db1				; Drivebar Hide
db1=tcm(2902), eval(!hasDriveBar), db0				; Drivebar Show
2b0=tcm(2903), eval(hasDriveBar2), 2b1				; Use single drive bar
2b1=tcm(2903), eval(!hasDriveBar2), 2b0				; Use two drive bars
dc0=tcm(2906), eval(hasDriveCombo), dc1				; Drive Combo Hide
dc1=tcm(2906), eval(!hasDriveCombo), dc0			; Drive Combo Show
dt0=tcm(2916), eval(hasDirTabs), dt1				; Directory Tabs Disable (if you close TC, you'll lost all tabs!)
dt1=tcm(2916), eval(!hasDirTabs), dt0				; Directory Tabs Enable
cd0=tcm(2907), eval(hasPathHeader), cd1				; Path Bars Show
cd1=tcm(2907), eval(!hasPathHeader), cd0			; Path Bars Hide
th0=tcm(2908), eval(hasTabHeader), th1				; Tabstop Headers Hide
th1=tcm(2908), eval(!hasTabHeader), th0				; Tabstop Headers Show
sb0=tcm(2909), eval(hasStatusBar), sb1				; Status Bar Hide
sb1=tcm(2909), eval(!hasStatusBar), sb0				; Status Bar Show
cl0=tcm(2910), eval(hasCmdLine), cl1				; Command Line Hide
cl1=tcm(2910), eval(!hasCmdLine), cl0				; Command Line Show
kb0=tcm(2911), eval(hasKeyButtons), kb1				; F-Keys Hide
kb1=tcm(2911), eval(!hasKeyButtons), kb0			; F-Keys Show


; Examples of moving window
r1=move(, , 800, 600)									; Resize window to 800x600
r2=move(0, 0, , )										; Move window to (0, 0)
r3=move(#-100, , #+100)									; Resize window left by 100 px
r4=move(, #+100)										; Move window down by 100 px
r5=move(@-800, 0, 800, 600)								; Resize window to 800x600 and move to right upper screen corner
r6=move(0, 0, @, @-4)									; Set window width to screen width and height to screen height minus 4 pixels
r7=move(@*2/10+1, cyWorkArea-@*7/10+1, @*8/10, @*7/10)	; Move window to right bottom corner and resize to 0.8 of screen width and 0.7 of screen height

switch_sp=move(# ? 0 : @*7/64, # ? 0 : @*7/64, @-# ? @ : @*25/32, cyWorkArea-# ? cyWorkArea : @*25/32), , switch_sp	; Switch between large and medium window sizes
sys_move=msg($0112, $F010, 0, 1) msg($0100, $26, $01000001, 1) msg($0101, $26, $C1000001, 1)							; Send system menu "Move" command


; Auxiliary Commands
fs2=if(hasCaption, locktc(1) + run_action(fs) + locktc(0) + show(3) + save_undo(fs_undo), show(9) + locktc(1) + run_action(fs_undo) + locktc(0)) run_item(update)	; Switch to fullscreen mode by calling fs action (if window title is not hidden) or calls fs_undo action
cfixm0=, eval(isMaximized) | if(hasCaption, move(#-1, #-cyCaption-1, #+2, #+cyCaption+2), move(#+1, #+cyCaption+1, #-2, #-cyCaption-2)), , cfixm0					; Move window after switching caption so client area preserves position (if window is not maximized)
cfixm1=run_item(update), eval(isMaximized), cfixm1																													; Cause window update to be performed after style change (if window is maximized)

bb_inc=tcm(2901) set_tcini(Buttonbar,Buttonheight,#+1) tcm(2901), tcini(Layout,ButtonBar,1,1), bb_dec | set_tcini(Buttonbar,Buttonheight,#+1) tcm(2901), , bb_dec	; Increase buttonbar buttons size by 1 px
bb_dec=tcm(2901) set_tcini(Buttonbar,Buttonheight,#-1) tcm(2901), tcini(Layout,ButtonBar,1,1), bb_inc | set_tcini(Buttonbar,Buttonheight,#-1) tcm(2901), , bb_inc	; Decrease buttonbar buttons size by 1 px

switch_ignore_list=if(isIgnoreListEnabled, tcm(2922)+set_tcini(Configuration,IgnoreListFile,#1)+tcm(2922), set_tcini(Configuration,IgnoreListFile,#1))				; Switch to another ignore list (if ignore list was enabled, it will be enabled after switching)


; Commands to move file panels separator (active TCFS2Tools.dll required)
set_separator=msg($0433, tt_SeparatorSet, #1)							; Set separator position (uses first command parameter)
sp_set_active=run_item(set_separator, L_isActive ? (#1) : 100 - (#1))	; Set active panel width in percents (uses first command parameter)

sp_move=run_item(set_separator, -1)										; Move separator using mouse (click to apply)
sp_inc=run_item(set_separator, sepPos+10)
sp_dec=run_item(set_separator, sepPos-10)
sp_inc_r=run_item(set_separator, if(sepPos > 80, 20, sepPos + 20))		; Increase separator position by 20% or sets it to 20% if greater or equal than 80%

sp_set0=run_item(set_separator, 0)										; Set separator position to 0%
sp_set20=run_item(set_separator, 20)
sp_set40=run_item(set_separator, 40)
sp_set60=run_item(set_separator, 60)
sp_set80=run_item(set_separator, 80)
sp_set100=run_item(set_separator, 100)									; Set separator position to 100%


; Commands to control main menu (active TCFS2Tools.dll required)
mm0=tcm(tt_HideMainMenu)												; Hide main menu string
mm1=tcm(tt_ShowMainMenu)												; Show main menu string
mm2=tcm(tt_SwitchMainMenu)												; Switch main menu string
mm_track=tcm(tt_TrackMainMenu)											; Display main menu as popup menu


; Commands to switch between panel view modes and scroll lists (active TCFS2Tools.dll required)
switch_viewmode_L=set_tcini(left, LastViewMode, L_viewMode) tcm(#1), eval(L_viewMode != (#1)) | tcm(tcini(left, LastViewMode, #))	; Switch between specified in parameter and previous view mode for left panel
switch_viewmode_R=set_tcini(right, LastViewMode, R_viewMode) tcm(#1), eval(R_viewMode != (#1)) | tcm(tcini(right, LastViewMode, #))	; Switch between specified in parameter and previous view mode for right panel
switch_viewmode_S=run_item(switch_viewmode_L, #1-200), eval(L_isActive) | run_item(switch_viewmode_R, #1-100)						; Switch between specified in parameter and previous view mode for active panel

scroll_list_h=loop(@<=(if(#2>0,#2,-#2)) + 0*sendmsg(msg(WM_TC_COMMAND, tt_GetPanel, #1), $114, if(#2>0,3,2), 0))					; Scroll filelist some pages left/right. First parameter: 1 - left panel, 2 - right panel; second one - number of pages
scroll_list_v=loop(@<=(if(#2>0,#2,-#2)) + 0*sendmsg(msg(WM_TC_COMMAND, tt_GetPanel, #1), $115, if(#2>0,3,2), 0))					; Scroll filelist some pages up/down. First parameter: 1 - left panel, 2 - right panel; second one - number of pages
scroll_list=if(#1==2 ? R_viewMode==201 : L_viewMode==101, run_item(scroll_list_h, #1, #2), run_item(scroll_list_v, #1, #2))			; Ïðîêðóòèòü ñïèñîê íà çàäàííîå ÷èñëî ñòðàíèö. Ïåðâûé ïàðàìåòð: 1 - ëåâàÿ ïàíåëü, 2 - ïðàâàÿ; âòîðîé - ÷èñëî ñòðàíèö


; Functions and parameters:
;
; 0
; 1
; if(<condition>, [<true_expression>], [<false_expression>])
; loop(<expression>)
; null(<something>)
; eval(<expression>)
; style([<value>], [<exvalue>])
; tcini(<section>, <key>, <value>|`<string_value>`, [<error_value>], [<flags>])
; ini(`<ini_file>`, <section>, <key>, <value>|`<string_value>`, [<error_value>], [<flags>])
; msg(<umsg>, <wparam>, <lparam>, [<async_mode>])
; regmsg(<msg_name>)
; findwnd([`<class>`], [`<text>`])
; tcd([`<left_path>`], [`<right_path>`], [S][T], [<async_mode>])
; tcm(<cm_index>, [<async_mode>])
; tem(`<em_command_name> [<parameters>]`, [<async_mode>])
; send([@]`<keystrokes>`, [<hwnd>])
; sendmsg(<hwnd>, <umsg>, <wparam>, <lparam>, [<async_mode>])
; varcnt()
; varget(<n>)
; varset(<n>, <x>)
;
; show(<state>)
; move([<x>], [<y>], [<cx>], [<cy>], [<topmost>])
; redraw()
; run_item(<item_name>, [<params>])
; run_action(<action_name>)
; set_style([<value>], [<exvalue>])
; set_tcini(<section>, <key>, [<value>]|`<string_value>`, [<error_value>], [<flags>])
; set_ini(`<inipath>`, <section>, <key>, [<value>]|`<string_value>`, [<error_value>])
; save_undo(<undo_name>)
; delay(<msec>)

; Built-in macroses:
;
; @sid


[Macros]
; Some constants for show function
SW_HIDE=0
SW_SHOWMAXIMIZED=3
SW_MINIMIZE=6
SW_RESTORE=9

; Some constants for style/set_style functions
WS_CAPTION=$00C00000		; Window has title bar (caption)
WS_MAXIMIZE=$01000000		; Window is maximized
WS_VISIBLE=$10000000		; Window is visible
WS_MINIMIZE=$20000000		; Window is minimized
WS_EX_TOPMOST=$00000008		; Window is on top
WS_EX_TOOLWINDOW=$00000080	; Window has small title bar and no taskbar button

; Some constants for msg function
WM_TC_COMMAND=$0433		; Sends internal TC commands (internal TC message)
WM_SETREDRAW=$0B		; Enables/disables window redraw
WM_KEYDOWN=$0100		; Imitates pressing a key
WM_KEYUP=$0101			; Imitates releasing a key
WM_SYSCOMMAND=$0112		; Sends special commands from windows system menu

; Some virtual-key codes
VK_CONTROL=$11	; Control
VK_ESCAPE=$1B	; Escape
VK_LBUTTON=$1	; Left mouse button
VK_RBUTTON=$2	; Right mouse button
VK_MBUTTON=$4	; Middle mouse button
VK_MENU=$12		; Alt
VK_SHIFT=$10	; Shift

; Flags for tcini/set_tcini/ini functions
ini_Redirection=$1
ini_StrCmpCase=$8000

; Some helper functions
if_empty=if(null(#1), #2, #1)														; Return first parameter if it is not empty, or second otherwise - i.e. default parameter value
wait_for=loop(@<=(#2) && if(#1, 0, delay(1000)))									; Waits until condition becomes true (checks once per second). First parameter - condition to be checked, second one - number of seconds to wait
send_wait=loop(@<=if_empty(#3,5)*20 && if(#2,sendmsg(#2)*send(#1,#2)*0,delay(50)))	; Waits for window and sends keys to it. First two parameters - as for send function, third - number of seconds to wait (5 by default)
locktc=msg($0B, #1-0 > 0 ? 0 : 1, 0)												; Disable/enable TC window redraw (1 or 0 as parameter)

; Some functions that check window state
hasButtonBar=tcini(Layout, ButtonBar, 1, 1)	; True if buttonbar is not disabled in wincmd.ini
hasDriveBar=tcini(Layout, DriveBar1, 1)		; True if drive bar is enabled in wincmd.ini
hasDriveBar2=tcini(Layout, DriveBar2, 1)	; True if two drive bars mode enabled in wincmd.ini
hasDriveCombo=tcini(Layout, DriveCombo, 1)
hasDirTabs=tcini(Layout, DirectoryTabs, 1)
hasPathHeader=tcini(Layout, CurDir, 1)
hasTabHeader=tcini(Layout, TabHeader, 1)
hasStatusBar=tcini(Layout, StatusBar, 1)
hasCmdLine=tcini(Layout, CmdLine, 1)
hasKeyButtons=tcini(Layout, KeyButtons, 1)

hasCaption=style(# & $00C00000)
isMaximized=style(# & $01000000)
isTopmost=style(, # & $08)

; Configuration parameters
isIgnoreListEnabled=tcini(Configuration, IgnoreListFileEnabled, 1, 1)

; Some TCFS2Tools command numbers (may be changed in TCFS2Tools.ini)
tt_ShowMainMenu=65537
tt_HideMainMenu=65538
tt_SwitchMainMenu=65539
tt_TrackMainMenu=65540
tt_GetWindowMetrics=65550
tt_LeftIsActive=65551
tt_RightIsActive=65552
tt_LeftGetViewMode=65553
tt_RightGetViewMode=65554
tt_IsVerticalPanels=65555
tt_GetPanel=65556
tt_SeparatorGet=65561
tt_SeparatorSet=65562
tt_GetSystemMetrics=65570
tt_GetWorkArea=65571
tt_GetAsyncKeyState=65572
tt_GetSomeInfo=65573
tt_LeftTabIndex=65580
tt_RightTabIndex=65581
tt_LeftTabCount=65582
tt_RightTabCount=65583
tt_LeftTabSetIndex=65584
tt_RightTabSetIndex=65585
tt_LeftTabIsLocked=65586
tt_RightTabIsLocked=65587
tt_RegRead=regmsg(TCFS2.RegRead)
tt_RegWrite=regmsg(TCFS2.RegWrite)
tt_RegCount=regmsg(TCFS2.RegCount)

; Some commands retrieving information (active TCFS2Tools.dll required)
GetSystemMetrics=msg($433, tt_GetSystemMetrics, #1)	; Get sysmet metric with index passed in parameter
GetAsyncKeyState=msg($433, tt_GetAsyncKeyState, #1)	; Get state of virtual-key with code passed in parameter
GetTickCount=msg($433, tt_GetSomeInfo, 0)			; Get number of milliseconds since Windows start

cyCaption=msg($433, tt_GetSystemMetrics, 4)	; Height of window title (caption)
cxWorkArea=msg($433, tt_GetWorkArea, 0)		; Width of desktop work area (w/o taskbar)
cyWorkArea=msg($433, tt_GetWorkArea, 1)		; Height of desktop work area (w/o taskbar)
xWorkArea=msg($433, tt_GetWorkArea, 2)		; Horizontal position of desktop work area position (w/o taskbar)
yWorkArea=msg($433, tt_GetWorkArea, 3)		; Vertical position of desktop work area (w/o taskbar)
cxScreen=GetSystemMetrics(0)				; Width of primary screen
cyScreen=GetSystemMetrics(1)				; Height of primary screen

pressedShift=msg($433, tt_GetAsyncKeyState, $10) < 0	; True if Shift is down at this moment
pressedCtrl=msg($433, tt_GetAsyncKeyState, $11) < 0
pressedAlt=msg($433, tt_GetAsyncKeyState, $12) < 0
pressedRButton=msg($433, tt_GetAsyncKeyState, $2) < 0
pressedMButton=msg($433, tt_GetAsyncKeyState, $4) < 0

xTcWindow=msg($433, tt_GetWindowMetrics, 0)		; Coordinate X of TC window
yTcWindow=msg($433, tt_GetWindowMetrics, 1)		; Coordinate Y of TC window
wTcWindow=msg($433, tt_GetWindowMetrics, 2)		; Width of TC window
hTcWindow=msg($433, tt_GetWindowMetrics, 3)		; Height of TC window
xTcWindowCli=msg($433, tt_GetWindowMetrics, 4)	; Coordinate X of TC window client part (w/o title, menu and borders)
yTcWindowCli=msg($433, tt_GetWindowMetrics, 5)	; Coordinate Y of TC window client part
wTcWindowCli=msg($433, tt_GetWindowMetrics, 6)	; Width of TC window client part
hTcWindowCli=msg($433, tt_GetWindowMetrics, 7)	; Height of TC window client part

isVerticalPanels=msg($433, tt_IsVerticalPanels)				; True if vertical panels arrangement is enabled
sepPos=msg($433, tt_SeparatorGet)							; Current file panels separator position
L_isActive=tcm(tt_LeftIsActive)								; True if left panel is active
R_isActive=tcm(tt_RightIsActive)							; True if right panel is active
L_viewMode=tcm(tt_LeftGetViewMode)							; Returns cm_Left* command for current left panel's view mode
R_viewMode=tcm(tt_RightGetViewMode)							; Returns cm_Right* command for current right panel's view mode
S_viewMode=if(L_isActive, L_viewMode+200, R_viewMode+100)	; Returns cm_Src* command for current active panel's view mode

; Read/write TCFS2Tools registers commands
regread=msg(tt_RegRead, #1, #2-0)							; Returns value from register with number passed in first parameter, or error value from second parameter
regwrite=msg(tt_RegWrite, #1, #2)							; Stores value from second parameter in register with address from first parameter; returns address on success or zero if address is invalid
regcount=msg(tt_RegCount)									; Returns number of available registers


[Actions]
; Actions
; Name=Id1 Id2 Id3 ... [													; Description		]
; "Undo" is a built-in command that keeps list of last operation undo Ids
fs=c0 db0 dc0 cd0 th0 sb0 cl0 kb0
fs2=fs2																		; Reversive full-screen switcher (calls fs action or fs_undo)
title_switch=c2 cfixm0 cfixm1												; Switches title and moves window so client area preserves position (if window is not maximized)
begin_move=sys_move 														; Allows quickly move window even if its title is disabled
Undo=
Windows 11 Home x64 Version 23H2 (OS Build 22631.3447)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.3, Listary Pro 6.3.0.73
QAP 11.6.3.2 x64
User avatar
tuska
Power Member
Power Member
Posts: 3755
Joined: 2007-05-21, 12:17 UTC

Re: Use a single command to switch between two views?

Post by *tuska »

2Stefan2
Thank you for your detailed description and explanations!

I assume that everything works as you described, but I haven't tested it since I only just got around to it
and wanted to implement the tip from user sa16 beforehand.
sa16 wrote: 2023-01-27, 14:59 UTC 2tuska
For TCx64, you probably need to rename .dll64 to .wdx64.
Thank you very much, this is the solution for me in Total Commander (x64) 10.52
using the code posted here by user Fla$her!

For me it looks like this now:

Code: Select all

C:\totalcmd\Tools\TCFS2Tools\

Name/Ext		Size	Date			Attr
------------------------------------------------------------
Readme.txt		18 342	31.01.2016 23:03	-a--
TCFS2Tools.dll		 9 216	31.01.2016 23:03	-a--
TCFS2Tools.dll64	11 264	31.01.2016 23:03	-a--
TCFS2Tools.wdx64	11 264	31.01.2016 23:03	-a--
------------------------------------------------------------
I registered the file "TCFS2Tools.dll64" as a WDX plugin as follows:
- I duplicated the file "TCFS2Tools.dll64" and then renamed it to "TCFS2Tools.wdx64"
- Configuration > Options... > Plugins > Content plugins (.WDX) > press Button "Configure" > click on "Add" >
  C:\totalcmd\Tools\TCFS2Tools\TCFS2Tools.wdx64 ...

Thanks again to all for the support!


TC 10.52 x64 | TCFS2 + TCFS2Tools: Full-screen mode for TC etc | TCFS2 2.4.3.584 | TCFS2Tools 1.4.4.216 | Autorun 2.1.1
sa16
Senior Member
Senior Member
Posts: 217
Joined: 2021-09-10, 07:15 UTC

Re: Use a single command to switch between two views?

Post by *sa16 »

2tuska
I have this implemented:
/ef "run_item(locktc,1) if(isVerticalPanels, tcm(909), tcm(910)) tcm(305) run_item(locktc,0) redraw"
Post Reply