Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

TCEdit /TAB to open file in an already open TCEdit

Aug
2,294
111
I've started TCEdit from the command line,
with a file.

There is presently no way to open,
from the command line,
a second file in an already open TCEdit.

I would like to suggest that a /TAB command line option be added to TCEdit,
so that from the command line,
a second file can be opened in a new tab,
of an already open TCEdit.

Example;
TCEdit /tab SecondFile.txt

Joe
 
Here's my .BTM that I am presently using to accomplish opening a file in an already open TCEdit from the command line;
Code:
@setlocal
@echo off
set theFile=%@truename[%1]
echo %theFile > clip:
iff isapp TCEdit.exe then
  activate TCEdit*
  keystack Ctrl-O
  delay 1
  keystack Ctrl-V
  delay 1
  keystack Enter
else
  start tcedit.exe %theFile
endif
endlocal

Joe
 
Neat! I already have

Code:
v:\> alias e
call u:\tpad.btm

I'm going to try to build that into tpad.btm.

You know, you can (untested)...

Code:
keystack Ctrl-O /w18 Ctrl-V /w18 Enter

Note on textpad: I bought it about 20 years ago and put a lot of work into syntax coloring for BTMs. I just upgraded ($13) last week for the first time. Now I have a nice dark theme.
 
If there is more than one instance of TCEdit running,
choose which TCEdit in which to open the file;

Code:
@setlocal
@echo off
set theFile="%@truename[%1]"
iff not exist %theFile then
  echo %theFile Not Found
  echo End of Job
  quit
endiff

echo %theFile > clip:

iff %@words[%@pid[tcedit.exe,+]] gt 1 then
  :: I use the Tasks plugin,
  :: https://charlesdye.net/dl/tasks.zip,
  :: which has it's own TASKLIST command
  :: Tested with both versions.
  TASKLIST /Nf tcedit* > tmp9:
  OPTION //ConsolePopupWindows=Yes
  set thePID=%@select[tmp9:,10,10,20,60,Select TCEdit]
  OPTION //ConsolePopupWindows=No
  set thePID=%@word[0,%thePID]
  iff not defined thePID then
    echo No selection made.
    echo End of Job.
    quit
  else
    activate =%thePID
  endiff
endiff

iff isapp TCEdit.exe then
  activate TCEdit*
  keystack Ctrl-O
  delay 1
  keystack Ctrl-V
  delay 1
  keystack Enter
else
  start tcedit.exe %theFile
endiff
endlocal

Joe

Edit 11:55am - Minor changes to code.
 
Last edited:
I also use UltraEdit, which opens each file in a separate tab by default.

If I have an existing UltraEdit active,
but I want to open a file in a new instance of UltraEdit,
I can do the following;
Code:
uedit64.exe /fni tctab.btm

/fni = Force New Instance

Should TCEdit.exe open a file in a new tab by default,
with a switch to open a file in a new instance of TCEdit.exe,
or should my original idea stand?

Joe
 
Should TCEdit.exe open a file in a new tab by default,
with a switch to open a file in a new instance of TCEdit.exe,
or should my original idea stand?

A new tab in existing instance would be my preference. Does TCEdit have a single-instance option? If it does, I'd choose it. Scintilla is quite robust. I'd guess this stuff is possible.

I put this in my tpad.btm. It's crude (and unsightly) but effective. If need be I'll tweak it later.

Code:
iff %@isapp[TextPad] GT 0 then
    echo %1 > clip:
    activate "textpad*"
    keystack Alt-F /w5 O /w5 Ctrl-V /w5 Enter
    quit
endiff

Code:
v:\> which @isapp
@isapp is a plugin variable (4UTILS)

v:\> help @isapp

@ISAPP[appname[.exe]] = count of appname processes
 
I vote for 1st: TCEDIT should open a fiile in new tab by default - switch to open in new instance.

However: I could live with your original idea too.
 
I don't even know if this is appropriate but if TCEdit is based on Scintilla/Scite this might be possible.

Code:
in the SciTEGlobal.properties file to
check.if.already.open=1

And if so, I wonder if there's a runtime config file that Rex could expose to us.
 
Joe, I note that you use ACTIVATE and TASKLIST without putting quotation marks around the window title. While that seems to work, at least in some cases, the documentation specifically says: Title must be enclosed in quotes.

I have now written a complete version for use with the VEDIT text editor. I often have more than one copy running, so your additional code enabling one to select the copy to open the new file in was very helpful. (I did change the structure slightly to avoid the double activation when only one instance is running.)
 
Back
Top