I would like to control some aspects of IDEA's operation from a script (either a stock shell script or AppleScript, since I'm on Mac OS X). My requirements are pretty simple: Launch the app, if necessary. Open a project and open some source files within that project.
So far, I've found that the I can launch the app (using the OS X built-in "open" command), open a project (by directly invoking the app launcher with the parent directory of the project's .idea subdirectory as an argument).
I can also open source files in the same way, by invoking the IDEA launcher once for each file I wish to open. Owing to its size, the time it takes to invoke the IDEA launcher is considerable, so opening more than a handful of files can take a long time.
There is also the OpenInIDEA plug-in which can open source files (but not projects). It is somewhat faster than using the IDEA launcher to open files.
While the IDEA launcher will open files in the front-most project window, OpenInIDEA will present a pop-up requesting the user to select the project to use (if more than one is open). Both of these will allow on only one file per invocation.
Additionally, timing can be an issue. If the app is not running, then the time required to launch it must be taken into account. Merely waiting until the appropriate process(es) are running is inadequate, since much initialization processing is performed by IDEA when it first starts up. A similar issue arises between opening a project and opening files within it.
All in all, trying to achieve even rudimentary scripting control over IDEA using these mechanism is problematic.
Is there a better way??