Button for Shift+F4 (cm_EditNewFile) but for TC 7.55

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
barzel
New Member
New Member
Posts: 1
Joined: 2021-05-03, 09:36 UTC

Button for Shift+F4 (cm_EditNewFile) but for TC 7.55

Post by *barzel »

I have 7.55 version of total commander.
There is hotkey shift+F4. I want to add button which will do the same command.
In this version of TC there is no cm_EditNewFile, only cm_Edit. And if I add button with cm_edit, I forced to push shift in order to do this command.
Is some option to add button which will do this operation with one click?
User avatar
Stefan2
Power Member
Power Member
Posts: 4133
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Button for shift+f4 tc 7.55

Post by *Stefan2 »

Update for free to 9.51 or 10.0 ( viewforum.php?f=3 )

Or create your own command like below.






1.) Write a script, like this "CreateNewTextFile.vbs"

"totalcmd-folder\CreateNewTextFile.vbs"

Code: Select all

'On Error Resume Next
SET ARGs = WScript.Arguments
' If args.Count = 0 Then WScript.Quit

strPara = "New Text file.txt"
IF args.count > 0 Then strPara = args(0)

N = Now
D = Year(N) & "-" & Right("00" & Month(N), 2) & "-" & Right("00" & Day(N), 2)
T = Right("00" & Hour(N), 2) & Right("00" & Minute(N), 2) & Right("00" & Second(N), 2)
strTimestamp = D & " " & T


'TRICK: use "?" sign in new file name to open the text file after creation:
strNewFileName = strTimestamp & "_" & strPara & "?"

NewFileName = InputBox("Enter file name to create new:","Total Commander",strNewFileName)


If NewFileName="" Then 
	WScript.Quit
Else
	' TRICK: use "?" sign in new file name to open the text file after creation:
	IF (InStr(NewFileName,"?")) Then
		bOpenTextFileAfterwards = TRUE
		NewFileName = Replace(NewFileName,"?","")
	End If
	CreateObject("Scripting.FileSystemObject").CreateTextFile(NewFileName)	
End If

IF (bOpenTextFileAfterwards) Then
	SET WSO = WScript.CreateObject("WScript.Shell")
	TCPath = WSO.ExpandEnvironmentStrings("%Commander_Path%")
	' WSO.Run strCommand [,intWindowStyle 0=Hide 1=Activate 2=minimize 3=maximize ...] [,bWaitTillFinish? True/defaultFalse]
	' WSO.run TCPath & "\TOOLs\NotePad2\notepad2.exe " & NewFileName
	WSO.run "notepad.exe " & NewFileName
	SET WSO = Nothing
End IF '(bOpenTextFileAfterwards)




2.) Create a user defined command in usercmd.ini
[em_F4_VBS] ;NewFile like Shift+F4 cm_EditNewFile
cmd="CreateNewTextFile.vbs"
Param="%O.%E"


3.) Assign a keyboard shortcut in wincmd.ini
[Shortcuts]
;Ctrl+Shift+F4
CS+F4=em_F4_VBS
;Shift+F4 (overwrite build-in command)
S+F4=em_F4_VBS




- - -



barzel wrote: 2021-05-03, 09:42 UTC I have 7.55 version of total commander.
There is hotkey shift+F4. I want to add button which will do the same command.
08.06.16 Release Total Commander 9.0 beta 1 (32/64)
26.04.16 Added: New internal commands:
cm_EditNewFile (ask for name, create new text file, open in editor),
cm_EditExistingFile (open file under cursor in editor) (32/64)

17.06.10 Release Total Commander 7.55 final


 
Post Reply