TSE: 4nt: Alias

6 views
Skip to first unread message

knud van eeden

unread,
Dec 13, 2009, 12:43:34 PM12/13/09
to TSEPro Support, TSEPro Support
Hi,

Is anybody using his 4DOS/4NT aliases in his TSE macros?

Thanks

with friendly greetings,
Knud van Eeden



Howard Kapustein

unread,
Dec 13, 2009, 3:21:47 PM12/13/09
to sem...@googlegroups.com
I've used 4DOS/4OS2/4NT for years. Running into some compat problems? I've noticed a few problems over the years.

knud van eeden

unread,
Dec 13, 2009, 3:49:47 PM12/13/09
to sem...@googlegroups.com
No problems, only much help of using ALIAS variables from TSE.
So wanted to know if anybody was using this method.
 
What do you think of the idea of using your 4NT ALIAS variables from TSE?
 
Typical steps.
 
1. You have defined some 4nt alias
e.g.
 
alias foo = iexplore
 
Thus if you type
 
foo
 
on the command line, it will start your browser.
 
What if you could use the power of all your already defined 4NT Aliases also from TSE?
So you do the same from TSE.
You run 'foo' from TSE to start your browser.
The idea is that you run 4nt, let it load your current defined aliases from you alias file, then run your command, then return to TSE
 
Create e.g. this macro
 
PROC Main()
 
LDos(  "4nt.exe", Format( "alias /r", " ", "youraliasfilename", " ", "&&", " ", "foo", " ", "&& exit && exit" ), _DONT_PROMPT_ )
 
END
 
(This LDos() line has to be all in *one* line, and you will have to adapt path to 4nt.exe, your alias filename and possibly the alias command)
 
I use this method a lot, it is great, because one can use his already existing 4nt aliases to control what is behind the command (e.g. changed path of filename, e.g. job versus work, you can change it all outside of TSE, so not having to recompile any procedures or functions inside macros in TSE using it).
Of course you can combine the method with already existing .ini files. It is an AND AND situation.
 
The method is thus a special case of 'indirection' (which is a very powerful principle used inside computer science)
 
What do you think?
 
PS
How many aliases are you using by the way?
Do you use them (very) frequently?
And is the total amount of aliases constantly (fast) growing?
How do you manage them? TSE?
 
Thanks,
 
with friendly greetings,
Knud van Eeden
 
 
 
 
 

 


From: Howard Kapustein <howard.k...@gmail.com>
To: sem...@googlegroups.com
Sent: Sun, December 13, 2009 9:21:47 PM
Subject: Re: [TSE] TSE: 4nt: Alias

Why Tea

unread,
Dec 13, 2009, 7:45:04 PM12/13/09
to SemWare
I have never used 4dos or 4nt. But from an OS point of view, after an
interpretive shell (4nt in this case) has been spawned, the "parent"
really has no access or knowledge to any of its environment variables.
If I understood you correctly, what you want to do is not possible.

In the Unix world, if you spawn xterm, say from an editor macro, you
can use the "-e" switch to instruct xterm to execute another command
or alias. That's about all you can do. Once the shell is running, the
parent will have no control over it.
> From: Howard Kapustein <howard.kapust...@gmail.com>
> To: sem...@googlegroups.com
> Sent: Sun, December 13, 2009 9:21:47 PM
> Subject: Re: [TSE] TSE: 4nt: Alias
>
> I've used 4DOS/4OS2/4NT for years. Running into some compat problems? I've noticed a few problems over the years.
>

knud van eeden

unread,
Dec 13, 2009, 8:41:00 PM12/13/09
to sem...@googlegroups.com
4nt is really great.
If I do not have 4nt installed (on USB), I can not really work quick at that moment or day anymore.
It is power MSDOS, with a lot of features implemented from the Unix (command line world). Thus e.g. also aliases.
4nt is one of the tools 'you can not live without' (almost ;-) ).

Sure, it works. It is what I use preferably to run external programs.
You do not need control over the outside world spawn.
The 'trick' is that you before you call 4nt.exe, you must have stored all your aliases (e.g. also foo) in a file.
E.g. myalias.txt
And you call 4nt.exe using the command line switch /r which means 'r'ead that aliases from that file.
Thus 4nt.exe /r myalias.txt
Thus 4nt.exe reads by design *first* that myalias file,
then using && is similar to doing a return on the command line.
Thus as next step it executes your single alias which you also passed as a parameter (e.g. 'foo').
It will then search for foo in the defined aliases in that file which you passed.
And execute the corresponding commands of foo.

I have between 3000 and 4000 aliases defined in that alias text file, put in ASCII text tables, and edited (e.g. create new alias, replace alias file automatically via TSE macros). And can control using this aliases from the command line a lot of (Windows) (system) programs instead of clicking with the mouse (e.g. 'Start' > 'Settings' > 'Control panel' > 'System' > 'Environment variables' is replaced by one command 'en*vironmentvariables'. Thus I only have to type 'en' on the command line to have the same effect) using that aliases.

Of course one uses also (one big) configuration .ini tex file(s). But according to the DRY principle (do not repeat yourself), one should only change the information in one place. So combining the two configuration possibilities, splitting it in an alias part and independent .ini file part. The content of the configuration files (alias and .ini) varies depending on my geographic location (e.g. job versus elsewhere), adapted to the e.g. specific file paths which you use (e.g. c:\windows\system32\notepad.exe on one machine, c:\winnt\system32\notepad.exe on another machine. But on the command line I only type 'no'. Similar for the TSE executable, I only type the alias 't' on the command line, it will check the currently active alias file for where to look. So only having to remember one constant command, independent of the geographic location where you are.

It is such a smooth and simple system (using this aliases), that I wanted to share this idea (for those interested of course).

Why Tea

unread,
Dec 13, 2009, 9:16:36 PM12/13/09
to SemWare
What you have explained is essentially the same example I posted
earlier. For your default shell in Unix, you have your own .profile
or .cshrc or something else where you store you customized data such
as aliases. You can in fact launch anything with this alias when you
spawn a shell. The same with cmd (and 4nt I suppose). The main point
is, after that, the parent process will have no access to those
aliases - that's the point I was trying to make. I thought that was
your original question too.

Howard Kapustein

unread,
Dec 23, 2009, 5:21:04 PM12/23/09
to sem...@googlegroups.com
Yeah, pretty much. 4DOS/4OS2/4NT/TakeCommand (name's evolved over the years, i.e. CMD.exe-on-steroids) is pretty much the DOS/OS2/NT-equivalent to bash/csh/zsh/... Aliases, better command line editing, history and more.

But rather than invent a new language (in MS-land), TakeCommand (TC) extends "DOS-isms" -- added commands, pseudo-environment variables and whatnot. Equivalent-ish to what  Unix bash/etc users have access to.

BUT...4NT adds a few things I haven't seen in command shells, notably a popup window for interactive GUI-ish navigation (arrow keys) and selection for history and filename/dirname completion. I don't recall seeing anything like that commonly in Unix shell land.

If you like the added power of Unix shells, but think running bash on DOS/OS2/Windows/NT is perverse, you'll love TC.


PowerShell is MS' official bash-like replacement. Think 'bash is to Unix as PowerShell is to NT' - but, they add a object-piping feature, so if you pipe a couple of .NET scripts/programs together you can pass .NET objects between them (rather than byte streams).


All in all, I'm still a fan of TakeCommand (on Windows). Almost as much as TSE :-)
Reply all
Reply to author
Forward
0 new messages