Directory Alias Issue

Dec 2, 2008
212
2
Canada
#1
Here is what I have setup:

Sets loaded using "set /r":

jp="C:\Documents and Settings\cgunhouse\My Documents\JPSoft"
jpB="C:\Documents and Settings\cgunhouse\My Documents\JPSoft\Batches"
jpS="C:\Documents and Settings\cgunhouse\My Documents\JPSoft\StartUp"

Aliases loaded using "alias /r":

jp:=%jp
jp=pushd %jp
jpb=pushd %jpb
jpb:=%jpb
jps=pushd %jps
jps:=%jps
edit1="%ProgramFiles%\IDM Computer Solutions\UltraEdit\Uedit32.exe"
edit2="%ProgramFiles%\IDM Computer Solutions\UltraEdit\Uedit32.exe" %@truename[%1]

Typed at command line:

edit1 jpb:\mailzipjob.btm

Command line parsed as:

"C:\Program Files\IDM Computer Solutions\UltraEdit\Uedit32.exe" jpb:\mailzipjob.btm

Editor tries to load:

C:\Documents and Settings\cgunhouse\Application Data\IDMComp\UltraEdit\jpb:\mailzipjob.btm

FILE NOT LOADED


Typed at command line:

edit2 jpb:\mailzipjob.btm

Command line parsed as:

"C:\Program Files\IDM Computer Solutions\UltraEdit\Uedit32.exe" C:\Documents and Settings\cgunhouse\My Documents\JPSoft\Batches\mailzipjob.btm

Editor loads:

C:\Documents and Settings\cgunhouse\My Documents\JPSoft\Batches\mailzipjob.btm



Now the question, is there a way to expand the directory alias before it is passed to the editor without having to use @truename?
Alias edit1 will allow me to edit more than one file on the command line but alias edit2 restricts me to one.

Craig
 
Likes: Charles Dye
#4
Charles' answer is easy to do interactively, but not in a batch file. You could also change your alias definition to include multiple parameters:

edit5="%ProgramFiles%\IDM Computer Solutions\UltraEdit\Uedit32.exe" %@quote[%@truename[%1]] %@quote[%@truename[%2]] %@quote[%@truename[%3]] %@quote[%@truename[%4]] %@quote[%@truename[%5]]

which accepts up to 5 parameters. Note the use of @QUOTE[] - you probably do not want the embedded whitespace to be a parameter separator...

It is explicitly stated that aliases, including directory aliases, are internal to TCC - you would have to enhance NTFS itself if you wanted other programs to be able to accept them. OTOH you can just use the variables you already defined explicitly in your setup instead of directory aliases, using the same number of keystrokes:

edit1 %jpb\mailzipjob.btm

should work as intended, and you would not even need to define the directory aliases...

BTW, I use *cdd instead of pushd in my aliases to switch directories, because more often than not I do not want to return to the previous directory. When I do, I just use the - (hyphen) command, which takes me back to the last directory.
 
Dec 2, 2008
212
2
Canada
#5
UltraEdit process the parameters without the %@quote[]

I was hoping for something like:

edit="%ProgramFiles%\IDM Computer Solutions\UltraEdit\Uedit32.exe" %@truename[%$]

But of course this doesn't work.

As for *cdd instead of pushd for the aliases I have listed in the example, the to and from my TCC batch files and support files for editting and then I usually do jump back to where I was.
 
Dec 2, 2008
212
2
Canada
#7
Actually I came up with something a little better.

ed*it=IFF %# == 0 THEN & %UltraEdit & ELSE & for %a in ( %$ ) %UltraEdit %@truename[%a] & DELAY /M 10 & ENDIFF​

This allows for something like:

edit *.cpp *.h
and the "DELAY /M 10" is only in there because UltraEdit acts funny when it has so many command line requests thrown at it in quick succession.
 
#8
I would suggest to use %@EXPAND, so you could open UltraEdit just once, with all the matching files as arguments.
But it turns out @EXPAND doesn't support things like :System or your jpb: