


{"id":162531,"date":"2021-09-24T09:54:37","date_gmt":"2021-09-24T09:54:37","guid":{"rendered":"\/forum\/forums\/topic\/how-to-run-script-to-workbench-without-manually-clicking-file-run-script\/"},"modified":"2021-09-24T17:31:29","modified_gmt":"2021-09-24T17:31:29","slug":"how-to-run-script-to-workbench-without-manually-clicking-file-run-script","status":"closed","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/how-to-run-script-to-workbench-without-manually-clicking-file-run-script\/","title":{"rendered":"How to Run script to workbench without manually clicking file => run script?"},"content":{"rendered":"<div class=\"Item-Body\">\n<div class=\"Message userContent\">\n<p>I&#039;m trying to make a python script that opens a saved workbench project and passes a command to workbench. The algorithm is simple as follows;<\/p>\n<p>import os<\/p>\n<p>import time<\/p>\n<p>os.startfile(&quot;C:\/Users\/firas\/OneDrive\/Bureau\/BlankMesher\/Ansys_mesher.wbpj&quot;) #opens a saved workbench project<\/p>\n<p>workbench_script = &quot;E:\/Blank generator\/Ansys_mesher\/GeoChngWorkbench.py&quot; #the path of the workbench file to run in workbench<\/p>\n<p>RunScript(FilePath=&quot;E:\/Blank generator\/Ansys_mesher\/GeoChngWorkbench.py&quot;) <\/p>\n<p>The &quot;RunScript&quot; command was obtained when I recorded the manual operation, but when I run python it says &quot;RunScript&quot; not defined because the scope of the action is not well determined and python needs to know that it is applied to Ansys.<\/p>\n<p>Any idea on how to correct this?<\/p>\n<p>Tnx,<\/p>\n","protected":false},"template":"","class_list":["post-162531","topic","type-topic","status-closed","hentry","topic-tag-macros-scripting-2","topic-tag-scripting-journaling-udf-2"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_bbp_author_ip":[""],"_bbp_view_count":["296"],"_bbp_likes_count":["0","0"],"_bbp_forum_subforum_count":["0"],"_btv_view_count":["6589"],"_bbp_subscription":["241232"],"_bbp_topic_status":["unanswered"],"_bbp_status":["publish"],"_bbp_topic_id":["162531"],"_bbp_forum_id":["27791"],"_bbp_engagement":["58821","166571"],"_bbp_voice_count":["2"],"_bbp_reply_count":["6"],"_bbp_last_reply_id":["193039"],"_bbp_last_active_id":["193039"],"_bbp_last_active_time":["2021-09-24 17:31:29"]},"test":"sirusblack07"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/162531","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics"}],"about":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/162531\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=162531"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}