• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Allegro X Scripting - TCL
  3. How to use tcl script to add a menu bar in OrCAD Capture...

Stats

  • Replies 1
  • Subscribers 13
  • Views 5448
  • Members are here 0
More Content

How to use tcl script to add a menu bar in OrCAD Capture V16.5?

Ruesun
Ruesun over 3 years ago

Hi,

I want to add a menu bar like this:

menu bar

I have tried such a script:

  

namespace eval ::dgo_menu {

proc RegisterActions { args } {
catch {

RegisterAction "dgo_menu_PM_1" "::dgo_menu::shouldProcess" "Alt+F" "::dgo_menu::dgo_menuMePM" "PM"
RegisterAction "dgo_menu_PM_2" "::dgo_menu::shouldProcess" "Alt+F1" "::dgo_menu::dgo_menuMePM" "PM"
RegisterAction "dgo_menu_PM_3" "::dgo_menu::shouldProcess" "Alt+F2" "::dgo_menu::dgo_menuMePM" "PM"
RegisterAction "dgo_menu_PM_4" "::dgo_menu::shouldProcess" "Shift+Z" "::dgo_menu::dgo_menuMePM" "PM"

RegisterAction "dgo_menu_SCM_1" "::dgo_menu::shouldProcess" "Alt+F" "::dgo_menu::dgo_menuMeSCM" "SCHEMATIC"
RegisterAction "dgo_menu_SCM_2" "::dgo_menu::shouldProcess" "Alt+F1" "::dgo_menu::dgo_menuMeSCM" "SHEMATIC"
RegisterAction "dgo_menu_SCM_3" "::dgo_menu::shouldProcess" "Alt+F2" "::dgo_menu::dgo_menuMeSCM" "SCHEMATIC"
RegisterAction "dgo_menu_SCM_4" "::dgo_menu::shouldProcess" "Shift+Z" "::dgo_menu::dgo_menuMeSCM" "SCHEMATIC"

InsertXMLMenu [list [list "DgoMenu"] "" "" [list "popup" "DGO TCL" "" "" "" "" ""] ""]

InsertXMLMenu [list [list "DgoMenu" "Lev_1_1"] "" "" [list "popup" "Lev_1_1" "" "" "" "" ""] ""]
InsertXMLMenu [list [list "DgoMenu" "Lev_1_2"] "" "" [list "popup" "Lev_1_2" "" "" "" "" ""] ""]

InsertXMLMenu [list [list "DgoMenu" "Lev_1_1" "Lev_1_1_1"] "" "" [list "action" "&menu1" "0" "ActionForMenu1" "Enable_forMenu1" "Ctrl+Z" "" "" "This is my menu dgo_menu2"] ""]
InsertXMLMenu [list [list "DgoMenu" "Lev_1_1" "Lev_1_1_2"] "" "" [list "action" "&menu2" "0" "ActionForMenu1" "Enable_forMenu1" "Shift+B" "" "" "This is my menu dgo_menu2"] ""]
InsertXMLMenu [list [list "DgoMenu" "Lev_1_1" "Lev_1_1_3"] "" "" [list "action" "&menu3" "0" "ActionForMenu1" "Enable_forMenu1" "Shift+X" "" "" "This is my menu dgo_menu2"] ""]

InsertXMLMenu [list [list "DgoMenu" "Lev_1_2" "Lev_1_2_1"] "" "" [list "action" "&menu4" "0" "ActionForMenu1" "Enable_forMenu1" "Shift+Q" "" "" "This is my menu dgo_menu2"] ""]
InsertXMLMenu [list [list "DgoMenu" "Lev_1_2" "Lev_1_2_2"] "" "" [list "action" "&menu5" "0" "ActionForMenu1" "Enable_forMenu1" "Ctrl+F" "" "" "This is my menu dgo_menu2"] ""]
InsertXMLMenu [list [list "DgoMenu" "Lev_1_2" "MySeparator1"] "1" "MyFileLevelAction1" [list "separator"] ""]
InsertXMLMenu [list [list "DgoMenu" "Lev_1_2" "Lev_1_2_3"] "" "" [list "action" "&menu6" "0" "ActionForMenu1" "Enable_forMenu1" "Alt+F" "" "" "This is my menu dgo_menu2"] ""]

RegisterAction "ActionForMenu1" "::dgo_menu::shouldProcess" "" "::dgo_menu::dgo_menuActionProc1" ""
RegisterAction "Enable_forMenu1" "::dgo_menu::shouldProcess" "" "::dgo_menu::dgo_menuEnablerProc1" ""
RegisterAction "ActionForMenu2" "::dgo_menu::shouldProcess" "" "::dgo_menu::dgo_menuActionProc2" ""
RegisterAction "Enable_forMenu2" "::dgo_menu::shouldProcess" "" "::dgo_menu::dgo_menuEnablerProc2" ""
}
}
proc shouldProcess { args } {
return 1
}
proc shouldProcess1 { args } {
return 0
}

proc dgo_menuMePM { args } {
puts "CALLED FROM PM WINDOW"
}

proc dgo_menuMeSCM { args } {
puts "CALLED FROM SCHEMATICS"
}

proc dgo_menuActionProc1 { args } {
puts "CALLED FROM MAIN MENU"
}

proc dgo_menuEnablerProc1 { args } {
#puts "dgo_menuEnablerProc1"
return true
}

}
::dgo_menu::RegisterActions
puts "loaded ::dgo_menu::RegisterActions"

