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.
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.
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.
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:
- I found some of the capabilities I’ve used previous not working – so need to find out which
- 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.
- I tried using the EA Dialogue and that didn’t work
- 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.