EJS logo

Hello, dear reader! Just a heads up that this article is deprecated and (probably) not worthy of your time. You are, of course, very welcome to read it — but I personally consider it to be outdated / irrelevant / embarrassing, and have removed it from my blog archive listings. Really, it’s only still here to stop old links from breaking. You have been warned!

Enhanced CD Blues

Article illustration

As we all know, even the simplest projects can turn out to be extremely complex, and this unnecessary complexity is most usually caused by one very small aspect; a miniscule but deadly fly swimming in your ointment labeled ‘Project’.

Such a scenario reared its head today whilst I was trying to create a simple Flash-based menu for an Enhanced CD. Sanctuary have a Flash projector template for ECDs that they deploy for each project with only a couple of minor adjustments (namely, the FLV file and the accompanying CD artwork that serves as a backdrop to the video player). However, this ECD (for The Cooper Temple Clause’s single ‘Waiting Game’) needed a further modification due to the inclusion of the U-MYX app: rather than auto-running (on a PC) the projector file, a new menu should be displayed: one offering the choice of launching a) U-MYX, or b) the Flash projector containing the video. Sounds simple enough, eh? I designed an icon for the video player and made the menu in Flash:

Before anything else, fscommand was used to make the projector appear fullscreen but not resize. I placed the following code on frame 1:

fscommand(“fullscreen”, true);
fscommand(“allowscale”, false);
After sorting this out, the first real problem I ran into is that using getURL actions on the buttons causes the unnecessary opening of browsers, so I called on good ol’ fscommand again to launch the applications instead:

on (release) {
fscommand (“exec”, “projectorName.exe”);
}
Now, that should’ve worked. And it did, when launching the Flash projector containing the music video, but not at all when attempting to launch the U-MYX app. Has anyone got any ideas why?!? According to this technote from Adobe, this technique should be able to launch any application, but it failed to launch anything besides the projectors… on both Mac and PC.

To get round the problem, someone suggested I get Flash to launch a batch file (.bat) containing a script to auto-launch the U-MYX application. Launching a text file to launch an app seemed like a long, roundabout way of doing it, but it also turned out to be the only option that worked, so I wrote ‘pcScript.bat’, which simply contained one line: U-MYX.exe

Problem solved on Windows, but what about Macs? As hinted at in the technote, AppleScript was needed. Now, I’ve never written Applescript before, and although the syntax is extremely simple, one thing that immediately had me confused was the fact that you need to open a script and then manually hit the ‘run’ button for something to actually happen. This was particularly annoying, as I’d written a script that worked at that level but had no way of getting Flash to run it automatically.

tell application “U-MYX-player”
activate
open file “the_cooper_temple_clause#16.umx”
end tell
After some scurrying around online and in the AppleScript Help menu, I finally found the (extremely simple) solution: to save the script as an application. Ok, ok, you can stop laughing now – the reason I didn’t try this before was because I didn’t expect it to work; after all, U-MYX is an application too, right? And that just wouldn’t launch. However, for whatever reason, an AppleScript app is different to a normal one, and it worked like a charm… although I’m still stuck into this silly launching-an-application-to-launch-an-application routine.

Surely there must be another way… anyone?