1 Reply Latest reply on Feb 26, 2014 9:32 AM by kendall_hiles

    Cell Editor via Library manager : How to add Key shortcuts automation ?

    ashkolnik

      Hi All ,

      In Expedition PCB i have greate vbs file that combine lot of shortcuts see code below :

       

      ' KeyBindings.vbs

      '

      ' Sample script to use the Key Binding Server

      '

      ' This script is intended for use as a startup script. See the section

      ' "Using MGCPCB Automation"->"Using startup scripts" in the MGCPCB

      ' Automatio Help for details.

      '

      '=========================================================================

       

      ' Modifiers exist for key combinations such as:

      '   <key>

      '   Alt+<key>

      '   Ctrl+<key>

      '   Alt+Shift+<key>

      '   Ctrl+Shift+<key>

      '   Ctrl+Alt+Shift+<key>

      ' where <key> is the keyname such as: Enter, Space, A-Z, 0-9, F1-F12,

      '

      ' One exception: Do not override any of the existing function keys (F1-F12) without

      ' using a modifier or that functionality will be disabled in the product.

      '

      BindMenu = 0

      BindAccelerator = 1

      BindCommand = 1

       

       

      Set keyBindTables = Gui.Bindings("Document")

       

       

      ' Bind the menu command to a key

       

       

      keyBindTables.AddKeyBinding "L", "Edit->Lock", BindMenu, BindAccelerator

      keyBindTables.AddKeyBinding "Shift+L", "Edit->Unlock", BindMenu, BindAccelerator

       

       

      keyBindTables.AddKeyBinding "F", "Edit->Fix", BindMenu, BindAccelerator

      keyBindTables.AddKeyBinding "Alt+F", "Edit->Semi Fix", BindMenu, BindAccelerator

      keyBindTables.AddKeyBinding "Shift+F", "Edit->Unfix", BindMenu, BindAccelerator

       

       

      keyBindTables.AddKeyBinding "Q", "Edit->Review->Measure->Minimum Distance", BindMenu, BindAccelerator

      keyBindTables.AddKeyBinding "W", "Edit->Review->Measure->Distance", BindMenu, BindAccelerator

      keyBindTables.AddKeyBinding "V", "Edit->Place->Via", BindMenu, BindAccelerator

      keyBindTables.AddKeyBinding "R", "Route->Interactive->Plow", BindMenu, BindAccelerator

       

       

      ' Bind the execution of a user script to a key

      keyBindTables.AddKeyBinding "Ctrl+U", "run /home/ashkolnik/svhome/EE_WDIR/Alexandres/Scripts/PLANE.vbs", BindCommand, BindAccelerator

      keyBindTables.AddKeyBinding "Ctrl+P", "run /home/ashkolnik/svhome/EE_WDIR/Alexandres/Scripts/PLOUT.vbs", BindCommand, BindAccelerator

      keyBindTables.AddKeyBinding "]", "run /home/ashkolnik/svhome/EE_WDIR/Alexandres/Scripts/silk_up_case.vbs", BindCommand, BindAccelerator

      keyBindTables.AddKeyBinding "[", "run /home/ashkolnik/svhome/EE_WDIR/Alexandres/Scripts/silk_down_case.vbs", BindCommand, BindAccelerator

      keyBindTables.AddKeyBinding "D", "run /home/ashkolnik/svhome/EE_WDIR/Alexandres/Scripts/DRC_OFF_ON.vbs", BindCommand, BindAccelerator

      keyBindTables.AddKeyBinding "N", "run /home/ashkolnik/svhome/EE_WDIR/Alexandres/Scripts/ASSIGNNETNAME.vbs", BindCommand, BindAccelerator

      keyBindTables.AddKeyBinding "P", "run /home/ashkolnik/svhome/EE_WDIR/Alexandres/Scripts/Place_plane_shape.vbs", BindCommand, BindAccelerator

      keyBindTables.AddKeyBinding "S", "run /home/ashkolnik/svhome/EE_WDIR/Alexandres/Scripts/Snap.vbs", BindCommand, BindAccelerator

      keyBindTables.AddKeyBinding "C", "run /home/ashkolnik/svhome/EE_WDIR/Alexandres/Scripts/Copy_object.vbs", BindCommand, BindAccelerator

      keyBindTables.AddKeyBinding "M", "run /home/ashkolnik/svhome/EE_WDIR/Alexandres/Scripts/Move_object.vbs", BindCommand, BindAccelerator

      ' Add type library so that we can use BindCommand and BindAccelerator constants.

       

      Scripting.AddTypeLibrary("MGCSDD.KeyBindings")

      ' Get the application object

       

       

      Dim pcbApp

       

       

      Set pcbApp = Application

       

      ' Get the document key bind table

       

       

      Dim keyBindTable

       

       

      Set keyBindTable = pcbApp.Gui.Bindings("Document")

       

      ' Map to number keys to the change layer keyin command.

       

       

      keyBindTable.AddKeyBinding "1", "cl 1", BindCommand, BindAccelerator

      keyBindTable.AddKeyBinding "2", "cl 2", BindCommand, BindAccelerator

      keyBindTable.AddKeyBinding "3", "cl 3", BindCommand, BindAccelerator

      keyBindTable.AddKeyBinding "4", "cl 4", BindCommand, BindAccelerator

      keyBindTable.AddKeyBinding "5", "cl 5", BindCommand, BindAccelerator

      keyBindTable.AddKeyBinding "6", "cl 6", BindCommand, BindAccelerator

      keyBindTable.AddKeyBinding "7", "cl 7", BindCommand, BindAccelerator

      keyBindTable.AddKeyBinding "8", "cl 8", BindCommand, BindAccelerator

      keyBindTable.AddKeyBinding "9", "cl 9", BindCommand, BindAccelerator

      keyBindTable.AddKeyBinding "0", "cl 10", BindCommand, BindAccelerator

      keyBindTable.AddKeyBinding "Ctrl+1", "cl 11", BindCommand, BindAccelerator

      keyBindTable.AddKeyBinding "Ctrl+2", "cl 12", BindCommand, BindAccelerator

      keyBindTable.AddKeyBinding "Ctrl+3", "cl 13", BindCommand, BindAccelerator

      keyBindTable.AddKeyBinding "Ctrl+4", "cl 14", BindCommand, BindAccelerator

      keyBindTable.AddKeyBinding "Ctrl+5", "cl 15", BindCommand, BindAccelerator

      keyBindTable.AddKeyBinding "Ctrl+6", "cl 16", BindCommand, BindAccelerator

      keyBindTable.AddKeyBinding "Ctrl+7", "cl 17", BindCommand, BindAccelerator

      keyBindTable.AddKeyBinding "Ctrl+8", "cl 18", BindCommand, BindAccelerator

      keyBindTable.AddKeyBinding "Ctrl+9", "cl 19", BindCommand, BindAccelerator

      keyBindTable.AddKeyBinding "Ctrl+0", "cl 20", BindCommand, BindAccelerator

       

      keyBindTable.AddKeyBinding ";", "hs", BindCommand, BindAccelerator

      keyBindTable.AddKeyBinding ".", "onh", BindCommand, BindAccelerator

      keyBindTable.AddKeyBinding "/", "ona", BindCommand, BindAccelerator

      keyBindTable.AddKeyBinding "'", "us", BindCommand, BindAccelerator

       

      -----------------------------------------------------------------------------------------------------------------------------------------------

      Does this kind of file excict in Cell Editor ?

      If no , how i can make one ?

      Thanks.