Applescript support?

In a build of my program in Version 2016 Release 3 I have discovered a problem where an AppleScript fails to execute. I deleted the AppleScript from the project and attempted to re-add it. This caused Xojo to crash. Does this version of Xojo support the use of AppleScripts?

Why don’t you post the relevant section of the crash log first?

I tried posting the entire crash log because I couldn’t figure out what the relevant section was. When I click Post a Reply nothing happened. However, maybe someone knows the answer to the question “Does Version 2016 Release 3 support AppleScripts?”

I was able to drop an applescript .scpt file into my 2016r3 desktop project and it worked. I had the applescript display a dialog.

What type of Xojo project are you trying it with? Desktop, Web, Console? Of these 3, applescripts only work on desktop projects.

It’s a desktop project. Any idea why the AppleScript is not executing?

Did you try with a simplified project and script? I don’t see any reason for Xojo to crash, dropping the script into your project.

My testing script named “hello.scpt” consisted of

display dialog "Hello World"

For my Xojo project, I added a button, and set the action to

hello

When I ran it and clicked the button, the dialog displayed as expected.

You want the part where it says “thread xxx crashed”. Example:

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 com.apple.CoreServices.CarbonCore 0x9541c865 CSMemDisposeHandle + 16
1 com.apple.CoreServices.CarbonCore 0x9541e740 DisposeHandle + 17
2 com.apple.ImageIO.framework 0x9621f90b QTReadPlugin::~QTReadPlugin() + 71
3 com.apple.ImageIO.framework 0x9622156f FPXReadPlugin::~FPXReadPlugin() + 19
4 com.apple.ImageIO.framework 0x9621fec5 QTReadPlugin::init() + 1351
5 com.apple.ImageIO.framework 0x962216ee FPXReadPlugin::InitProc(CGImagePlugin*, unsigned long, unsigned long) + 102
6 com.apple.ImageIO.framework 0x96177f18 IIOImageSource::makeImagePlus(unsigned long, _CFDictionary const*) + 1160
7 com.apple.ImageIO.framework 0x9617951e IIOImageSource::getPropertiesAtIndexInternal(unsigned long, __CFDictionary const*) + 58
8 com.apple.ImageIO.framework 0x961794bc IIOImageSource::copyPropertiesAtIndex(unsigned long, __CFDictionary const*) + 104
9 com.apple.ImageIO.framework 0x96151589 CGImageSourceCopyPropertiesAtIndex + 215
10 com.apple.AppKit 0x926747b5 ImageSourceOptionsForCGImageSource_index + 57
11 com.apple.AppKit 0x9267457c +[NSBitmapImageRep _imagesWithData:hfsFileType:extension:zone:expandImageContentNow:includeAllReps:] + 530
12 com.apple.AppKit 0x926f01ec +[NSBitmapImageRep imageRepsWithData:] + 63
13 com.apple.AppKit 0x926efab0 -[NSImage initWithData:] + 105
14 com.xojo.XojoFramework 0x0203887a 0x1f25000 + 1128570
15 com.xojo.XojoFramework 0x02081796 PictureFromMemoryBlock + 75
16 com.mothsoftware.mailarchiverx 0x000b3e3d Picture.!FromData%o%o + 59

You can see my stuff (com.mothsoftware.mailarchiverx) at the bottom. Then comes the Xojo stuff followed by the bowels of MacOS. With this I can see that I’m doing a Picture.FromData which makes the app puke.

In my projects I use Applescripts and works perfectly with 2016 r3.

