EPM startpage Homepage Contact me SiteMap

The EPM Shellkram Macro - by Jörg Tiemann

Summary: EPM Shellkram is a macro of mine which is aimed to make the work in the EPM shell more comfortable.  Among its features are a filename name completion, a highlighting scheme and a set of (hopefully) useful keybindings.
EPM Shellkram is complemented by my change directory scripts jj.cmd and jcd.cmd both of which have their own web page.

Current version: 0.88 - 2001 Oct 3

On this very page:

The name
Download is here
Known bugs & glitches
The files included
Features in examples
EPM keybindings
The non avoidable disclaimer

WTF does Shellkram stand for?  

Usually names have their meaning. If you're lucky enough to understand my native language you might read an article about the art of name reading on this very web site. "EPM Shellkram" has its meaning, too. For EPM and shell - have a wild guess! And the "Kram" (German) translates to the English "riffraff" (or simply speaking "stuff") or the more descriptive Dutch "rataplan". You might hesitate a moment to call this a meaningful name, but I hope only a moment. Because then you will realise that exactely in its bewildering inexactness is hidden the very root of its openness for extensions. This macro's name is not "Kram" because I couldn't spell "fiel name complitcion" but because it exceeds the simple concept of mere file name completion. Wanna read more of this bubble? Then go and read some "Kram" in your favorite marketroid journal. <g>


Known bugs & glitches  

SYS 3175
Don't know if that's related to Shellkram, but anyway:
From time to time (maybe days, maybe hours) EPM crashes 3175ly when attempting to switch to another file in the same edit ring. I think that there might be a memory leak in EPM's handling of toolbar icons (I autoswitch toolbars when switching through the edit ring, loading the appropiate toolbar for the type of file), but am not sure about that.
Anyway: The crash itself is absolutely unspectacular, does not damage anything and EPM can be restarted right away. Thus the only advice I give to you is to adjust your autosave and backup options - just in case ...

"Invalid second parameter"
When invoking file name completion for the first time in an epm command shell session an error message "Invalid second parameter" may appear in the message-line. I think this is due to an error in do_array 6 (a function to return the ID of an array) which returns -1 and this error message instead of 0 if the asked for array does not yet exist.
This error message can imho be ignored.

Yet unsupported:
Directory and file names containing blanks. The first level is found, but then the filename completion fails.
Thus the dir e:\long directory name with blanks gets completed, but the file e:\long directory name with blanks\file name.txt won't.
I will fix this somewhen in the future by making Shellkram putting its results in quotes when appropriate.

Bad documentation etc.
I haven't coded at shellkram for a long time, I just work with it. Some configuration thingies are not exactely userfriendly and need to be changed.

The Files included in this package  

highlighting scheme for epm command_shells
the main macro containing all the filename completion stuff, some defload and defmodify instructions
compiled version of the above. But please compile the stuff yourself if possible, as I never use th *.EX and therefore ...
a sample mystuff.e, more under Installation
sample directory list file for the jjbox command
REXX script that does the cd'ing for jcdbox and jjbox (commands within Shellkram)
shell-toolbar for the EPM command_shell
PS: I've noticed that this f* beast uses absolut paths to its icons, so this may be of very limited use for you. :-(
My icons can also be found on my downloads page.
shellkram_readme.html & the dir docs
this file for offline browsing

  1. Copying:

    • Put EPMKWDS.command_shell to your other epmkwds.* files, put shellkram.e to your other *.e files (somewhere in your EPMPATH, usually into the same directory where your my*.e files are home).
    • Copy the icons and the toolbar to the rest of your EPM toolbar icons and toolbars (usually into the EPM directory).
    • Copy jcdd.cmd in some directory in the into the PATH or into your EPM directory.
    • Copy jjlist_b.db and jjliste.db into the temp path specified in your EPM preferences. [A big Sorry! I am surprised myself that I committed such nonsense, but for the moment I think it is better to use the temp path than to make last minute changes ... Think about backuping those files though if the temp path gets cleaned at system start or shutdown.]

  2. Modifying:

    This one is only necessary if you want to use the jjbox command (a simple defc that opens a dialog box with a list of directories to cd to).

    • jjlist_b.db: modify to meet your needs. The first line has to be blank and empty and all the other lines should contain a single directory you might want to change to using the jcdbox command.

    If you decide to compile shellkram.e yourself (in contrast to just linking shellkram.e) you might want to read also the following two points.

    • shellkram.e: no modifications necessary
    • jt_mystuff.e: you need to copy at least the line
         tryinclude 'shellkram.e'
      to your mystuff.e file.

  3. Linking or compiling:

    You just need to perform one of the following steps, either linking shellkram.ex or recompiling your EPM. IMHO it is preferable to do the latter, but that might depend on the circumstances and YMMV anyway.

    1. Linking:

      1. Open the epm command prompt by hitting <Ctrl-I> or <ESC>.
      2. Enter link shellkram.

        epm command prompt

    2. Compiling:

      1. Open the epm command prompt by hitting <Ctrl-I> or <ESC>.
      2. Enter etpm.

        epm command prompt

      3. Shut down all running instances of EPM.
      4. Restart EPM.

  4. Testing:

    1. Open the epm command prompt and enter the command esk_About. A info box should appear.

      shellkram about box

      If this box does not show up, the whole shellkram.e is not included (or the *.ex is not linked). Worst case. Just re-check the whole installation, especially the paths. You can always complain to me, but I'm not very likely to have (m)any ideas how to help you if you're stuck with this.

    2. The command prompt in the epm command_shell should be white on bright blue. If it isn't something went wrong. You then can try to at least activate the syntax highlighting manually (as described in Red Alert Commands).

      highlighting test

    3. But let's hope everything went fine so far! Next test is if the key bindings work ok. Enter a dir at the prompt and then (after the listing is performed) hit <Ctrl-Up>. The cursor should now jump to the previous prompt (you can hit <Enter> to run the command a second time or you can modify the command and then hit <Enter> etc ...). <Ctrl-Down> should bring the cursor down to the next prompt - if there is one.

    4. OK, now let's test the filename completion. Enter again a dir, look at the files listed, pick one out and enter the next dir followed by at least the first letter of the file you picked. Now hit the <TAB> key. The filename should automagically get completed. A great moment in life, isn't it? ;-)
      In the message-Line a message appears to let you know how many files exist which begin with the letter(s) you entered. If the completion does not show the file you picked just hit <TAB> time after time - until you have found the file you were looking for.

    Basically that's it! Study also the following section for better understanding.
