NoClose Replacer.

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

Moderators: white, Hacker, petermad, Stefan2

User avatar
Flint
Power Member
Power Member
Posts: 3487
Joined: 2003-10-27, 09:25 UTC
Location: Antalya, Turkey
Contact:

NoClose Replacer.

Post by *Flint »

This is what many users always dreamed of: using cmd.exe instead of command.com when starting applications with Shift+Enter! :)

Starting from TC 8.0 and NoClose Replacer 1.3, command.com is no longer a problem, but the Replacer still can be used for gaining extended control over Shift+Enter functionality.

Download version 1.3 (27.09.2011):
x32+x64 / mirror (72 Kb)
ANSI-version / mirror (for Win9x)
Source code (C++) / mirror (19 Kb)
Last edited by Flint on 2011-09-26, 21:51 UTC, edited 1 time in total.
Flint's Homepage: Full TC Russification Package, VirtualDisk, NTFS Links, NoClose Replacer, and other stuff!
 
Using TC 10.52 / Win10 x64
icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

Post by *icfu »

May I kiss your feet? :D
Thank you, thank you, thank you!

Feature proposal:
It would be fantastic if one could use additional modifier keys after pressing Shift-Enter, is that possible?

For example holding down Ctrl directly after triggering Shift + Enter would start an alternative command processor or just cmd.exe /c instead of cmd.exe /k. It would be necessary to implement a short waiting period in which the additional modifiers could be pressed.

What do you think about that?

Icfu
This account is for sale
icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

Post by *icfu »

Ok, this is what can be done now using this wonderful thing, automatically redirecting output to Notepad for example without entering that long parameter manually each time:

Code: Select all

CommandProcessor=cmd.exe /c "%1" >%temp%\temp.txt&&start notepad %temp%\temp.txt
Isn't that great? This is nearly as good as command line output in xplorer2 file manager. :mrgreen:

I hope you will make it possible to specify more than one command processor definition, it would make NoClose Replacer an incredibly powerful tool with possibilities one could only dream of till now.

Anyway, even without it it's already a must-have, for sure! :)

Icfu
This account is for sale
User avatar
Flint
Power Member
Power Member
Posts: 3487
Joined: 2003-10-27, 09:25 UTC
Location: Antalya, Turkey
Contact:

Post by *Flint »

icfu
I'm not sure if this is a good idea to wait some time for user to press key modifier... The delay should be about 0,5-1 second, and I don't want to wait for this delay every time I start some program (it is impossible to begin executing it before we know which command processor to use). Of course, the delay can be customizable, but there is also another problem: at present the program does not have any window, so I cannot receive a message about pressing some keys. And I'm not sure if a hidden window will be able to. So, I can see only two variants:
1. Make user to press the key until the delay is finished, so after Sleep function I can check for keyboard modifiers status. But this is inconvenient. Much more convenient to simply press and release the key and not to think about it then.
2. To use additional parameters like noclose.pif /cmd1 <parameters> and add this command line into the Start menu and assign for this command any hotkey you want.
The second approach looks better for me.
icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

Post by *icfu »

I am not sure if I understand point 2) correctly. You mean it like that?
1. Press Shift-Enter like usual, TC transfers command line to NoClose.pif
2. After that NoClose.pif waits till a hotkey is pressed to decide which command processor to load from NoClose.ini

If yes, this sounds good, probably better than my proposal. The only downside of this is that using the start menu either limits you to inconvenient hotkey combinations like the default Ctrl-Alt-(Shift)-F1-12 or if you prefer remapped hotkeys ( I would probably use something like Shift+number) there is the same old problem that start menu entries mustn't be changed their position afterwards because the hotkeys are bound to cm_userMenuX.

Anyway, using the startmenu gives more possible triggers so probably it's best to implement it like that.

I hope that I have understood it correctly... :)

Icfu
This account is for sale
User avatar
Flint
Power Member
Power Member
Posts: 3487
Joined: 2003-10-27, 09:25 UTC
Location: Antalya, Turkey
Contact:

Post by *Flint »