This tcl script loading successfully,but the menu does not appear on the Capture.

Can anyone help me with this problem?

Thanks!

  • Cancel
  • Sign in to reply
  • oldmouldy
    oldmouldy over 3 years ago

    Fullscreen 6557.TestRegisterMenuTest_tcl.txt Download
    namespace eval ::test {
    
    proc registerMenuActions { args } {
    	catch {
    		RegisterAction "testMenu_PM_1" "::test::shouldProcess" "Alt+F" "::test::testMePM" "PM"
    		RegisterAction "testMenu_PM_2" "::test::shouldProcess" "Alt+F1" "::test::testMePM" "PM"
    		RegisterAction "testMenu_PM_3" "::test::shouldProcess" "Alt+F2" "::test::testMePM" "PM"
    		RegisterAction "testMenu_PM_4" "::test::shouldProcess" "Shift+Z" "::test::testMePM" "PM"
    		RegisterAction "testMenu_SCM_1" "::test::shouldProcess" "Alt+F" "::test::testMeSCM" "SCHEMATIC"
    		RegisterAction "testMenu_SCM_2" "::test::shouldProcess" "Alt+F1" "::test::testMeSCM" "SHEMATIC"
    		RegisterAction "testMenu_SCM_3" "::test::shouldProcess" "Alt+F2" "::test::testMeSCM" "SCHEMATIC"
    		RegisterAction "testMenu_SCM_4" "::test::shouldProcess" "Shift+Z" "::test::testMeSCM" "SCHEMATIC"
    		InsertXMLMenu [list [list "MyFile1"] "" "" [list "popup" "MyFileTest1" "" "" "" "" ""] ""]
    		InsertXMLMenu [list [list "MyFile1" "MyFileLevelpopup1"] "" "" [list "popup" "MyFileLevel11" "" "" "" "" ""] ""]
    		InsertXMLMenu [list [list "MyFile1" "MyFileLevelpopup1" "MyFileLevelAction2"] "" "" [list "action" "&menu1" "0" "ActionForMenu1" UpdateForMenu1" "Ctrl+Z" "" "" "This is my menu test2"] ""]
    		InsertXMLMenu [list [list "MyFile1" "MyFileLevelpopup1" "MyFileLevelAction3"] "" "" [list "action" "&menu2" "0" "ActionForMenu1" "UpdateForMenu1" "Shift+B" "" "" "This is my menu test2"] ""]
    		InsertXMLMenu [list [list "MyFile1" "MyFileLevelpopup1" "MyFileLevelAction4"] "" "" [list "action" "&menu3" "0" "ActionForMenu1" "UpdateForMenu1" "Shift+X" "" "" "This is my menu test2"] ""]
    		InsertXMLMenu [list [list "MyFile1" "MyFileLevelpopup1" "MySeparator1"] "1" "MyFileLevelAction1" [list "separator"] ""]
    		InsertXMLMenu [list [list "MyFile1" "MyFileLevelpopup1" "MyFileLevelAction8"] "" "" [list "action" "&menu6" "0" "ActionForMenu1" "UpdateForMenu1" "Shift+Q" "" "" "This is my menu test2"] ""]
    		InsertXMLMenu [list [list "MyFile1" "MyFileLevelpopup1" "MyFileLevelAction9"] "" "" [list "action" "&menu7" "0" "ActionForMenu1" "UpdateForMenu1" "Ctrl+F" "" "" "This is my menu test2"] ""]
    		InsertXMLMenu [list [list "MyFile1" "MyFileLevelpopup1" "MyFileLevelAction11"] "" "" [list "action" "&menu9" "0" "ActionForMenu1" "UpdateForMenu1" "Alt+F" "" "" "This is my menu test2"] ""]
    		RegisterAction "ActionForMenu1" "::test::shouldProcess" "" "::test::testActionProc1" ""
    		RegisterAction "UpdateForMenu1" "::test::shouldProcess" "" "::test::testUpdateProc1" ""
    		RegisterAction "ActionForMenu2" "::test::shouldProcess" "" "::test::testActionProc2" ""
    		RegisterAction "UpdateForMenu2" "::test::shouldProcess" "" "::test::testUpdateProc2" ""
    	}
    }
    
    proc shouldProcess { args } {
    	return 1
    }
    
    proc shouldProcess1 { args } {
    	return 0
    }
    
    proc testMePM { args } {
    	puts "CALLED FROM PM WINDOW"
    }
    proc testMeSCM { args } {
    	puts "CALLED FROM SCHEMATICS"
    }
    proc testActionProc1 { args } {
    	puts "CALLED FROM MAIN MENU"
    }
    proc testUpdateProc1 { args } {
    	return true
    }
    }
    ::test::registerMenuActions
    
        It looks like you have hacked the Cadence OrCAD Capture TCL custom menu sample, text attached. This version works so you should be able to resolve the issue from that. Also, you are using 16.6 and not 16.5. (In any case neither 16.5, nor 16.6, Releases are supported by Cadence now)

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Cadence Guidelines

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information