Features in examples:  

epm: F:\ > dir *.gif

 Datenträger, Laufwerk F, hat den Namen 2 NEWS.
 Datenträgernummer ist 6709:0815
 Verzeichnis von F:\

 4.03.99   3.50     431532        9600  ergologic.gif
 4.03.99   3.37     125067        9600  ergomaster1.gif
 4.03.99   3.55     144151        9600  kinesis.gif
18.03.99   4.18     128398        9600  maltron.gif
 4.03.99   3.34     367588        9600  maltron1.gif
 4.03.99   3.36     238511        9600  somers1.gif
         6 Datei(en)    1435247 Byte belegt
                     70494720 Byte frei

1. Simple Completion:

epm: F:\ > del er<TAB>
gets completed to
epm: F:\ > del ergologic.gif
another <TAB> and it becomes
epm: F:\ > del ergomaster1.gif

2. Completion with wildcards:

epm: F:\ > del *.gif<TAB>
gets completed to
epm: F:\ > del ergologic.gif
<TAB> now shows you the next completion and <Shift-TAB> the previous; this is a ring. Just check it out.

3. File name vs. directory name completion:

epm: F:\ > dir e<Shift-TAB>
shows the first directory name completion instead of the first file name completion. It is however one completion ring, just sorted into directories and filenames. But with scrolling through the completion ring with <TAB> (forward) and <Shift-TAB> (backward) one can reach them all.

4. Executable name and directory name completion:

If you try to complete the first string after the promptsign, the string you want to be completed is usually a command, an executable or the part of the path to one and thus a directory. Therefore

epm: F:\ > d<TAB>
begins with the executables in that directory (*.exe and *.cmd) and then continues with the directories. If you want to start the completion ring with the directories hit <Shift-TAB> when first invoking the completion.


Special EPM command_shell keybindings  

<Ctrl-Up>    - jump to previous prompt
<Ctrl-Down>  - jump to next prompt

<TAB> - invoke filename completion / 
        executable name completion (at begin of prompt)

      - scroll forward through completion ring
<Shift-TAB> - invoke dirname completion

            - scroll backward through completion ring

<alt-a> - abandon file/exe/dirname completion
          (sorry, have to rethink that, it does no longer
           make sense to me.)
          Normaly it is sufficient to change the cursorposition
          or change a single char.

<alt-H> - invoke Command History Dialog

<alt-I> - invoke Shell Write Dialog

<alt-y> - send 'y' for yes to cmd.exe

<alt-n> - send 'n' for no to cmd.exe

<alt-2> - just keyin "2>nul" 
          (to redirect stderr to nul which can be very useful
           in an EPM command shell)


The non avoidable disclaimer  

I have written EPM Shellkram and you are hereby entitled to use this software for free. 

But if you use EPM Shellkram you do it at your own risk!

I am not aware of any bugs other than mentioned above.

But if you use EPM Shellkram you do it at your own risk!

Thus if you like the macro package and you feel good about it, fine!

But if EPM Shellkram by some strange accident (strange at least to me) manages to wipe all your data, poisons your favorite wife and en passant kills the mentally saner half of the inhabitants of Walla Walla (Washington, USA) I am neither to blame nor to thank for.  I'm just a guy who merely sings to what appears to be a cat and punches little caps on what appears to be a keyboard.  Should I be or do wrong - sorry!  That's all you can expect from me.  If you want someone to be right, be (or do) Mr. (or Mme.) Right yourself!  And I mean this in the nicest possible way.

Have I already mentioned, that if you use EPM Shellkram you do it at your own risk? Good.

If you want to share your thoughts on this macro with me, you'll find my email address and my PGP pubkey on my feedback page.


EPM startpage Top Homepage Contact me SiteMap

Copyright © 1998-2002 - Jörg Tiemann Last modified: Sun, 6 Jan 2002

gratis SMS verschicken im Uboot.com gratis HTML checken bei w3.org gratis quer denken mit Wau Holland