icfu
I am not sure if I understand point 2) correctly. You mean it like that?
1. Press Shift-Enter like usual, TC transfers command line to NoClose.pif
2. After that NoClose.pif waits till a hotkey is pressed to decide which command processor to load from NoClose.ini
Isn't it the same to what you suggested before? :?
As I told in my previous post, this approach is very inconvenient both for programming and for using.

Now, what I mean in my variant 2:
At present my program allows only /C parameter, because it is passed from TC when someone presses Shift+Enter, and this TC's behaviour cannot be changed.
But one can start the program noclose.pif manually with some other command-line switches. And it is possible (and quite simple) to implement starting some other command processor if the parameter not /C, but for example, /cmd1. In this case one should run noclose.pif from some other place, for example, from the Start menu. That is create a Start menu item like noclose.pif /cmd1 %P%N and assign some hotkey on this item, so using this new hotkey will start the program with the other command processor.

Of course, there are some inconveniences in assigning hotkeys for Start menu items (you mentioned them), but this is unavoidable. Do you change the order of Start menu items frequently? If yes, then one additional item means nothing. If no, them what's the problem? :D
icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

Post by *icfu »

Isn't it the same to what you suggested before?
As I told in my previous post, this approach is very inconvenient both for programming and for using.
To me it's not, first solution means keeping a modifier pressed, second solution means pressing a hotkey once and I hoped you would have meant it like that, sorry... Maybe it's inconvenient to program but it will multiply the power of NoClose.pif and for me the only inconvenience is that a little waiting period is needed. What is a second of waiting when you got so much advantages?
But one can start the program noclose.pif manually with some other command-line switches. And it is possible (and quite simple) to implement starting some other command processor if the parameter not /C, but for example, /cmd1. In this case one should run noclose.pif from some other place, for example, from the Start menu. That is create a Start menu item like noclose.pif /cmd1 %P%N and assign some hotkey on this item, so using this new hotkey will start the program with the other command processor.
I really was afraid that you meant it exactly like that, too bad. I don't see any use for that because

1) I don't need NoClose.pif when I want to start *whatever* shell with fixed parameters. I would simply make a start menu entry like that:

Code: Select all

command: shell.exe /whateverparameter (this string equals /cmd1)
parameter: "fixed command like dir, ipconfig /all, etc..." <parameters>
/cmd1 would mean less typing, sure, so at least it can be useful, but what does %P%N do? Do you want users to mark the command to be executed?

2) Your proposal has nothing to do with the TC command box and pressing Shift-Enter anymore. I use command box because the commands I enter there always change so I need an application that will read the content out of that box, insert the shell before and additional parameters last and that's why I was so excited about your app. With using start menu entries I would need to use ? in parameter line be able to modify the command I want to execute.
Of course, there are some inconveniences in assigning hotkeys for Start menu items (you mentioned them), but this is unavoidable.
With AutoIt this is completely avoidable because I can create a script which reads the TC command box (or the TAR box) and passes it to a shell when pressing a hotkey, no problem.

That's why for me NoClose.pif should concentrate on extending the use of the TC command box and Shift-Enter plus additinal triggers, either pressed hotkeys that are executed once or modifiers that need to be held down until NoClose.pif takes over.
Do you change the order of Start menu items frequently?
I do because I prefer alphabetically sorting. And because the start menu is not a modern implementation I am forced to use the mouse in most of the cases to execute. I use only a few hotkeys there, the rest I do with buttons or the application TypeAndRun.
If yes, then one additional item means nothing.
How can one entry be sufficient if the command to be executed always changes? I really don't understand the use of that %P%N parameter, sorry. %P%N means that I have to mark a file (the program to start) so I would have to go search it first on my hd and it would make using commands like "dir" impossible because it's inside the shell.

So, because I don't think that you really think that complicated I probably have got you wrong again... ;)

Icfu
This account is for sale
icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

Post by *icfu »

Maybe you mean it like that?

Code: Select all

command: NoClose.pif /cmdX (X=number of entry in NoClose.ini)
parameter: ?%P%N
Is this correct? If yes you should implement it, it will be nice for many other people for sure but I will concentrate on AutoIt then. No problem, tastes are different.

Maybe someone else can tell his point of view, I think that many people will love Noclose.pif, I can't be the only one. :)

Icfu
This account is for sale
User avatar
Flint
Power Member
Power Member
Posts: 3487
Joined: 2003-10-27, 09:25 UTC
Location: Antalya, Turkey
Contact:

