2

I am working on an application that the user may wish to automate some features of (but we don't know what at the moment) I would like to provide them some kind of scripting interface so they can play with application more freely.

To me the best scenario would be to allow them to write python scripts and use functions within the application almost as a library.

However the application would need to be running as the resulting output would be best displayed in the application itself.

So I am aiming for something similar to macros within office etc but I think it would be awesome if they could use python for this.

I am thinking it would use some sort of standard input piping. Perhaps the "macro runner" could launch the C# application and then use stdinput to communicate?

More concise detail

  1. The application is a data visualization tool
  2. It is a windows desktop application (currently it does no interaction with servers etc)
  3. I want to be able to send it scripts while the application is running
  4. I don't want to restart the application for each script
  5. Preferably you would have the choice of running one command after the other or sending a full script (Something like a command window you could send scripts to)
  6. Sending a script or even multiple scripts should be fully automatable (i.e. runnable from batch scripts/build server etc.
  • The best way to ensure the application is running is to make the action of invoking a macro/script part of the application's interface. Either the application contains an interpreter or it starts an external interpreter and provides a inter-process communication mechanism to communicate with the script (this could be stdin/stdout of the script). – Bart van Ingen Schenau Mar 12 '15 at 11:15
  • 5
    "A 3 minute guide to embedding IronPython in a C# application": secretgeek.net/host_ironpython. Found in 30 seconds by googling for "embed python in c# program" – Doc Brown Mar 12 '15 at 11:52
  • What is your app trying to achieve that couldn't be achieved with a RESTful web service? – pdr Mar 12 '15 at 12:47
  • @pdr I'm not sure this is even a web-hosted app... But yes, Doc's right, IronPython is almost definitely what you're looking for. – Katana314 Mar 12 '15 at 13:50
  • @DocBrown That's definitely a big piece of the puzzle (I never thought to call it "embed"!) :p. I can see how this would work from an embedded separate form sense. Is there anyway I can set it up further so that an external program could send python scripts to my application? I suppose it could send the script as an argument? whats the typical practice for going beyond that? I assume setting my app up as some kind of server? – chrispepper1989 Mar 12 '15 at 15:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.