ButtonBar eXtended (with macro support)

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

Moderators: white, sheep, Hacker, Stefan2

Post Reply
User avatar
Samuel
Power Member
Power Member
Posts: 1856
Joined: 2003-08-29, 15:44 UTC
Location: Brandenburg, Germany
Contact:

ButtonBar eXtended (with macro support)

Post by *Samuel » 2008-09-17, 15:03 UTC

ButtonBar eXtended for Total Commander


Download:

ButtonBar eXtended 2.3
ButtonBar eXtended readme
ButtonBar eXtended source (AHK)


Video:

Watch the video to see how it works:
ButtonBar eXtended video

For further informations read the readme.


Very important:

Please, please, please read the readme to get informations about installation, usage and the last changes.
Its useful - trust me. :D


Features:
  • Create buttons that run macros (of TC commands and/or program calls)
  • Buttons can run different commands if you hold down modifier keys like Ctrl, Alt and Shift. Its also possibly to use mouse buttons as modifiers.
  • Integration into TCs buttonbar.
Suggestions are welcome.
Last edited by Samuel on 2012-03-21, 18:14 UTC, edited 20 times in total.

TRSyntax
Junior Member
Junior Member
Posts: 57
Joined: 2008-04-22, 03:52 UTC

Post by *TRSyntax » 2008-09-18, 09:41 UTC

I can use this :D makes things even more simple. c",)
[Button 2 Normal]
1_Command=69
2_Command=169
does this do the same trick as TCMC ?

User avatar
Samuel
Power Member
Power Member
Posts: 1856
Joined: 2003-08-29, 15:44 UTC
Location: Brandenburg, Germany
Contact:

Post by *Samuel » 2008-09-18, 23:53 UTC

Yes you can execute any number of internal commands.

Code: Select all

1_Command=...
2_Command=...
3_Command=...
4_Command=...
5_Command=...
6_Command=...
7_Command=...
You can also alternate commands with file executions like:

Code: Select all

1_Command=...
2_File=...
2_Path=...
2_Parameter=...
3_Command=...

TRSyntax
Junior Member
Junior Member
Posts: 57
Joined: 2008-04-22, 03:52 UTC

Post by *TRSyntax » 2008-09-23, 20:18 UTC

is there anyway to have hotkeys to theese commands as well. or add program in custom commands?

like for an instance:
[Button 2 Normal]
1_Command=69
2_Command=169


does this do the same trick as TCMC ?
i can use hotkeys to open a TCMC command, can i do this with this prog as well ?

my tcmc gets killed by my antivirus all the tim and i cant whitelist it with my antivirus program :S stupid

User avatar
Samuel
Power Member
Power Member
Posts: 1856
Joined: 2003-08-29, 15:44 UTC
Location: Brandenburg, Germany
Contact:

Post by *Samuel » 2008-09-24, 12:08 UTC

Yes, you can use the program for triggering macros by hotkeys.

Just create a user defined command by creating the "usercmd.ini" in the same directory as "wincmd.ini" with an entry like:

Code: Select all

[em_SwitchBothPanelsToThumbnailMode]
cmd=**your path to Toolbar.exe**\Toolbar.exe 
param=2
path=**your path to Toolbar.ini**
Then you need two entries in the "Toolbar.ini" like:

Code: Select all

[Button 2 Normal]
1_Command=69
2_Command=169

[Button 2 Ctrl]
1_Command=69
2_Command=169
I created both entries, so the hotkey can have the ctrl-key pressed or not.

Now you can just assign any hotkey to the command: em_SwitchBothPanelsToThumbnailMode

sgp
Senior Member
Senior Member
Posts: 355
Joined: 2005-01-31, 16:04 UTC

Post by *sgp » 2009-02-03, 22:51 UTC

Hi, nice script!
Is it possible to specify a TC "command with parameter", like OPENBAR, CD, LOADSEARCH, etc. ?
The comments in the script say that the script doesn't use IniRead because sometimes quotes are omitted. Could you please provide an example of when quotes are omitted? Omitted means that they disappear, right?

User avatar
Samuel
Power Member
Power Member
Posts: 1856
Joined: 2003-08-29, 15:44 UTC
Location: Brandenburg, Germany
Contact:

Post by *Samuel » 2009-02-03, 23:10 UTC

Internal commands with parameters are not supported yet.
1. I don't have a clue how. (Someone tell me how and I'll try.)
2. I don't need them.

As far as I know (didn't try again) the automatic "Iniread" (which I didn't use in this program) let disappear some quotes. (bug and feature from Autohotkey) For example in parameter strings like this:

Code: Select all

1_File=notepad.exe
1_Parameter="C:\directory with some spaces\textfile.txt"
The command executed is:

Code: Select all

notepad.exe C:\directory with some spaces\textfile.txt
and not:

Code: Select all

notepad.exe "C:\directory with some spaces\textfile.txt"
So my self written function used in this script is just a workaround.

sgp
Senior Member
Senior Member
Posts: 355
Joined: 2005-01-31, 16:04 UTC

Post by *sgp » 2009-02-04, 10:17 UTC

Samuel wrote:Internal commands with parameters are not supported yet.
1. I don't have a clue how. (Someone tell me how and I'll try.)
2. I don't need them.
Unfortunately I need them but I have no clue how to implement them. I don't know if the Windows SendMessage interface that your script uses to send command IDs to TC can support string parameters.
As far as I know (didn't try again) the automatic "Iniread" (which I didn't use in this program) let disappear some quotes. (bug and feature from Autohotkey) For example in parameter strings like this:

