Applescript droplet works fine on one machine, does nothing on another.

hbquikcomjamesl

Registered
This droplet (with a "display dialog" added for debugging purposes) works just fine on my new Mac Mini, but does nothing on my colleague's MacBook Pro, other than maybe make the dock quiver slightly (it doesn't even show the dialog!):

Code:
on open foo
	repeat with bar in foo
		set {tid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, ":"}
		set baz to text items of (bar as string)
		set AppleScript's text item delimiters to "/"
		set qux to baz as text
		set AppleScript's text item delimiters to tid
		
		display dialog "java -jar /Applications/Emulator/EmulatorLauncher.jar \"/Applications/Emulator/emulator.jar\" \"/Volumes/" & qux & "\""
		
		do shell script "java -jar /Applications/Emulator/EmulatorLauncher.jar \"/Applications/Emulator/emulator.jar\" \"/Volumes/" & qux & "\""
	end repeat
end open

I'm on Mountain Lion (10.8.1); he's also on Mountain Lion (10.8.2); the droplet was originally generated by AppleScript Editor on (probably) a somewhat older OS release, and up until today, I hadn't done anything since the original version (that WAS working on his MacBook) other than tweak the Info.plist:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>CFBundleAllowMixedLocalizations</key>
	<true/>
	<key>CFBundleDevelopmentRegion</key>
	<string>English</string>
	<key>CFBundleDocumentTypes</key>
	<array>
		<dict>
			<key>CFBundleTypeExtensions</key>
			<array>
				<string>5250s</string>
				<string>5250</string>
			</array>
			<key>CFBundleTypeOSTypes</key>
			<array>
				<string>****</string>
			</array>
			<key>CFBundleTypeRole</key>
			<string>Viewer</string>
                        <key>CFBundleTypeIconFile</key>
                        <string>IBM3487HA</string>
		</dict>
	</array>
	<key>CFBundleExecutable</key>
	<string>droplet</string>
	<key>CFBundleIconFile</key>
	<string>IBM3487</string>
	<key>CFBundleIdentifier</key>
	<string>com.apple.ScriptEditor.id.EmuScript</string>
	<key>CFBundleInfoDictionaryVersion</key>
	<string>6.0</string>
	<key>CFBundleName</key>
	<string>EmuScript</string>
	<key>CFBundlePackageType</key>
	<string>APPL</string>
	<key>CFBundleSignature</key>
	<string>dplt</string>
	<key>LSMinimumSystemVersionByArchitecture</key>
	<dict>
		<key>x86_64</key>
		<string>10.6</string>
	</dict>
	<key>LSRequiresCarbon</key>
	<true/>
	<key>WindowState</key>
	<dict>
		<key>dividerCollapsed</key>
		<false/>
		<key>eventLogLevel</key>
		<integer>-1</integer>
		<key>name</key>
		<string>ScriptWindowState</string>
		<key>positionOfDivider</key>
		<real>333</real>
		<key>savedFrame</key>
		<string>56 124 602 597 0 0 1680 1028 </string>
		<key>selectedTabView</key>
		<string>event log</string>
	</dict>
</dict>
</plist>

Help?
 
Your script mentions java.
Java is not a default install in OS X, so you may have different versions of java installed (or not installed at all)

You can go to this page to see what java version is reported by your browser - http://www.java.com/en/download/installed.jsp
A recent version of java will also have a settings pane in your System Preferences - if you have it installed.
You can open that pane, and check that java is up to date - or at least the same version active on both of your Macs.
 
We're a software company, and every box in the building has Java.

On the "problem" MacBook, the script doesn't even get as far as displaying the dialog I added for debugging purposes.

Yet if I type the command line being fed to the "do shell script" (or displayed in the dialog) into a terminal window on the "problem" MacBook, it works perfectly.
 
I've now run a couple of test AppleScript apps (not droplets) on my colleague's computer.

A script app successfully opened a dialog with a test message.

And a script app successfully opened a hard-coded version of the "do shell script" in the failing droplet.

So it's fairly clear that the droplet processing is what's failing.

Here is something interesting: If I drop the document (a terminal emulation definition) into the droplet (which launches a terminal emulation session using emulator.jar and EmulatorLauncher.jar) where it resides, about 4 folders deep on a network drive, it works perfectly. If I drop the same document into the local copy of the droplet, I get nothing but a brief quiver of the dock.

I brought up the Console, and tried it again. When it failed, I got this message:

12/14/12 2:48:02.895 PM com.apple.launchd.peruser.501[133]: ([0x0-0xc4ec4e].com.apple.ScriptEditor.id.EmuScript[19558]) Job failed to exec(3) for weird reason: 13

EmuScript is the original name of the script that launches the emulation session, and it's still called that in the Info.plist. But within the droplet's inner structure, it's called "Contents/Resources/Scripts/main.scpt"

Helloa, what's this? "Weird reason 13" = authority issue! "chmod a+x" Interesting! That was it!
 
Last edited:
Back
Top