Topic: Slight enhancement to VP User Menu. (1 of 2), Read 82 times
Conf: VEDIT Macro Library
From: Peter Rejto
Date: Sunday, January 20, 2002 03:01 PM

Hi,

I am using several User Menus. Since the VP {Misc, Load {User} menu } command does not display the name of the loaded USER.MNU file,
I have written a short macro which does this.

// USER_MENU.VDM
// "Points and shoots" a .MNU file from a given directory.
// Please edit this directory as needed!
// Then loads it as the new user menu, similarly to VP.
// Enhancement to VP 6.01.3: it displays the FILENAME of the new user menu.
// PR January 19, 2002.

:USER_MENU:
Get_Filename(86,"c:\localvedit\user-mnu\*.mnu") //Get by point and shoot a .mnu file and put it ..
Reg_Load(124,@86) //Load the content of T-Reg 86 into the "{USER}" register.
File_Open(@86,OK) //
Reg_Set(85,FILENAME) // Put "just the filename" of the selected user menu fiile intp T-reg 85.
File_Close(NOMSG)
Reg_Set(84,"&U-")
Reg_Set(84,@85,APPEND)
Config_String(USER_MENU,@84)
Return

Wishlist: Actually, I do not need the extension of the USER.MNU file displayed.
I would need a "FILENAME2" string, which displays the filename without extension.

Thanks,
-peter

 


Topic: Re: Slight enhancement to VP User Menu. (2 of 2), Read 80 times
Conf: VEDIT Macro Library
From: Christian Ziemski
Date: Sunday, January 20, 2002 03:42 PM

>Wishlist: Actually, I do not need the extension of the USER.MNU file =displayed.
>I would need a "FILENAME2" string, which displays the filename without =extension.

Peter:

You can use FILE_ONLY for that purpose.


BTW:
I modified your macro to make it a bit more flexible (regarding used
buffers/registers):

Christian


:USER_MENU:

#103=Buf_Num // remember current buffer
#104=Reg_Free // temporary T-Reg

Get_Filename(#104,"|(HOME)\*.mnu") // Get by point and shoot a .mnu file and put it ..
Reg_Load(124,@#104) // ...into the "{USER}" register.

Buf_Switch(Buf_Free()) // Switch to a temporary buffer
File_Open(@#104,OK) // and open the mnu file there
Reg_Set(#104,FILE_ONLY) // to get the filename of the selected user menu file
Buf_Quit(OK) // close used buffer again
Buf_Switch(#103) // switch back to original buffer

Reg_Set(#104,"&U-", INSERT) // insert a leading underlined character
Config_String(USER_MENU,@#104) // and use that as menu title
Reg_Empty(#104) // empty the used T-register

Return