VW Preferences Script

From Vectorlab
Jump to: navigation, search

Useful one-liners for setting VW preferences on the fly, without going to the "Preference Panel".


Ideally, VectorWorks would have switches in the interface for modifying VectorWorks' document preferences, much like the buttons on the constraints palette (note by Orso: this has been introduced in VW 2013, I think, but is not customisable). In the absence of this, there is a way to toggle preferences via keyboard commands. This document explains both a simple script for switching various preferences and how to assign it a keyboard command.

The basis syntax is as follows:

<code=vss>SetPref(index, NOT GetPref(index)); { toggle zoom-line }</code=vss>

This sets the value of the indexed preference to the inverse of its current value. The indices for various preferences is listed in the Appendix of the VectorScript documentation.

For example, Zoom Line Thickness has an index of 9. So our script to toggle Zoom Line Thickness would be:

<code=vss>SetPref(9, NOT GetPref(9));</code=vss>

Some useful oneliners for the document context

Below you find some short toggle commands. You can make your own: go to the Appendix, select a flag operating on the document (application) and modify the code accordingly. Preference flags that can be used with this code snippet are all preferences whose value is TRUE or FALSE and Function is Pref. Just pick the selector flag according to your needs.

Toggle "Zoom line thickness"
<code=vss>SetPref(9, NOT GetPref(9)); { toggle zoom-line }</code=vss>
Toggle "Black and white only"
<code=vss>SetPref(10, NOT GetPref(10)); { black and white only }</code=vss>
Toggle "Show Other Objects While In Group"
<code=vss>SetPref(14, NOT GetPref(14)); { Show Other Objects While In Group }</code=vss>
Toggle "Use Black Background"
<code=vss>SetPref(16, NOT GetPref(16)); { Use Black Background }</code=vss>
Toggle "Use Sound"
<code=vss>SetPref(18, NOT GetPref(18)); { Use Sound }</code=vss>
Toggle "Compiler mode"
<code=vss>SetPref(407, NOT GetPref(407)); { toggle zoom-line }</code=vss>

Install a command on the document context

In order to install these commands (sometimes called menues), proceed as follows:

  • Open the VectorScript Plug-in editor
  • Click on New...
  • Name your plug-in and set its type to Command
  • Click on Script...
  • Paste one of the code lines above and click on OK
  • Click on Done
  • Open the Workspace editor
  • Choose where to load your new command:
    • Current Workspace
    • Copy of Current Workspace
    • New Workspace.
    You'll see a list of available commands on the left and the list of installed commands on the right.
  • On the left list, click on All menues and scroll down until you see your command.
  • On the right list, towards the end, you'll see the container for the Document Context. Select your command and drag it in the Document Context. This way it will always available while cntrl-clicking (Mac)/right-clicking (Win) the empty desktop.
  • Confirm clicking on OK.
  • Now your command is available.