How to make a button or hotkey doing this?

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
Adams
Junior Member
Junior Member
Posts: 21
Joined: 2011-10-10, 23:31 UTC

How to make a button or hotkey doing this?

Post by *Adams »

I pressed Ctrl+F12, then input *dev* to list all files containing ‘dev’ in name.

Then under the menu ‘Show’, there appeared an item ‘*dev*’ listed between ‘Programs Ctrl+F11 ’ and ‘Custom Ctrl+F12’. Choosing this ‘*dev*’ will list all files containing ‘dev’ in name.

Can I, or how can I make a button or hotkey to do the same as choosing this ‘*dev*’ in the Show menu?
User avatar
Vochomurka
Power Member
Power Member
Posts: 816
Joined: 2005-09-14, 22:19 UTC
Location: Russia
Contact:

Post by *Vochomurka »

Use button

Code: Select all

TOTALCMD#BAR#DATA
cd *dev*

%COMMANDER_PATH%\totalcmd.exe,1
cd *dev*


-1
or just type "cd *dev*" in the command line.
Single user license #329241
PowerPro scripts for Total Commander
Adams
Junior Member
Junior Member
Posts: 21
Joined: 2011-10-10, 23:31 UTC

Post by *Adams »

I tried 'cd *dev*' in command line but didn't see anything happen. cd is for changing directory, isn't it?
Adams
Junior Member
Junior Member
Posts: 21
Joined: 2011-10-10, 23:31 UTC

Post by *Adams »

Maybe I didn't say it clearly at the beginning. Here I uploaded a picture. What I want to do is to create a button or a hotkey that can do the same as choosing the “*dev*” in the picture.

Image: http://farm9.staticflickr.com/8309/7896655530_c341fc6d81.jpg
User avatar
Hacker
Moderator
Moderator
Posts: 13144
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

Adams,
Type "cd *dev*" into the Command field of the button you are creating.

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.
User avatar
Vochomurka
Power Member
Power Member
Posts: 816
Joined: 2005-09-14, 22:19 UTC
Location: Russia
Contact:

Post by *Vochomurka »

2Adams
1) Select text I gave as quote in this post;
2) Locate mouse over the free space of a button bar, press pight mouse button and pick "Paste";
3) Press the button just created. That's all.
Single user license #329241
PowerPro scripts for Total Commander
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Post by *Stefan2 »

Adams wrote:I tried 'cd *dev*' in command line but didn't
see anything happen. cd is for changing directory, isn't it?
This doesn't work into command line. (At least not for me)

It will work from an button as described above.

The same 'CD' command can also be written to an user.ini file
and then an shortcut can be assigned.

Once in the user.ini the command can also be added to the main menu.


- - -

As example for this see petermad's "Extended English Menus"


In the "wcmd_win7_2_eng.ini" (an user.ini) you will see e.g.

Code: Select all

[em_ext_show_images_web]
cmd=cd *.gif *.jpg *.jpeg *.jpe *.png *.bmp
menu=Show Image Files (web formats)
button=wcmicons.dll,24

and this command "[em_ext_show_images_web]"
is used in file "wcmd_win7_2_eng.mnu" (an custom main menu)

Code: Select all

POPUP "F&ilter"
  POPUP "Show I&mage Files"
    MENUITEM "&Web Formats", em_ext_show_images_web
to have it in the main menu (if you had chose "wcmd_win7_2_eng.mnu" as menu)


To use this "em_ext_show_images_web" -command via an shortcut
see Configuration... > Misc. > hotkeys > Command: Lupe > Filter: em_ext_s

- - -

You can do this all your own

with an file called i.e. user.ini for the command, e.g. "em_Adams_dev"

Code: Select all

[em_Adams_dev]
cmd=CD *dev*

and then modify the default Language\WCMD_ENG.MNU:

Find

Code: Select all

POPUP "Sho&w"
and add an new line like

Code: Select all

  MENUITEM "&Programs\tCtrl+F11", cm_srcexecs
  MENUITEM "*.*", cm_srcuserspec
  MENUITEM "Adams: DEV", em_Adams_dev
  MENUITEM "&Custom...\tCtrl+F12", cm_srcuserdef

(the shortcuts like "Ctrl+F11" are plain text here only!)

- - -

BTW

the above mentioned button can be modified to e.g.

Command: CD
Parameters: ?*dev*

The '?' will prompt you, so you can modify the filter on the fly.

And an '*' e.g. will list all files again.



HTH?
User avatar
ts4242
Power Member
Power Member
Posts: 2081
Joined: 2004-02-02, 20:08 UTC
Contact:

Post by *ts4242 »

It is simple to create a button for that, Copy the following code, right click on the desired position in the button bar and Paste.

Code: Select all

TOTALCMD#BAR#DATA
cm_SrcUserSpec

wcmicons.dll,24


0
313
Adams
Junior Member
Junior Member
Posts: 21
Joined: 2011-10-10, 23:31 UTC

Post by *Adams »

ts4242 wrote:It is simple to create a button for that, Copy the following code, right click on the desired position in the button bar and Paste.

Code: Select all

TOTALCMD#BAR#DATA
cm_SrcUserSpec

wcmicons.dll,24


0
313
Thanks! I tried this. When the button defined this way, its function can change. It always functions the same as that defined in the previous Ctrl+F12.
Adams
Junior Member
Junior Member
Posts: 21
Joined: 2011-10-10, 23:31 UTC

Post by *Adams »

"cd *dev*" works. But I just don't understand why.

Is CD a TotalCmd command? What does it do?

To my knowledge it's a DOS command to change directory.
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Post by *Stefan2 »

Adams wrote:"cd *dev*" works. But I just don't understand why.
To my knowledge it's a DOS command to change directory.
That's right, 'CD' is also the name of an DOS command.
Is CD a TotalCmd command?
Here, Yes.
What does it do?
First It does the same as the DOS command.
But since this is an TC command, the author can let it do what he want.
So if after 'CD' an expected string is found the app can react in several ways.



.
Adams
Junior Member
Junior Member
Posts: 21
Joined: 2011-10-10, 23:31 UTC

Post by *Adams »

Thank you all for the reply.

Any further explanation on the meaning and usage of the command cd? I still don't understand why “cd *dev*” can do that.
User avatar
Vochomurka
Power Member
Power Member
Posts: 816
Joined: 2005-09-14, 22:19 UTC
Location: Russia
Contact:

Post by *Vochomurka »

TC manual wrote:...The "cd" command is handled internally to change the current directory in the active panel. If you give the name of a file, TC will place the cursor on that file...

...You can make a button to change directories, by specifying cd directory name as the command. You can even choose which files to show, e.g. using the command cd directory\*.txt.
With parameter "/user:" (all lowercase!) you can specify the user to use for the connection to the remote share. If no user name is given, you will be asked to enter a user name and password.
Example: cd \\server\share /user:username
4. You can also open an ftp connection, using either cd ftp://ftp.servername.com
or: ftpopen session_name, where session_name is the name configured in the FTP connect dialog box...

...You can also start a port connection using a command in the button bar, start menu, or Ctrl+D menu (client only):
The command would be
cd port://lpt1/c:/subdir1/subdir2...
Single user license #329241
PowerPro scripts for Total Commander
Post Reply