Jump to content
Developer Wiki and Function Reference Links ×

Where to get handles of current palettes, tool bars & dialogs?


Recommended Posts

Where would I find the handle names of the various palettes, tool bars & dialogs? I've looked across the forum without any joy

I'm looking especially for the handles of these items: 
• Resource manager
• Object info
• Basic 
• Attributes
• Snapping

 

I'm not a scripter or programmer but knowing these will get me further,  I'm trying to automate a process using Auto Hotkey - but for that I need object handle  names.

Link to comment

What are you ultimately looking to do?  Are you looking to be able to toggle palettes on and off or to manipulate the positions of the palettes?  I wrote a plug-in a couple of years ago called Presentation Mode that can turn them on and off and can be mapped to a keyboard shortcut, but there is no way that I know of to manipulate the positions or sizes of palettes.

 

Unfortunately, the plug-in will only work for VW versions 2019 and higher, are you indeed using VW2018 as your signature says?  I could DM you the source code and walk you through the process of setting up the scripts, but it would be a little bit of work.  If you are on a newer version of VW, keep in mind that there is not a way to toggle the Object Info Palette on and off with code in versions 2020 and newer.

 

My plug-in is written in Vectorscript, but there may be a way to do it with the SDK (C++).  If you are not a programmer, I would advise away from attempting working with the SDK without some level of training in C++.

 

If you are interested in the scripting behind what you are asking for, you'll need a couple of different approaches for the palettes you are asking about.  All of the scripting functions and commands can be found in the Vectorworks Script Function Reference, and I heartily recommend having it open whenever you are doing any scripting.  There is an online one hosted on GitHub as well as an offline one included with your installation of Vectorworks.  The offline one is an .html file called ScriptFunctionReference.html found in a folder called VWHelp in the program file for your version of Vectorworks.  I very much prefer the offline version myself, I find the GitHub reference awkward to navigate.  That said, any time I list a scripting command in this post, I will link it back to the online Function Reference.

 

image.png.f11d17bf8ab3060fffa354324477055c.png

 

As for the methods you will need for each of your wanted palettes:

 

Resource Manager:

The Resource Manager can be toggled using a DoMenuTextByName command.  DoMenuTextByName is essentially directly calling Window -> Palettes -> Resource Manager as if you had clicked it directly through the Menu Bar.  In this case, we need to know two things, the subMenu and the selector index.  The subMenu is a text string and the index is an integer relating to a specific item.  This information can be found in the Function Reference in Appendix H.  In this case, our subMenu is "Standard Palettes Chunk" and our index is 5.

image.thumb.png.950146af53e3c322dad6b4c31f1eb43f.png

 

So, the final line of code would look like DoMenuTextByName('Standard Palettes Chunk',5);  Keep in mind that this is strictly acting as a toggle, there is no way for the script to know if the palette is currently visible or not, so the this code will just toggle the current state.

 

Object Info Palette:

We can use the same methodology for the object info palette, DoMenuTextByName('Standard Palettes Chunk',3);  Keep in mind that this will not work versions newer than VW2020.

 

Attributes Palette:

Once again, we can use DoMenuTextByName('Standard Palettes Chunk',2);

 

Snapping Palette:

The naming in the appendix is a bit odd, it's listed as Constraints instead of Snapping.  DoMenuTextByName('Standard Palettes Chunk',1);

 

Basic Tools Palette:

This one works slightly differently, we will use SetPaletteVisibility instead.  This is instead looking directly for the name of a palette and passing in a boolean (true/false) to determine whether or not it is visible.  For the Basic Tool Palette, the name it is looking for is literally just "Basic".  So, to hide the Basic Tool Palette, we would use SetPaletteVisibility('Basic',FALSE);  If we wanted to make a single line toggle command, we could use a combination of the NOT keyword and the GetPaletteVisibility function.  Something to the tune of SetPaletteVisibility('Basic', NOT GetPaletteVisibility('Basic'));

 

I hope this information is useful to you.  Please feel free to reach out if you have any questions.  I do recommend posting questions in either the Vectorscript or Python Scripting sections of the forum.  The SDK section is more for the true VectorWizards who know the Deep Magic, the other sections will be much more approachable.

  • Like 1
Link to comment

Hi Jesse, thanks, What I'm hoping to do is to use Auto Hotkey's ability to manipulate placement of toolbars, dialogs and OI boxes so that when I start up each morning, all my various dialogues are pushed to specific places on my other screen. VW does not honor the positions of dialogues and toolbars - I normally have them floating free on the screen to my left, and after twenty years it's getting really tiresome. Every other package I use does honour prior placement of loose screen items.

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...