Start a new topic

Python script via Plugin

Original Post by: Sat Sep 19 08:12:49 2015


Hi,


is it possible to call python scripts via plugin made in c. Like an interface with buttons to call different scripts?


Original Post by: ChrisRogers Mon Sep 21 15:43:45 2015


No, it is not yet possible to call a script using OpenFlight API's C bindings. However if you are looking to call scripts easier (why I assume you are adding them to a UI) There are two things that may help you out.


The first is in Creator 15, we have added the ability to assign keyboard shortcuts to call scripts, and the ability to drag them onto your ribbon. This alone will probably get you what you are looking for.


The second (in case the first addition is not quite what you wanted) is a link to a similar thread asking for the ability to create UI in scripts.

support/discussions/topics/1792

Original Post by: SteveThompson Mon Sep 21 16:19:32 2015


As Chris suggests, you cannot call Python scripts via the OpenFlight API but Python itself provides the facility to do this. Check the Python documentation for PyRun_SimpleFile, PyRun_SimpleString, etc. These are the same functions that Creator uses to run your scripts, btw.


And even though you cannot assign scripts to buttons in your dialog, you can assign scripts to menu items in the Creator main menu. Chris mentions that in the next version (Creator 15, available soon) you will be able to assign keyboard shortcuts to these items and put them (also) into the Creator ribbon. Note that you can put your scripts in Creator's main menu NOW with the current and past versions. You don't have to wait for the next version to do this.


Check the Creator Help topic:

OpenFlight Script : Adding scripts to Creator user interface

for more information on how to access your scripts from the Creator main menu.

Login to post a comment