AppleScript Macro randomly launches VLC player

Hello there,
I just ran into the strangest of problems when I was working on some AppleScript that deals with VLC and I think this must be some sort of bug. I have managed to break down the problem into the simplest macro.

Consider this macro:


vlc_bug.kmmacros (1.4 KB)

As you can see, it should simply return 1 and leave VLC alone, as the else condition will never be true. The problem: Whenever I run this macro (or any macro with an AppleScript mentioning VLC), it returns 1 and it launches VLC.

Why?

This happens both in KM 7 and KM 6. In KM 6 however (where I ran into this problem initially) it gets even stranger: Even selecting this macro in the KM Editor, without running it, launches VLC (which btw. does not happen, when the AppleScript action is collapsed).

So, I have no idea, what's going on. Is this some sort of pre-compiling causing VLC to launch? (I have no idea really what pre-compiling is ...) This does not happen with other apps that are used in AS in the same way and it also does not happen, when I use the same script in the AppleScript Editor for example.

Does anybody know, what is going on and how I can avoid VLC launching?

Thanks!
trych

I believe this is solely an AppleScript issue. There are some apps, that when the script using that app is compiled, or even opened in some cases, will cause the app to launch if it is not running. Evidently VLC is one of these apps.

You can sometimes avoid this issue by not explicitly using the app in an application statement.

--- SO, INSTEAD of this ---
tell application "VLC" to play

--- USE THIS ---
set myApp to "VLC"
tell application myApp to play

This won't always work, but it is worth a try.
I don't have the VLC app, so I can't test.