User to user discussion and support for UltraEdit, UEStudio, UltraCompare, and other IDM applications.

Help with setting up and configuring custom user tools in UltraEdit (based on command line input)
8 posts Page 1 of 1
Hello,
Is there any way to have more information on the title bar of the UEDOS32.exe?

I mean, being able to see -for example- the filename that I have running?

Now I see in the tilte bar: UltraEdit DOS Command Window
I would like to see: UltraEdit DOS Command Window - "C:\filerunning.data"

Ideas?

Thanks!
UltraEdit 16.30.0.1003
UltraCompare Professional 7.20.0.1009
Windows Vista Enterprise, 64 bits, Spanish
If the tool you call is a batch file you can use at top of the batch file the command title to set the title for the window. Examples:

title Running %0 with %1
title %~nx1 with batch %~n0

%0 references command line argument 0 of the batch file which is the full name of the batch file.
%1 references command line argument 1 of the batch file which is the first parameter you passed to the batch file from UltraEdit, usually the file name.

For help on the modifiers as used in the second example open in UltraEdit Advanced - DOS Command, enter for /? and execute the command. The outputted help of the command for is captured by UltraEdit into an edit window and you can read it now easily. Near the end is the list of modifiers available in for loops and also for the command line arguments.

The title command can be used at any time as often you want in a batch file.
Best regards from Austria
Mofi,

I get your point, but...
How do I make the .BAT?

I have this on the Tool Configuration:

Code: Select all
Menu item name: Schlumberger Eclipse
Command line: C:\ecl\macros\eclrun.exe eclipse "%f"
Working directory: %P

Options:
Is a DOS program
I save the active file.


Output:
I create new file.
I set to show the DOS box
Capture output
And no replace.


Thanks as usual for your help,
Saludos
UltraEdit 16.30.0.1003
UltraCompare Professional 7.20.0.1009
Windows Vista Enterprise, 64 bits, Spanish
Replace the command line of the tool for example by

C:\ecl\macros\ue_eclipse.bat "%f"

and create in the directoy C:\ecl\macros\ a text file named ue_eclipse.bat containing the following 3 lines:

@echo off
title UEDOS %~1
C:\ecl\macros\eclrun.exe eclipse "%~1"


Nothing else to change.



Why using %~1 instead of just %1 ?

Well, %f is replaced by UltraEdit with the full long name of the active file. A long name can contain a space character and therefore double quotes must be used. But the double quotes are not removed by Windows and there is no command line interpreting code as in applications (the "stub" code executed before calling main function) which removes the double quotes from the argument string. Therefore the first parameter (argument 1) of the batch file can be with or without double quotes depending how a user or application called the batch file. That's not good for the commands in the batch file. Some commands do not work and result in batch exits when a file name with double quotes is passed. For example the following simple line to initialize an environment variable with the first parameter string fails if the parameter is enclosed in double quotes:

set FileName=%1

Therefore it is better to use inside the batch file always double quotes for file name variables and throw them away from the parameter. Using %~1 results in using the passed first parameter always without double quotes, independent how the batch file was called, with or without double quotes around the first parameter.

And in the window title you likely don't want to see the double quotes. I prefer always to use environment variables for batch file parameters to easily know on reading the batch file what should be passed by the caller. So I would use for this little batch file following commands:

@echo off
set EclipseFile=%~1
title UEDOS %EclipseFile%
C:\ecl\macros\eclrun.exe eclipse "%EclipseFile%"
set EclipseFile=


The last line is not really needed here because the environment variables memory copied from system environment variables memory on start of the batch file and modified within the batch file is automatically destroyed on exit of the batch file. But I always delete all environment variables used in my batch files in case of calling this batch file ever from another batch file which also needs environment variables. The environment variable memory buffer is quite limited to some KB and I have seen many larger batch jobs fail because of "out of environment variable buffer".
Best regards from Austria
Great great great!
Thanks!

I end using this .BAT:
Code: Select all
@echo off
set EclipseFile=%~1
set EclipseDATA=%~2
title Eclipse: %EclipseDATA%
echo Schlumberger Eclipse
echo Ejecucion: %EclipseFile%
echo.
C:\ecl\macros\eclrun.exe eclipse "%EclipseFile%"
set EclipseFile=
set EclipseDATA=


But I have this question.
I want to place this .BAT in a folder inside the %appdata%.
Will be something like this:
Code: Select all
%appdata%\IDMComp\UltraEdit\ecl\

or
Code: Select all
C:\Documents and Settings\XXXX\Application Data\IDMComp\UltraEdit\ecl


So... How do I write this on Command Line field in the Tool Configuration dialog?
Code: Select all
%appdata%\IDMComp\UltraEdit\ecl\eclipse.bat "%f" "%n%e"

I mean, a path with spaces and all that stuff.

Thanks!
UltraEdit 16.30.0.1003
UltraCompare Professional 7.20.0.1009
Windows Vista Enterprise, 64 bits, Spanish
Because the environment variable APPDATA is replaced on execution by its value which contains on your computer a space character, you have to double quote the batch file command also in the user tool command line. Use the tool command line:

"%appdata%\IDMComp\UltraEdit\ecl\eclipse.bat" "%f" "%n%e"

Well, you can omit "%n%e" from the tool command line if you replace the third line in your batch file by:

set EclipseDATA=%~nx1

n ... name only.
x ... extension only (with point).

nx ... name + extension = file name without path. Explained in help of command for.
Best regards from Austria
As usual... works like a charm!
Thanks!

The only thing I couldn't do is to define the ICON in the same way.
Something like:
Code: Select all
"%appdata%\IDMComp\UltraEdit\ecl\eclipse.ico"

I need to set the complete path without the variable %appdata%.
UltraEdit 16.30.0.1003
UltraCompare Professional 7.20.0.1009
Windows Vista Enterprise, 64 bits, Spanish
I have found that using %appdata% only works on Windows Vista (and I think, also on Windows 7)... But it doesn't work on Windows XP.

So I have to leave it like this:
Code: Select all
"C:\DOCUME~1\XXXX\APPLIC~1\IDMComp\UltraEdit\eclipse\eclipse.bat" "%f"
UltraEdit 16.30.0.1003
UltraCompare Professional 7.20.0.1009
Windows Vista Enterprise, 64 bits, Spanish
8 posts Page 1 of 1