For me there is no need for registering any wdx to use the button from Fla$her above.
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=