Post by *Flint »

icfu
Ok, now I understand your arguments. I didn't thought about command line (it is called in this manner more often than "command box")...
To me it's not, first solution means keeping a modifier pressed, second solution means pressing a hotkey once and I hoped you would have meant it like that, sorry...
I see. Unfortunately, at present only the first solution can be implemented...
... and for me the only inconvenience is that a little waiting period is needed. What is a second of waiting when you got so much advantages?
As for me, waiting for one second every time I start some program is very annoying and make the program absolutely impossible to use. But tastes differ, so I will add this feature into my wish-list (of course, the delay value will be customizable so that I for myself could set the delay to zero. ;) :D

BTW, tell me please, what is better to make the default delay value and also which keys the program should recognize? What do you think the best way to write keys in the INI-file? (note, that it is theoretically possible to distinguish left and right key modifiers).

Added:
I wrote all the above before you posted the second message...
What about Start menu item - yes, I meant that. But you are right, there is absolutely no need in such an item, because one can write there the command itself without noclose.pif. :)
icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

Post by *icfu »

I see. Unfortunately, at present only the first solution can be implemented...
Why unfortunately? This is my original proposal then and I would love it. :)
As for me, waiting for one second every time I start some program is very annoying and make the program absolutely impossible to use. But tastes differ, so I will add this feature into my wish-list (of course, the delay value will be customizable so that I for myself could set the delay to zero.
Simple and elegant solution. :)
BTW, tell me please, what is better to make the default delay value
Set default delay value to zero to prevent annoyances for people not needing modifiers, quite simple.
and also which keys the program should recognize?
Usually I would say "the more the better" but let's try it logical:
Fingers are already sitting on Shift and Return so the four basic modifiers Ctrl, Alt, Shift, Windows (leave the task to disable the Windows key to the users) are definetely a must. Decisions between left or right modifiers are not needed because of the more complicated ini file then, so let's keep it simple here.

With these basic modifiers and combinations of them we already have 16 command lines available.

Added to that I would like to use the numbers 1-2-3-4-5-6-7-8-9-0 in combination with the basic four modifiers because they can be reached easily and perfectly fit in the inifile without any collisions.

Reaching distance for ESC, Scoll Lock and Pause is too long I think so they are not really convenient, at least not for me.
What do you think the best way to write keys in the INI-file? (note, that it is theoretically possible to distinguish left and right key modifiers).
As I use TAR I like to keep it clean and simple.
C for Ctrl
A for Alt
S for Shift
W for Windows
1 for 1

So, for a combination of Ctrl-Alt+3 it should look like that:
CA3=cmd.exe /c "%1" >%temp%\temp.txt&&start notepad %temp%\temp.txt

I hope you like that, thanks for your interest. :)

Icfu
This account is for sale
User avatar
Flint
Power Member
Power Member
Posts: 3487
Joined: 2003-10-27, 09:25 UTC
Location: Antalya, Turkey
Contact:

Post by *Flint »

icfu
Why unfortunately?
Because the second approach is more convenient. :)
Set default delay value to zero to prevent annoyances for people not needing modifiers, quite simple.
...
Fingers are already sitting on Shift and Return so the four basic modifiers Ctrl, Alt, Shift, Windows (leave the task to disable the Windows key to the users) are definetely a must.
...
Added to that I would like to use the numbers 1-2-3-4-5-6-7-8-9-0 in combination with the basic four modifiers
Ok, sounds good, except the Windows key. This key is too specialized and system-wide, and I'm not sure if this is a good idea to use this key for some other purpose. And also I'm not sure if I will be able to disable its default behaviour (calling Windows Start menu). Maybe, it's better to use ContextMenu key instead? (It is located between the RWin and RCtrl keys). I'm also not sure that I can use it, but it promises to be a little bit simplier. It can be written as M letter in INI file (from ContextMenu).
icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

Post by *icfu »

Ok, sounds good, except the Windows key. This key is too specialized and system-wide, and I'm not sure if this is a good idea to use this key for some other purpose. And also I'm not sure if I will be able to disable its default behaviour (calling Windows Start menu).
Like I said:
[...]leave the task to disable the Windows key to the users[...]
You don't need any tricks here, there is a registry key which Explorer shell users can set if they want to set the Windows key free for assignments:

