Scripting follow up on case #5 – running an EA script from a windows application

A short follow up on one of the outstanding items from a previous post on scripting.

Thanks to quadrabyte for his feedback, including his code extract, which forced me to re-read what I had written, and which with hindsight wasn’t very clear; sorry to all those I may have confused.

When I set out the use case (#5) – “WinApp can run script within EA repository” – I was really thinking about a WinApp making a call to EA, through an api which would run a pre-defined script on my behalf.  This followed on from my idea that it could be useful to be able to run a script each time EA was started e.g.

>EA.exe /script="name"

This would allow a range of functions to be performed to help with the administration of my projects.  However, I couldn’t see a way of doing that with in a command line (anybody know?), but was there a way I could emulate the behaviour with a windows application that could start EA and run the script e.g.

myWinApp /script="name"

Well it was looking at the code quadrabyte provided that put me back on the straight and narrow, bringing me back to a world of logic from my roaming into fantasy solutions.  How could I have launch the EA UI and, in parallel, get it to perform functions for me.

However, it is clearly possible to have a windows application running a script – as outlined in previous posts  using its own ScriptControl.   Our windows application could open an EA repository, read and run a user script, provided we ensure that the required objects are initialised prior to running the script.

Although back in my fantasy world wouldn’t it be nice if EA would execute pre-defined scripts on start up, for example start of build scripts, workflow etc.  Perhaps it does and I haven’t found it or perhaps it’s another future feature.

In the meantime., thanks again to quadrabyte.

Adrian

PS: I’ll be following some other short posts on the other issues that were highlighted.

A little update:

Today I was having a quick look at what next and was reviewing some of my experiments with workflow scripts – and reminded myself that when an EA project is opened that EA will call the “Function GetWorkflowTasks” – and so why wouldn’t I use this to run my own scripts on startup?

A few quick tests:

  1. I found some of the capabilities I’ve used previous not working – so need to find out which
  2. Using a message box isn’t a good idea as I found it is hidden and not readily accessible. So probably not a good idea.
  3. I tried using the EA Dialogue and that didn’t work
  4. Accessing files seemed to work file

I would need to do a lot more checking to see what is available – but it does, in part, provide a means to address the task in hand.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s