I’ve been trying to write an applescript droplet with XCode, and it keeps crashing. I don’t think my code is buggy (it is very simple). All that is necessary is to create a new applescript droplet (New Project… → applescript droplet) and replace “on open names” with the following code:
on open names
do shell script "ls"
--or any shell script command will do
end open
Build it, then drag any file to the application. I get an application crash. Does anyone else experience this, or is there something wrong with my setup?
For information, the backtrace is:
Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x00000000
Thread 0 Crashed:
0 <<00000000>> 0x00000000 0 + 0
1 com.apple.AppleScriptKit 0x7f776f88 -[ASKApplicationOpenEventHandler handleAppleEvent:withReplyEvent:] + 0x7c
2 com.apple.Foundation 0x90a4a9d0 -[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] + 0x164
3 com.apple.Foundation 0x90a510b4 _NSAppleEventManagerGenericHandler + 0x78
4 com.apple.AE 0x91674a68 aeDispatchAppleEvent(AEDesc const*, AEDesc*, unsigned long, unsigned char*) + 0xd0
5 com.apple.AE 0x916778b0 dispatchEventAndSendReply(AEDesc const*, AEDesc*) + 0x2c
6 com.apple.AE 0x91674ca8 aeProcessAppleEvent + 0x11c
7 com.apple.HIToolbox 0x928c47bc AEProcessAppleEvent + 0x3c
8 com.apple.AppKit 0x92dd2790 _DPSNextEvent + 0x358
9 com.apple.AppKit 0x92de8f34 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 0x74
10 com.apple.AppKit 0x92dfd27c -[NSApplication run] + 0x21c
11 com.apple.AppKit 0x92eb95f0 NSApplicationMain + 0x1d0
12 ??? 0x00009164 main + 0x84 (main.m:20)
13 ??? 0x00008e10 _start + 0x188 (crt.c:267)
14 ??? 0x00008c84 start + 0x30
Thanks
Yan