{"id":181956,"date":"2024-03-20T09:30:59","date_gmt":"2024-03-20T09:30:59","guid":{"rendered":"\/knowledge\/?post_type=topic&#038;p=181956"},"modified":"2024-03-21T05:54:33","modified_gmt":"2024-03-21T05:54:33","slug":"publishing-scripts-to-the-ribbon-with-an-icon","status":"publish","type":"topic","link":"https:\/\/innovationspace.ansys.com\/knowledge\/forums\/topic\/publishing-scripts-to-the-ribbon-with-an-icon\/","title":{"rendered":"Publishing Scripts to the Ribbon with an Icon"},"content":{"rendered":"<p>You can publish a script to create a tool button in the ribbon so that it can be used in any project.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-181957 aligncenter\" src=\"\/knowledge\/wp-content\/uploads\/sites\/4\/2024\/03\/Publish-script.png\" alt=\"\" width=\"521\" height=\"400\" srcset=\"https:\/\/innovationspace.ansys.com\/knowledge\/wp-content\/uploads\/sites\/4\/2024\/03\/Publish-script.png 521w, https:\/\/innovationspace.ansys.com\/knowledge\/wp-content\/uploads\/sites\/4\/2024\/03\/Publish-script-300x230.png 300w, https:\/\/innovationspace.ansys.com\/knowledge\/wp-content\/uploads\/sites\/4\/2024\/03\/Publish-script-24x18.png 24w, https:\/\/innovationspace.ansys.com\/knowledge\/wp-content\/uploads\/sites\/4\/2024\/03\/Publish-script-36x28.png 36w, https:\/\/innovationspace.ansys.com\/knowledge\/wp-content\/uploads\/sites\/4\/2024\/03\/Publish-script-48x37.png 48w\" sizes=\"auto, (max-width: 521px) 100vw, 521px\" \/><\/p>\n<p>1. Write a script or Click the\u00a0<span class=\"uicontrol\"><b class=\"ph uicontrol\">Record <\/b><\/span><img decoding=\"async\" id=\"c_scripteditor_recording__image_x12_3sf_bqb\" class=\"image\" src=\"https:\/\/ansyshelp.ansys.com\/Views\/Secured\/corp\/v241\/en\/discovery\/UDA\/user_manual\/scripting\/topics\/images\/i_icon_scripteditor_record.png\" \/>\u00a0icon to record scriptable actions in\u00a0<span class=\"keyword\">Discovery<\/span>, which are then written as code in the Script Editor.<br \/>\n2. Click the <strong>Publish Script<\/strong> icon. The <strong>Publish Script<\/strong> dialog appears. (Note: Click the\u00a0<span class=\"uicontrol\"><b class=\"ph uicontrol\">Embed Script\u00a0<\/b><\/span><img decoding=\"async\" id=\"c_scripteditor_embed_script__image_wsb_lbh_1rb\" class=\"image\" src=\"https:\/\/ansyshelp.ansys.com\/Views\/Secured\/corp\/v241\/en\/discovery\/UDA\/user_manual\/scripting\/topics\/images\/i_icon_scripteditor_embedscript.png\" \/> icon into the Discovery project. Once a script is embedded, it remains embedded when you Save\/Resume the model.)<br \/>\n3. Enter a <strong>Name<\/strong> and <strong>Tooltip<\/strong>.<br \/>\n4. (Optional) Enter <strong>Tab name<\/strong> and <strong>Group name<\/strong> for script location in the ribbon. Note: Scripts cannot be added to existing Discovery tabs so existing Tab names are not available.<br \/>\n5. For <strong>Icon path<\/strong>, enter a path to the icon, or browse to select the icon.<\/p>\n<p>Image will appear as an icon for the script tool. (Note: Image size should be limited to 32*32pixel)<\/p>\n<p>6. (Optional) Choose <strong>Password-protected copy<\/strong> if you want to hide the script contents.<br \/>\n7. Click <strong>OK<\/strong>.<\/p>\n<p class=\"p\">The tool is added to the chosen\u00a0<span style=\"box-sizing: inherit;\"><span class=\"uicontrol\"><b style=\"box-sizing: inherit; line-height: inherit;\">Tab<\/b><\/span><\/span>\u00a0and\u00a0<span style=\"box-sizing: inherit;\"><span class=\"uicontrol\"><b style=\"box-sizing: inherit; line-height: inherit;\">Group<\/b><\/span><\/span>\u00a0on the\u00a0<span style=\"box-sizing: inherit;\"><span class=\"uicontrol\"><b style=\"box-sizing: inherit; line-height: inherit;\">Ribbon<\/b><\/span><\/span>. Once a script is published, it can be edited or removed by selecting the\u00a0<span style=\"box-sizing: inherit;\"><span class=\"uicontrol\"><b style=\"box-sizing: inherit; line-height: inherit;\">Edit Script<\/b><\/span><\/span>\u00a0or\u00a0<span style=\"box-sizing: inherit;\"><span class=\"uicontrol\"><b style=\"box-sizing: inherit; line-height: inherit;\">Remove<\/b><\/span><\/span>\u00a0option on the\u00a0<span style=\"box-sizing: inherit;\"><span class=\"uicontrol\"><b style=\"box-sizing: inherit; line-height: inherit;\">Ribbon<\/b><\/span><\/span>\u00a0if it is not protected.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-181958 aligncenter\" src=\"\/knowledge\/wp-content\/uploads\/sites\/4\/2024\/03\/Published-Script.png\" alt=\"\" width=\"1282\" height=\"189\" srcset=\"https:\/\/innovationspace.ansys.com\/knowledge\/wp-content\/uploads\/sites\/4\/2024\/03\/Published-Script.png 1431w, https:\/\/innovationspace.ansys.com\/knowledge\/wp-content\/uploads\/sites\/4\/2024\/03\/Published-Script-300x44.png 300w, https:\/\/innovationspace.ansys.com\/knowledge\/wp-content\/uploads\/sites\/4\/2024\/03\/Published-Script-1024x151.png 1024w, https:\/\/innovationspace.ansys.com\/knowledge\/wp-content\/uploads\/sites\/4\/2024\/03\/Published-Script-768x113.png 768w, https:\/\/innovationspace.ansys.com\/knowledge\/wp-content\/uploads\/sites\/4\/2024\/03\/Published-Script-24x4.png 24w, https:\/\/innovationspace.ansys.com\/knowledge\/wp-content\/uploads\/sites\/4\/2024\/03\/Published-Script-36x5.png 36w, https:\/\/innovationspace.ansys.com\/knowledge\/wp-content\/uploads\/sites\/4\/2024\/03\/Published-Script-48x7.png 48w\" sizes=\"auto, (max-width: 1282px) 100vw, 1282px\" \/><\/p>\n","protected":false},"template":"","class_list":["post-181956","topic","type-topic","status-publish","hentry","topic-tag-ansys-discovery","topic-tag-publish","topic-tag-record","topic-tag-script"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_edit_lock":["1711957579:77516"],"_edit_last":["77045"],"filter_by_optics_product":["Lumerical"],"_filter_by_optics_product":["field_64fb192ba3121"],"application_name":[""],"_application_name":["field_64a80903c8e15"],"family":[""],"_family":["field_64a809229a857"],"siebel_km_number":[""],"_siebel_km_number":["field_63ecbffce60db"],"salesforce_km_number":[""],"_salesforce_km_number":["field_63ecc018e60dc"],"km_published_date":[""],"_km_published_date":["field_64c77704499dd"],"product_version":[""],"_product_version":["field_64c776cb4fd2e"],"_bbp_forum_id":["159540"],"_bbp_topic_id":["181967"],"_bbp_author_ip":["96.7.218.222"],"_bbp_last_reply_id":["0"],"_bbp_last_active_id":["181959"],"_bbp_last_active_time":["2024-03-20 09:30:59"],"_bbp_reply_count":["0"],"_bbp_reply_count_hidden":["0"],"_bbp_voice_count":["0"],"_yoast_wpseo_content_score":["60"],"_yoast_wpseo_estimated-reading-time-minutes":["2"],"_btv_view_count":["1413"],"_bbp_likes_count":["1"]},"test":"articlesansys-com"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/knowledge\/wp-json\/wp\/v2\/topics\/181956","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/innovationspace.ansys.com\/knowledge\/wp-json\/wp\/v2\/topics"}],"about":[{"href":"https:\/\/innovationspace.ansys.com\/knowledge\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":8,"href":"https:\/\/innovationspace.ansys.com\/knowledge\/wp-json\/wp\/v2\/topics\/181956\/revisions"}],"predecessor-version":[{"id":181967,"href":"https:\/\/innovationspace.ansys.com\/knowledge\/wp-json\/wp\/v2\/topics\/181956\/revisions\/181967"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/knowledge\/wp-json\/wp\/v2\/media?parent=181956"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}