Code: Select all

REGEDIT4

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer]
"NoWinKeys"=dword:00000001
After that only Windows-L and Windows-U are still bound, the rest is free for assignments.

When running other Shells than Explorer like LiteStep for example the Windows key is completely free for reassignmets anyway. This key is not some kind of a must for Windows users, it's just a modifier.
Maybe, it's better to use ContextMenu key instead?
As an additional one, why not, but I have not heard of anyone using the contextmenu key as a modifier. Anyway, it's nice to have a fifth basic modifier but please don't ban the Windows key for that. ;)

Icfu
This account is for sale
icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

Post by *icfu »

This is the code for the above example using AutoIt3 automation using hotkeys instead of pressed down modifiers:

Code: Select all

AutoItSetOption("WinTitleMatchMode", 4) 

; which hotkeys are used 
HotKeySet ( "+1" , "cmd1" ) 
HotKeySet ( "+2" , "cmd2" ) 

; what to insert first and at the end 
Func cmd1() 
$InsertBefore1 = @ComSpec & " /c " 
$BoxContent    = ControlGetText( "classname=TTOTAL_CMD", "", "Edit1" ) 
$InsertAfter1  = ">%temp%\temp.txt&&start notepad %temp%\temp.txt" 
Run ($InsertBefore1 & $BoxContent & $InsertAfter1 ) 
EndFunc 

Func cmd2() 
;$InsertBefore2 = [insert here] 
;$BoxContent    = ControlGetText( "classname=TTOTAL_CMD", "", "Edit1" ) 
;$InsertAfter2  = [insert here] 
;Run ($InsertBefore2 & $BoxContent & $InsertAfter2 ) 
EndFunc

; wait for the trigger 
sleep(2147483647)
Shift+1 is used here as a hotkey to pass the content of TC command box to the shell.

Icfu
Last edited by icfu on 2005-03-21, 00:36 UTC, edited 1 time in total.
This account is for sale
User avatar
Flint
Power Member
Power Member
Posts: 3487
Joined: 2003-10-27, 09:25 UTC
Location: Antalya, Turkey
Contact:

Post by *Flint »

icfu
[...]leave the task to disable the Windows key to the users[...]
Ok, I'll try... But this will take much time for numerous experiments, so don't wait for the quick update. :) And of course, I cannot promise anything, because I didn't work with Windows key in my programs before. Maybe, it will be easy, maybe - extremly hard...
After that only Windows-L and Windows-U are still bound, the rest is free for assignments.
Hmm... Really? And what about Win+R, Win+E, Win+D, Win+M, Win+F1 and so on? Do they become disabled after that registry key is set?
... but I have not heard of anyone using the contextmenu key as a modifier.
Ultra TC Hotkey Editor by Taher Salem can use ContextMenu key instead of Alt. ;)
Flint's Homepage: Full TC Russification Package, VirtualDisk, NTFS Links, NoClose Replacer, and other stuff!
 
Using TC 10.52 / Win10 x64
icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

Post by *icfu »

Ok, I'll try... But this will take much time for numerous experiments, so don't wait for the quick update. And of course, I cannot promise anything, because I didn't work with Windows key in my programs before. Maybe, it will be easy, maybe - extremly hard...
Check this thread, Lefteous has mentioned a link to MSDN on page 2:
http://www.ghisler.ch/board/viewtopic.php?t=6621
Thread starts to get interesting with a trigger posting here:
http://www.ghisler.ch/board/viewtopic.php?t=6621#52503

Of course, I am not in a hurry. :)
Hmm... Really? And what about Win+R, Win+E, Win+D, Win+M, Win+F1 and so on? Do they become disabled after that registry key is set?
Like I said, the only hotkeys that the registry entry doesn't set free is Win+L (for lock workstation) and Win+U (for the stuff for disabled people). All others can be used freely then. See the above thread, much info there.
Ultra TC Hotkey Editor by Taher Salem can use ContextMenu key instead of Alt.
Indeed, but it's very uncommon in contrary to the Windows key. ;)

Icfu
This account is for sale
Post Reply