I use a old Autohotkey script named Toolbar which allows Normal, Shift and Ctrl presses of a button.
It was part of the ButtonBar eXtended tool from Samuel but its no longer on this thread.
Its much simpler as ButtonBar eXtended but I like it.
Code: Select all
; "Toolbar" the little brother of "ButtonBar eXtended" for Total Commander
; Version: 0.4
; Freeware by Samuel Plentz - www.SamuelPlentz.de.vu
#NoTrayIcon
#SingleInstance off
SetBatchLines -1
; ### --------------------------------------------------------------------------
; ### current section in ini-file
Getkeystate,Keystate_Ctrl ,Ctrl
Getkeystate,Keystate_Alt ,Alt
Getkeystate,Keystate_Shift,Shift
if(Keystate_Ctrl=="D"){
Section=[Button %1% Ctrl]
}else if(Keystate_Alt=="D"){
Section=[Button %1% Alt]
}else if(Keystate_Shift=="D"){
Section=[Button %1% Shift]
}else{
Section=[Button %1% Normal]
}
; ### --------------------------------------------------------------------------
; ### get parameters if needed (with internal command)
Needs_Parameters := NewIniRead(Section,"Needs_Parameters")
if(Needs_Parameters=="1"){
Clipboard_Backup:=ClipboardAll
Clipboard=
PostMessage,1075,2018,0,,ahk_class TTOTAL_CMD
if(WinExist("Total Commander ahk_class #32770")) {
Send {Space}
} else {
ClipWait,0.5
}
Selected_Files=%Clipboard%
Clipboard:=Clipboard_Backup
Clipboard_Backup=
Loop,parse,Selected_Files,`n,`r
{
if(A_Index=="1") {
Parameter_N="%A_LoopField%"
Parameter_S="%A_LoopField%"
SplitPath,A_LoopField,,Parameter_P
Parameter_P=%Parameter_P%\
} else {
Parameter_S=%Parameter_S% "%A_LoopField%"
}
}
}
; ### --------------------------------------------------------------------------
; ### wait if programs behave different with pressed down ctrl
Wait_Ctrl_Up := NewIniRead(Section,"Wait_Ctrl_Up")
if(Wait_Ctrl_Up=="1") {
Loop{
Getkeystate,Keystate_Ctrl ,Ctrl
Getkeystate,Keystate_Alt ,Alt
Getkeystate,Keystate_Shift,Shift
if(Keystate_Ctrl!="D" && Keystate_Alt!="D" && Keystate_Shift!="D"){
break
}
}
}
; ### --------------------------------------------------------------------------
; ### execute commands & files
Loop {
Current_Command := NewIniRead(Section,A_Index . "_Command")
Current_File := NewIniRead(Section,A_Index . "_File")
Current_SendInput := NewIniRead(Section,A_Index . "_SendInput")
transform,Current_File,deref,%Current_File%
if(Current_Command=="" && Current_File=="" && Current_SendInput=="") {
if(A_Index=="1") {
msgbox,16,No instructions for this button!,No entry in section "%Section%" of "Toolbar.ini".
; msgbox,16,Keine Anweisungen für den Knopf!,Kein Eintrag in Sektion "%Section%" der "Toolbar.ini".
}
break
}
if(Current_Command!="") {
if(InStr(Current_Command,"em_")==1){
EM_Command(Current_Command)
} else {
SendMessage,1075,%Current_Command%,0,,ahk_class TTOTAL_CMD
}
}
if(Current_File!="") {
Current_Parameter := NewIniRead(Section,A_Index . "_Parameter")
Current_Path := NewIniRead(Section,A_Index . "_Path")
transform,Current_Path,deref,%Current_Path%
StringReplace,Current_Path,Current_Path,`%P,%Parameter_P%,All
StringReplace,Current_Parameter,Current_Parameter,`%P,%Parameter_P%,All
StringReplace,Current_Parameter,Current_Parameter,`%N,%Parameter_N%,All
StringReplace,Current_Parameter,Current_Parameter,`%S,%Parameter_S%,All
if(Current_Parameter=="") {
Run,"%Current_File%",%Current_Path%
} else {
Run,"%Current_File%" %Current_Parameter%,%Current_Path%
}
}
if(Current_SendInput!="") {
SendInput %Current_SendInput%
}
}
ExitApp
; ### --------------------------------------------------------------------------
; ### read entry from ini file (own version because sometimes "" are omited)
NewIniRead(Section,Key)
{
static File_Content
if(File_Content=="") {
FileRead,File_Content,Toolbar.ini
}
Current_Section=0
Loop,parse,File_Content,`n,`r
{
if(InStr(A_LoopField,"[")=="1") { ; Section
if(A_LoopField==Section) {
Current_Section=1
} else {
Current_Section=0
}
} else { ; Key
if(Current_Section=="1" && InStr(A_LoopField,Key . "=")=="1"){
StringTrimLeft,Result,A_LoopField,InStr(A_LoopField,"=")
return Result
}
}
}
return ""
}
; ### --------------------------------------------------------------------------
; ### execute em_commands
EM_Command(ByRef SentParameter)
{
VarSetCapacity(CopyDataStruct,12)
InsertInteger(Asc("E")+256 * Asc("M"),CopyDataStruct)
InsertInteger(StrLen(SentParameter)+1,CopyDataStruct,4)
InsertInteger(&SentParameter,CopyDataStruct,8)
SendMessage,0x4A,,&CopyDataStruct,,ahk_class TTOTAL_CMD
}
InsertInteger(pInteger,ByRef pDest,pOffset=0,pSize=4)
{
mask := 0xFF
Loop %pSize%
{
DllCall("RtlFillMemory",UInt,&pDest+pOffset+A_Index-1,UInt,1,UChar,(pInteger & mask)>>8*(A_Index-1))
mask := mask<<8
}
}