Welcome!

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

SignUp Now!

TCEDIT, two files side by side

May
13,000
174
Maybe I'm the last to know but earlier I wanted to edit two files side by side. And voila! ...

1711842553125.png
 
Vince, your post got me to look at the TCEDIT editor (I generally use the VEDIT macro editor). I was disappointed to see that, while TCEDIT recognizes directory aliases on the command line, it does not recognize them with the file open menu or tool icon. For example, I keep my batch files in a directory named "bat:" or "btm:". Being able to open files in the editor using "bat:mybat.btm" might have made me think of using TCEDIT.

With many non-TCC commands I make them recognize directory aliases on the command line by writing batch files to invoke them with %@full[] around the file arguments. So my EDIT command invokes VEDIT with directory aliases expanded.
 
I have created .ahk files to do this.

For example, I have a file called docs.ahk;
Code:
:*:docs::e:\documents

Now, when I open a file, be it in TCEdit, UltraEdit, etc.,
I just have to type docs and it is replaced with e:\documents

If I am at the tcc prompt, I type docs, and it is replaced with e:\documents

In AutoHotKey, this is known as a HotString.

Joe
 
Joe, could you be a little more specific. I am not familiar with this facility at all.

You say that you have a file named docs.ahk. Where is that file? You showed some code. Is that the contents (text) of the file? Is it just that line with no CR or LF? How do programs know how to find that file, and why would they even look? Or is it something that Windows looks for and loads at startup?
 
Joe, could you be a little more specific. I am not familiar with this facility at all.

I'd like to know the AHK syntax, what it does, and how you use it. I use AHK too but only to start programs via key combinations.
 
Hotstrings in AutoHotkey (AHK) let you define a string of characters that can be replaced by other text.

In this example,
use your text editor to create a file called HotStrings.ahk

I put my .ahk files in my E:\Utils folder.

In the file HotStrings.ahk, add the following;
Code:
:*:docs::e:\documents
:*:utils::e:\utils

I have AutoHotKey installed at C:\Program Files\AutoHotkey\v2\autohotkey64.exe

By default,
AutoHotKey installs so that you can run an .ahk file by name.

In this case,
at the TCC prompt,
run the HotStrings.ahk file.

In your system tray,
you will find the AutoHotKey menu.

1712147108017.png


Right-clicking on the AutoHotKey menu,
you can Edit/Reload/Suspend/Pause/Exit the script.

From any windows program,
whenever you type docs,
the text will be replaced with e:\documents

From any windows program,
whenever you type utils,
the text will be replaced with e:\utils

If docs or utils is a word that you type often,
the expanded text may cause issues.

In that case,
you could precede the text with a character that is seldom used.

For example;
Code:
:*:.docs::e:\documents
:*:.utils::e:\utils

With these hotstrings, you would have to type;
.docs to have it replaced with e:\documents
.utils
to have it replaced with e:\utils

Another example;
Code:
:*:]docs::e:\documents
:*:]utils::e:\utils

With these hotstrings, you would have to type;
]docs to have it replaced with e:\documents
]utils
to have it replaced with e:\utils

Ref: Hotstrings - Definition & Usage | AutoHotkey v2 for more info on HotStrings.

Note that these are simple HotStrings.

HotStrings can also be User-Defined Functions.

In another post,
I will provide examples of UDFs used as HotStrings.

Joe
 
Here's how to make UDFs into HotStrings;

In my HotStrings.ahk, I make the following changes;
Code:
#Requires AutoHotkey v2

:*:docs::
{
  send "e:\documents"
}

:*:utils::
{
  send "e:\utils"
}

:*:thedate::
{
  Send FormatTime(, "dddd, MMMM d, yyyy") 
}

The docs and utils hotstrings are the same as before,
except they are now functions.

I've also added a hotstring to return the current date.

Today, when I type thedate,
it returns Wednesday, April 3, 2024

Again, you can change your abbreviations to whatever you want.

For example, thedate could be dodate, or .d, etc.

Joe
 
From any windows program,
whenever you type docs,
the text will be replaced with e:\documents

From any windows program,
whenever you type utils,
the text will be replaced with e:\utils

If docs or utils is a word that you type often,
the expanded text may cause issues.
That seems a bit intrusive on the part of AHK! I won't be using it.

Some might be interested in how I use AHK.

Ctrl-Alt-j takes me to this forum
Ctrl-Alt-e opens Outlook's new message composer (without opening Outlook)
Ctrl-Alt-p takes me to the Times (of London) crossword page
Ctrl-Alt-y ... the New York Times puzzles page

There are several more that take me to web pages.

Ctrl-Alt-<N> (N=1, 2, ...) open various versions of TCC

The Outlook one is not obvious but it's simple.

Code:
!^e::
Run "C:\Program Files\Microsoft Office\Root\Office16\OUTLOOK.EXE" /c ipm.note
return
 
Back
Top