This is from the crash log. I hope it’s the relevant part.

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 RegEx.dylib 0x045ee31c 0x45eb000 + 13084
1 RegEx.dylib 0x045eda87 0x45eb000 + 10887
2 RegEx.dylib 0x045ede70 0x45eb000 + 11888
3 RegEx.dylib 0x045ee55b 0x45eb000 + 13659
4 com.xojo.xojo 0x00104fb7 RegEx.Search%o%os + 99
5 com.xojo.xojo 0x00c67a6d ProjectXML.IsLoadableXMLFile%b%o + 585
6 com.xojo.xojo 0x00abad8c ImportFileAction.ImportOneItem%%ooooi4 + 2923
7 com.xojo.xojo 0x00ab51aa ImportFileAction.ImportFile%%oooi4 + 33993
8 com.xojo.xojo 0x00aaaea1 ImportFileAction.Execute%%oo + 442
9 com.xojo.xojo 0x0089d1f6 CompoundAction.Execute%%oo + 463
10 com.xojo.xojo 0x005ee9fb Document.DoAction%%oo + 425
11 com.xojo.xojo 0x0160ae4c StudioMainEditor.StudioMainEditor.ProjectSourceList_DropObject%%o<StudioMainEditor.StudioMainEditor>o<SourceList.SourceList>oi4o<SourceListSupport.SourceListItem>i4 + 75995
12 com.xojo.xojo 0x0180ae7f Delegate.IM_Invoke%%o<SourceList.SourceList>oi4o<SourceListSupport.SourceListItem>i4 + 127
13 com.xojo.xojo 0x0180aeed AddHandler.Stub.48%%oi4o<SourceListSupport.SourceListItem>i4 + 98
14 com.xojo.xojo 0x01cf1ae3 SourceList.SourceList.SourceCanvas_DropObject%%o<SourceList.SourceList>ooi4 + 804
15 com.xojo.xojo 0x01d41af4 Delegate.IM_Invoke%%ooi4 + 103
16 com.xojo.xojo 0x01d41cb5 AddHandler.Stub.44%%oi4 + 74
17 com.xojo.xojo 0x018d1359 ControlCanvas.Event_DropObject%%ooi4 + 199
18 com.xojo.XojoFramework 0x0325572a 0x3186000 + 849706
19 com.xojo.XojoFramework 0x03374d66 0x3186000 + 2026854
20 com.xojo.XojoFramework 0x031dcbdd 0x3186000 + 355293
21 com.xojo.XojoFramework 0x031d7be3 0x3186000 + 334819
22 com.apple.AppKit 0x928007b2 NSCoreDragReceiveMessageProc + 1150
23 com.apple.HIServices 0x9358a25b DoMultipartDropMessage + 297
24 com.apple.HIServices 0x93589f77 DoDropMessage + 56
25 com.apple.HIServices 0x9358f004 CoreDragMessageHandler + 902
26 com.apple.CoreFoundation 0x946142a1 __CFMessagePortPerform + 721
27 com.apple.CoreFoundation 0x94576ba5 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION + 53
28 com.apple.CoreFoundation 0x94576b05 __CFRunLoopDoSource1 + 533
29 com.apple.CoreFoundation 0x9456ec69 __CFRunLoopRun + 2553
30 com.apple.CoreFoundation 0x9456e00a CFRunLoopRunSpecific + 506
31 com.apple.CoreFoundation 0x9456ddfb CFRunLoopRunInMode + 123
32 com.apple.HIToolbox 0x93c752ee RunCurrentEventLoopInMode + 268
33 com.apple.HIToolbox 0x93c74faf ReceiveNextEventCommon + 195
34 com.apple.HIToolbox 0x93c74ed3 _BlockUntilNextEventMatchingListInModeWithFilter + 83
35 com.apple.AppKit 0x92578c03 _DPSNextEvent + 1193
36 com.apple.AppKit 0x92c7cd2d -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1423
37 com.apple.AppKit 0x92c7c796 -[NSApplication(NSEvent) nextEventMatchingMask:untilDate:inMode:dequeue:] + 132
38 com.xojo.XojoFramework 0x031c81e6 0x3186000 + 270822
39 com.xojo.XojoFramework 0x031c822f 0x3186000 + 270895
40 com.xojo.xojo 0x001c08dd Delegate.Invoke%% + 34
41 com.xojo.xojo 0x0007bbea Application._CallFunctionWithExceptionHandling%%op + 248
42 com.xojo.XojoFramework 0x03334b1a 0x3186000 + 1764122
43 com.xojo.XojoFramework 0x031c8187 0x3186000 + 270727
44 com.apple.AppKit 0x9256d8ea -[NSApplication run] + 943
45 com.xojo.XojoFramework 0x03334bba 0x3186000 + 1764282
46 com.xojo.XojoFramework 0x03332d94 RuntimeRun + 49
47 com.xojo.xojo 0x0017a4d7 REALbasic._RuntimeRun + 34
48 com.xojo.xojo 0x02b27d45 _Main + 295
49 com.xojo.xojo 0x02b1dfd3 main + 36
50 com.xojo.xojo 0x02b325e7 start + 53

I just created a test project and when I tried to add an AppleScript Xojo crashed.

I fixed the issue. I opened the script in ScriptEditor and re-saved it. Xojo accepted the newly saved script without crashing. The script was created a few years ago so perhaps saving a new version of it updated something that made it work with Xojo.

Thanks everyone for your help. Much appreciated!

I am sorry, but here it works flawlessly :
https://dl.dropboxusercontent.com/u/17407375/applescript.xojo_binary_project

Maybe the file you try to add is corrupted ? Have you tried to load it into script editor, and save it again ?

You should open a Feedback case. Whatever is in the file it shouldn’t crash Xojo.

file a bug report with the original script attached would you ?