|The Script Engine allows you to integrate your own or already existing scripts to customize PCB-Investigator according to your needs.|
(Hint: This description won´t help you to write a code, but to use the "Script Engine" plugin.)
The "Script Engine" allows you to write your own code in a script an use it within PCB-Investigator. To open the dialog click the "Script Engine" button.
After opening the "Script Engine" dialog for the first time, you will see two scripts in your "Favorites" tab for demonstration purposes.
If you click on the "Web" tab and choose a script, you can see the code of the script on the right side. The "Web" tab does not allow to edit the code (marked by the grayed background of the code block).
Add scripts to local/favorites tab
To add scripts to the local tab, there are two ways.
1. Create your own script: To create your own script, you can add it by using the "File" tab at the bottom or by just right clicking on the white area in tab control
Both possibilities allow you to add a new script. There are different types of scripts you can add. These types do act completely different.
2. Add a "Web" script (already existing script)
To add an existing script switch to the "Web" tab. The opened "web" should look similar to the following image. With the "search" field at the top of the window you can search for a certain name or description.
To add a web script to your local/favorites tab, left click on the desired script. This shoul look like the following image.
After you added it to your favorites or local tab, you can edit them. Switch to the "Local" tab, if you want to edit the code.
The "Local"/"Favorites" tab now contains your desired added script.
Adding a local script to you favorites can also be done by right clicking the script and choosing the "Add to Favorites" option. Scripts can also be organized in sub folders for a better categorization.
IMPORTANT: Once a script is in the favorites, the script will be registered as an "Action" at the next start of PCB-Investigator. The script will then be available in the "Customize Ribbon" area and can be placed as a button anywhere in the menu.
The only requirement for this is, that the script as an unique GUID in the script's Header, like all our web scripts have. Example:
// GUID MyUniqueScriptGUID_123456
// ButtonEnabled=5 (Button enabled if: 1=Design is loaded, 2=Always, 4=Design contains components, 8=Loaded step is a panel, 16=Element is selected, 32=Component is selected)
The "ButtonEnabled" value gives you the possibility to define the condition for the enable-state of the button. E.g. if your script needes a design to be openend, and a component to be selected, the correct value would be 1+4+32=37. If the script only works when components exist but nothing has to be selected, the value is 1+4=5.
Starts running the script. Starting the script will automatically compile the code first. You can either start running using the right click on a script and clicking "Run" or just by clicking the green start button at the top of the dialog.
Stops running the dialog by clicking the red square button.
With this button, you can compile your code. Compile errors will be shown in the list at the bottom of the window.