1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Directory Alias Issue

Discussion in 'Support' started by cgunhouse, Aug 14, 2012.

  1. cgunhouse

    Joined:
    Dec 2, 2008
    Messages:
    209
    Likes Received:
    2
    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
     
    Charles Dye likes this.
  2. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,374
    Likes Received:
    40
    Press the Tab key. (Also saves you from having to type the entire filename....)
     
  3. cgunhouse

    Joined:
    Dec 2, 2008
    Messages:
    209
    Likes Received:
    2
    Or Ctrl-F, but if I put alias edit1 into a batch file, Tab and Ctrl-F wouldn't help.
     
  4. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    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.
     
  5. cgunhouse

    Joined:
    Dec 2, 2008
    Messages:
    209
    Likes Received:
    2
    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.
     
  6. cgunhouse

    Joined:
    Dec 2, 2008
    Messages:
    209
    Likes Received:
    2
    By the way, I ended up with:

    ed*it=IFF %# == 0 THEN & %UltraEdit & ELSE & for %a in ( %$ ) %UltraEdit %@truename[%a] & ENDIFF
     
  7. cgunhouse

    Joined:
    Dec 2, 2008
    Messages:
    209
    Likes Received:
    2
    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. MaartenG

    Joined:
    Aug 3, 2016
    Messages:
    358
    Likes Received:
    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:
     

Share This Page