Question

I have made an Installer by PackageMaler3.0.6 on Mac OS 10.8. Also I have add a JavaScript function in Distribution,This function use for detect the certain App is running or not. Some code like this:

var allProcess = new Array();

allProcess = system.applications.all();

var allProcessCount = allProcess.length;

...

If I normally install (With Installer UI) this pkg on 10.8,10.7,10.5, it's Ok, all function works fine. If i use command line to silent install On 10.8,10.7 it's OK, no error. But if i silent install on 10.5.8, there will be an error in terminal(JavaScript error), can't install. If i remove the code of "var allProcessCount = allProcess.length;" It can silent install on 10.5.8, once if added the code like "allProcess.length" ,there will be an error,it looks like can't use the array property in silent install on 10.5, but 10.7,10.8 it's OK and install with UI it's also Ok on 10.5. Did anyone knows how can i slove this issue? Thanks!!!

Was it helpful?

Solution

Seems like a bug in macOS 10.5. Why don't you use system.applications.fromIdentifier(bundleId).

It provides information about running processes with a given application identifier (bundle ID). For example, com.apple.TextEdit.

Parameters

 bundleID:    A string with the bundle ID of the desired application.

Return Value

    An array of dictionaries (associative arrays) describing the
 running applications identified by bundleID.

Availability

Available in Mac OS X v10.4 and later.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top