Custom Scripts

This plugin adds a new submenu named "Custom scripts" to the script menu. This plugin help you to open, run and auto-startup scripts. With this plugin you can also create interactive scripts.

Informations

Creator

BaNoBi

Last version / Date

V 1.3.1 - date: 23 January 2015

Download plugin

DownLoad

Documentation Installation guide
  • Extract the file CustomScripts.zip
  • Copy the CustomScripts.dll and CustomScripts.xml to the CamBam plugin folder.
  • Edit CustomScripts.xml file and add the scripts you want to add to the menu.

The plugin gets its configuration from the CustomScripts.xml file in the CamBam plugins folder . You must edit the xml file to add your own scripts.

Editing the XML file

Use a text editor to open the .XML file.

Each menu item that will be added to the Script/Custom Scripts menu are defined between the <CustomScript> and </CustomScript> section as following

<CustomScript>
   <Name>Elipse VBS</Name>
   <Path>elipse2.vbs</Path>
   <Autostartup>true</Autostartup> 
</CustomScript> 

The text between <Name></Name> is the text that will appear in the menu

The text between <Path></Path> is the name of the script file. The script file must be in your scripts folder (use the menu Tools/Browse system folder to find the scripts folder)

You can add as many scripts as you want in the xml file ; You only need to repeat this code for each script:

<CustomScript>
   <Name>MENU_NAME_OF_SRIPT</Name>
   <Path>FILENAME_OF_SCRIPT</Path>
   <Autostartup>TRUE_OR_FALSE</Autostartup>
</CustomScript>

Hide the script window

If the text between <Autostartup></Autostartup> is true, the script is run just after Cambam is launched.

On the line 3 of the XML file, you can also change the value between AutoHideScriptWindow></AutoHideScriptWindow>

true: The script window that contain the script code is hidden ; false, the script window is shown. (note: CamBam must be restarted after that this setting has been changed)

With the default XML file given with the plugin, 3 new items, which are named Elipse VBS, Elipse PY and Elipse JS, will be added to the Custom scripts submenu, . The script named "Elipse VBS".will be started automatically.

<?xml version="1.0" encoding="utf-8" ?>
<CustomScripts xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"........
<AutoHideScriptWindow>true</AutoHideScriptWindow> <List> <CustomScript> <Name>Elipse VBS</Name> <Path>elipse2.vbs</Path> <Autostartup>true</Autostartup> </CustomScript> <CustomScript> <Name>Elipse PY</Name> <Path>elipse2.py</Path> <Autostartup>false</Autostartup> </CustomScript> <CustomScript> <Name>Elipse JS</Name> <Path>elipse2.js</Path> <Autostartup>false</Autostartup> </CustomScript> </List> </CustomScripts>

 

Variables

The plugin can also ask for values for the variables that will be used in the script, so you can create interactive scripts.

A request will appear if in your script you add the following lines:

'STARTCONST
const VARIABLENAME as single = 3 'DESC:Description for this variable
'ENDCONST

For example, if you have a script to add a circle, you can ask to the user what is the value for x, y and diameter that must be used in the script, like this:

'STARTCONST
const x as single = 0 'DESC:Position x of the circle
const y as single = 0 'DESC:Position y of the circle
const diameter as single = 20 'DESC:Diameter of the circle
'ENDCONST


sub main
dim c as Circle = new Circle()
dim p as Point3F = new Point3F(x, y, 0)

c.center = p
c.diameter = diameter

doc.add(c)
end sub

When you run the script you will get the three following requests to enter the values for the variables

Requirements CamBam 0.9.8 L, N, P beta2
Forum Link Custom Scripts plugin on the forum
Copyright (c) 2011 HexRay Ltd