Programming Tips:ioControl & OptoControl - old forum post


Joined on 12-01-2003
Optomation Systems, Madrid, Spain
Posts 153
Programming Tips:ioControl & OptoControl

[B]Successfully Exporting and Importing charts containing OptoScript[/B]
Chart export and import functionality is perfect for transferring code between different strategies or projects, but does give problems when the charts contain OptoScript blocks. Variables contained only in OptoScript blocks will not be added and must be added manually. If you are using OptoScript to reduce flow chart logic, the chances are the OptoScript code only uses a few variables and works with multiple indexes of float, integer and string tables. A useful tip to importing these variables, along with associated table lengths, descriptors and download options etc with the corresponding chart, is to create an independent action block marked “Delete This Block”.

Naming the same variables as used by OptoScript in any instruction within the block (such as “Move”, “Move to String”, or “Move to Table Element”), is good enough for the export function to identify and process the corresponding variables. After importing the chart in your new project, “Delete This Block” can be deleted, and the corresponding variables will be located and merged, successfully compiling code contained in the OptoScript blocks.

Checking the Chart Import Report will inform you of any variables that you forgot to include in the block, but are still present in OptoScript blocks. Simply return to the original chart, add them to the block, repeat the export activity and replace the previously imported chart to relink previously missing variables.

All you OptoScript programmers and would-be programmers:

OptoScript-ing has come a long way since George Mitchell shared this helpful tip with us. Having this extra “Delete This Block” is no longer needed as of PAC Control R7.0a. Go ahead and import/export and copy your OptoScripts blocks with ease.

R9.0a also brought these improvements to the editor:

  • Hotkeys for common functions
    [INDENT]Alt-A : Insert Action Command
    Alt-C : Insert Condition Command
    Alt-V : Insert Variable
    F7 : Test Compile
    [/INDENT]+ Toolbar redesign
  • Added a resizing grip
  • Added an “Include parameters helps” option in the Select Instruction
  • Allow the Esc key to Cancel if there are no changes.

Script away!