WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

FileMenu

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

FileMenu and Variable Usage

Keywords:     FileMenu

Question:

I have made a little "log-program" where I can choose between different logs. I have tried to implement it in a filemenu, but find some problems here.

I'm not able to use a variable as a menu item declaration. My plan was to "copy" the names of all available logs (using FileItemize) to some variables, and then use those variables as menu item declarations. But all I get is the hardcoded "%variablename%" in the menu - not the contents of the variable.

Do I have to accept that, or is there a way around?

Answer:

Sorry. Menu titles are not part of the scripts, and do not get processed the same, so you cannot use variable substitution.

Question:

Is it possible to create a variable in filemenu.ini which can be passed to or recognized by menu files defined therein?

Basically I want to use menu files to launch executables, and want to specify the path for the exe files in filemenu.ini so that all my menu files don't need to know what the path is.

Answer:

  1. Update filemenu.ini by adding:
    [MyPathStuff]
    mypath=c:\this\that\other
    

  2. Edit filemenu.mnu and add:
    mypath=InireadPvt("mypathstuff","mypath","",inifile
    
    someplace below where the inifile variable is defined and above the first menu item

  3. Then change the run statements to look something like:
    Run("%mypath%\abc.exe","")
    
    in the relevent filemenu code.

Article ID:   W13016
Filename:   FileMenu and Variables.txt
File Created: 1999:04:15:16:51:12
Last Updated: 1999:04:15:16:51:12