Jump to content
Developer Wiki and Function Reference Links ×

Converting DoMenu() to DoMenuTextByName()


Jim O

Recommended Posts

Hi All,

I have some MiniCAD 6 code that needs to be converted to VectorWorks 11. This code has some DoMenu() functions in it. But, I don't know what certain DoMenu() parameters mean, such as:

MReCalc

MPageSetup

1426

and

NoKey

I have searched high and low on the web for an on-line manual and could not find one.

Does anybody know of an on-line source to get this information so that I know what to code using DoMenuTextByName()???

Any help will be greatly appreciated.

Jim

Link to comment
  • Vectorworks, Inc Employee

The MiniCad6 manual states that the name called is the name of the command in the menu.

The 'M' may be a bullet, (option-8 accoring the the manual) It's used for calling externals.

I have no clue what 1426 or NoKey would be, but the command can be used to call any script, so they may have been custom scripts.

Kevin

Link to comment

Hi Jim,

Here's the short answer, (as if there ever is one). The original call DoMenu() was defined in the MiniPascal Language Manual as:

procedure DoMenu(menuItem, modifierKey);

The arguments are of type Integer or Longint, since the values passed are constants.

The letter "M" preceded the menu name (with blanks removed) to define a constant that the compiler used. NoKey, OptionKey, ShiftKey, and CommandKey are constants that define what modifier key is pressed, since some menus have multiple appearances.

Most DoMenu calls use the NoKey modifier. Some, like the Duplicate menu have two commands in the same menu position. Duplicate is the default (NoKey) menu and Duplicate Array... is the hidden (OptionKey) menu. To invoke them from your program you would use:

DoMenu(MDuplicate, NoKey); { Duplicate command }

DoMenu(MDuplicate, OptionKey); { Duplicate Array command }

So, to use the newer DoMenuTextByName command for these two commands, you need to strip the "M" and type them as follows:

DoMenuTextByName('Duplicate', 0);

DoMenuTextByName('Duplicate Array', 0);

The menu names should be typed exactly as seen in the real menu, but in some the ellipses are removed. The "0" is used for individual menus. Numbers other than "0" are use for sub-menu indexing using Menu Chunks. The Font>Size menu is a good example. For 10 point text, use the following:

DoMenuTextByName('Font Size', 3);

where 10 pt is the third item in the Size sub-menu. The names of the Chunk menus are found in the VS Function Reference Appendix, sometimes including the word "Chunk", and sometimes not. OK, too much info.

Where there are existing, or newer, VS commands that do the same functions, it is preferred you use them, rather than using the DoMenuTextByName() command. Somewhere it is written that DoMenuTextByName commands should be avoided, but the VS language is incomplete and invoking a menu action is the only way to get some things done.

Lastly, MReCalc is the ReCalc menu (used to recalculate Worksheets), MPageSetup is the "Page Setup" menu, and 1426 is the "Fit To Page" menu. To the best of my knowledge, none of this is online. The old MiniPascal Manuals are still worth their weight in gold.

Good luck and HTH,

Raymond

Link to comment

Thanks Raymond and Kevin.

Since I wrote this post initially I did a little research. And I also called VectorWorks tech support and discovered, to my dismay, that they do not support VectorScript.

I now know that the DoMenu(MReCalc, NoKey) recalculates the worksheet in MiniCAD 6. However, it seems no matter what I try I can't get the worksheet to recalculate in VectorWorks 8. I have tried the following and I get this error message:

Error: DOMENUTEXTBYNAME - Menu cannot be found.

I tried:

DoMenuTextByName('Recalculate', 0);

... ('Worksheet Menu Arrow', 1);

... ('MReCalc', 0);

... ('ReCalc', 0);

In the VectorWorks manual it refers to the worksheet menu as the "Worksheet Menu Arrow", so I tried that with a "1" for the first submenu selection, but it didn't work.

SO, there must be something else that it is looking for. Have you, or anybody else out there, had to perform a recalculation of a worksheet? And if so, what command have you used. Perhaps there is another command, besides using DoMenuTextByName(), that will perform the recalc.

Thanks in advance.

Jim

Link to comment

Sorry Jim,

You are in limbo for WS commands with VW8. VW9 saw a plethora of new commands introduced, including RecalculateWS(), which I believe you are looking for.

My knowledge of WS manipulation is limited, but from looking at the VW8 VS Language Reference, there isn't much to work with, including the DoMenuTextByName options. If you need your scripts to work, I'd recommend you update your software and take advantage of a much broader language support. You might be able to find versions of VW9 or VW10 on EBay if you can't afford to jump to VW 11 right now. Personally, I'd go to VW10, it is very stable in it's scripting.

Maybe somebody else has a ReCalc trick they can offer.

Raymond

Link to comment

Thanks a lot Raymond.

We are actually in the process of upgrading to VW11, but first I need to convert MiniCAD 6 to VW8.

I haven't installed VW 11 yet, but I think that I will go ahead and install it and check out the VS reference manual for the DoMenuTextByName() parameters that I am looking for. From what you have told me, it sounds like everything I am looking for will be on there, at least the Worksheet commands.

There are only three other parameter settings that I need to know to get my scripts to "compile":

DoMenu( 1485, NoKey) is the (only) line executed for the "Lock" utility

1486 is used to "Unlock"

and

1426 - somebody said that was the "Fit to Page" code under "Page Setup."

Is anybody familiar with these codes? Perhaps there will be an explanation in the VW11 documentation.

Thanks,

Jim

Link to comment

Jim,

There will not be an explanation in the VW11 docs. The only place I have seen the list written is the back of the MiniPascal Manual for version 5. It was not in any of the later versions. They stopped printing the books at MC7 and have been using PDF docs since. Perhaps the NNA tech support could send you a list. If you have any more numbers you need, I'll be happy to look them up for you.

Raymond

PS - I'm glad I'm somebody. [Cool]

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...