How to Extend the VDE with User-Defined Commands?
To extend the VDE with user-defined commands, please, follow the instructions:
- From the ..\VDESRC directory load a project file depending on your platform:
Platform
|
Project File
|
Win32 |
VIP32.VPR |
Win16 |
VIP.VPR |
OS/2 |
VIPOS2.VPR |
- Add a new menu item with an arbitrary name and with the constant = id_user_command
into all VDE menus that should contain it;
- Insert the following text into VIS.PRO:
main_event(TWin,e_Menu(id_user_command,_),0):-
Comm = "UserToolFile.exe command line"
% It is user's tool command - WRITE YOUR COMMAND HERE
vip_write(Comm),
dir("inter",ObjDirPath,_),
syspath(SYSPATH,_),
disk(CurrentDir),
filenamepath(FullCapdosOutFileName,ObjDirPath,"CAPDOS.OUT"),
ifdef os_os2
filenamepath(CapdosTXTin,SYSPATH,"..\\CAPDOS.TXT"),
filenamepath(CapdosBATFileName,ObjDirPath,"CAPDOS.CMD"),
elsedef
filenamepath(CapdosTXTin,SYSPATH,"..\\..\\CAPDOS.TXT"),
filenamepath(CapdosBATFileName,ObjDirPath,"CAPDOS.BAT"),
enddef
trap(deletefile(FullCapdosOutFileName),_,fail),
trap(deletefile(CapdosBATFileName),_,fail),
filenamereduce(CapdosTXTin,CurrentDir,CapdosTXTinReduced),
filenamereduce(FullCapdosOutFileName,CurrentDir,
FullCapdosOutFileNameReduced),
format(CommWithInputFlow,"%s <%s >>%s\necho ...>>%s",
Comm,CapdosTXTinReduced,FullCapdosOutFileNameReduced,
FullCapdosOutFileNameReduced),
set_current_path(),
file_str(CapdosBATFileName,CommWithInputFlow),
vpi_ProcessEvents(),
AppId = vpi_CreateProcess(TWin,CapdosBATFileName,"",wsf_Invisible),
retractall(capdosRunning(_)),
assert(capdosRunning(AppId)),
wait(FullCapdosOutFileName),
trap(file_str(FullCapdosOutFileName,OUT),_,fail),
vip_write(OUT),
trap(deletefile(FullCapdosOutFileName),_,fail),
trap(deletefile(CapdosBATFileName),_,fail),!.
- Build a new VDE.
- Save a new version of Visual Prolog at a temprorary place.
- Close Visual Prolog.
- Move a new version of Visual Prolog to ..\Bin directory.
|