Code: Select all

1_File=notepad.exe
1_Parameter="C:\directory with some spaces\textfile.txt"
The command executed is:

Code: Select all

notepad.exe C:\directory with some spaces\textfile.txt
and not:

Code: Select all

notepad.exe "C:\directory with some spaces\textfile.txt"
So my self written function used in this script is just a workaround.
I see. This issue can be entirely resolved in the ini file, so you could use the AHK IniRead, it isn't buggy. Microsoft defines an ini file entry as

Code: Select all

name="contents"
where the Windows readINI API - which I think AHK calls - strips the quotes. So if you need to surround a string with quotes, you have to double the quotes

Code: Select all

name=""contents""
More precisely, you're not doubling the quotes, you are just applying the correct syntax, which requires contents to be quoted. The Windows API dequotes only when it finds quotes as the first and last characters in the string. So if you write

Code: Select all

name=no "quotes"
Windows API will set name to no "quotes" just as if you'd written

Code: Select all

name="no "quotes""
Confusing, I know, but consistent once you know the rules.

User avatar
Samuel
Power Member
Power Member
Posts: 1856
Joined: 2003-08-29, 15:44 UTC
Location: Brandenburg, Germany
Contact:

Post by *Samuel » 2009-02-04, 10:45 UTC

sgp wrote:Unfortunately I need them but I have no clue how to implement them. I don't know if the Windows SendMessage interface that your script uses to send command IDs to TC can support string parameters.
I just found a topic, where Christian Ghisler stated that it is not possible to use all "parameter-commands" by external applications like Autohotkey. But a workaround with user commands exists.

Just add user commands for your "parameter-commands".
sgp wrote:More precisely, you're not doubling the quotes, you are just applying the correct syntax, which requires contents to be quoted. The Windows API dequotes only when it finds quotes as the first and last characters in the string.
I knew about this behavior, but for "first time users" its more confusing. So I decided to use the workaround. So I don't use 100% Microsoft compatible ini-files. Microsoft has to deal with it. :D

I don't want to change it. (You may as the code is free.)

sgp
Senior Member
Senior Member
Posts: 355
Joined: 2005-01-31, 16:04 UTC

Post by *sgp » 2009-02-04, 10:54 UTC

I came up with a workaround based on sending keys to the command line. It works for me. For instance, to open %TEMP% in a new tab and show custom column set #6:

Code: Select all

[Button 4 Normal]
; cm_OpenNewTab
1_Command=3001
; cm_ClearCmdLine
2_Command=2004
; change dir to ...
3_SendInput={Right}cd %TEMP%{Enter}
; SrcCustomView6
4_Command=276
The modifications to the script are simple, starting at line 61:

Code: Select all

; ### --------------------------------------------------------------------------
; ### execute commands & files & AHK SendInput

Loop {
 Current_Command := NewIniRead(Section,A_Index . "_Command")
 Current_File    := NewIniRead(Section,A_Index . "_File")
 Current_SendInput     := NewIniRead(Section,A_Index . "_SendInput")
 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!="") {
  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")
  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
		Run,"%Current_File%" %Current_Parameter%,%Current_Path%
 }
 if(Current_SendInput!="") {
  SendInput %Current_SendInput%
 }
}

ExitApp

User avatar
Samuel
Power Member
Power Member
Posts: 1856
Joined: 2003-08-29, 15:44 UTC
Location: Brandenburg, Germany
Contact:

Post by *Samuel » 2009-02-04, 11:22 UTC

Thanks! Good idea.

I extended the program with your lines.
:arrow: See the first post for the new files (ahk and exe).

sgp
Senior Member
Senior Member
Posts: 355
Joined: 2005-01-31, 16:04 UTC

Post by *sgp » 2009-02-04, 12:16 UTC

I'm glad you liked it.
Typo: Button 4 Normal example needs square brackets in first posting.

User avatar
Samuel
Power Member
Power Member
Posts: 1856
Joined: 2003-08-29, 15:44 UTC
Location: Brandenburg, Germany
Contact:

Post by *Samuel » 2009-02-04, 12:34 UTC

Thanks again.
If I have time I could write a gui for the ini-file.

Hopefully TC 7.5, TC 8.0, ... brings internal support for something like this.
Perhaps not only for ctrl, but also for other modifiers like: shift, alt & windowskey.
To differ between left-mouse-clicks, middle-mouse-clicks and right-mouse-clicks would be great too.

User avatar
Horst.Epp
Power Member
Power Member
Posts: 3058
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Post by *Horst.Epp » 2009-02-04, 17:11 UTC

Samuel wrote:Thanks! Good idea.

I extended the program with your lines.
:arrow: See the first post for the new files (ahk and exe).
This new version is bad. It never terminates after running a program and consumes a lot of CPU while running my Editor from a button.
Version 0.1 works just fine with the same definitions.

User avatar
Samuel
Power Member
Power Member
Posts: 1856
Joined: 2003-08-29, 15:44 UTC
Location: Brandenburg, Germany
Contact:

Post by *Samuel » 2009-02-05, 09:29 UTC

Thanks - corrected.
Just one wrong char. :roll:
"!=" != "==" :D

Post Reply