Script can't see Myriad Tables Lib in the same bundle

I have a copy of Myriad Tables Lib in the “Script Libraries” folder of my applet’s bundle. It has been working until today. Now, my script only sees Myriad Tables Lib if it is copied to ~/Library/Script Libraries. That is, my script no longer sees the copy which is in the same bundle. My script incorporates Myriad Tables with:

use script “Myriad Tables Lib”

Why would a script not be able to see a script library that is in the same bundle ?

When Myriad Tables is in my user script library is does work but sometimes bangs an error:

Error

Less often, I have seen:

Respond to selector

I’ve not been able to discern a pattern to these errors although it seems that some data I send to Myriad Tables causes problems but not others.

Also, earlier today, in case I had somehow altered Myriad Tables, I downloaded a fresh copy, copied it to my applets bundle and tried to run my applet. macOS banged a warning:

Warning

So, I logged off, had lunch, logged on and tried again. This time, macOS did not bang that warning.

Is there something I need to do to enable my script to see the copy of Myriad Tables that is in the applet’s bundle ?

Thanks.

UPDATE: I’m getting no errors on a Mac running macOS 13…6.3. I did not get the errors on a Mac running macOs 14.1.2. But I am getting the errors on that Mac now running macOS 14.2. Could that be relevant ?

That’s telling you it’s not signed by the same party as the app. Did you sign it after adding it?

Thanks. Not as far as I know.

I am testing a copy of my app which has not been exported from SD. That is so I can do test quick changes on the other Macs. If all goes well, I export my development copy as Run Only and test again.

I’ve confirmed no errors running on macOS 12.7.2. I don’t understand why my script can’t see the copy of the library that is inside the same bundle on Sonoma. Again, not an issue on Ventura or Monterey.

The dialog is not about seeing the lib, it’s about the lib being signed differently to the app that contains it – it’s a security dialog.

Shane, many thanks. I’ve deleted all copies then done a fresh download of MyriadTablesLib_stuff, expanded, removed the red tag and copied the library to the applet’s bundle (using Script Debugger).

But, I still can’t use the library. This is what I did:

  • Closed SD after installing Myriad library – without compiling. Opened the applet from the Desktop => worked perfectly.
    • UPDATE: Same result on macOS 12.7.2.
  • Opened the script in SD to make a change then tried to compile => “Can’t get script error” on Myriad lib.
    • UPDATE: Script Editor bangs the same error.
    • UPDATE 2: Script Editor bangs that error also on macOS 12.7.2.
  • Copied Myriad lib to ~/Library/Script Libraries => script successfully compiled and saved in SD.
  • Saved the main.scpt in SD and closed (SD showed that main.scpt had been edited).
  • Opened the applet from the Desktop => crashed with “SMSTableDialogController doesn’t understand the “alloc” message.” error.
    • UPDATE: Can’t replicate the “alloc” error on macOS 12.7.2.

Could the “alloc” error be caused by a badly formed call to make new table with data ?

In case it’s relevant the script which uses Myriad lib is separate to main.scpt but is in the same folder i.e. Resources > Scripts. Myriad lib is not used by main.scpt which does not have the relevant “use script” statement.

I’m sure I did nothing to sign the Myriad lib file. SD is set to code sign the applet on export – all this testing is on an applet which has not been exported. The modification date on both copies of the library is 9 Feb 2023.

Although it may well be a red herring, I had none of this trouble before updating macOS to 14.2.

No – it’s clearly a security problem.

What happens if you do export it?

Do you have an older version of Myriad Tables around that you could try?

No, sorry.

This morning on macOS 14.2:

  • Logged on and opened my applet from the Desktop – Myriad lib was inside the bundle but NOT in the my user Library.
    • The applet ran perfectly.
  • Opened SD, made a small change to main.scpt and saved.
    • Used the applet to install Myriad lib in my user library.
    • Ran the applet, crashed with “«script “Myriad Tables Lib”» doesn’t understand the
      “respondsToSelector_” message.”.
  • Closed SD and opened the applet from the Desktop again.
    • Ran perfectly.
  • Opened applet in SD and exported run only as an applet.
    • Ran perfectly.
  • Deleted the copy of Myriad lib from my user Library and ran the exported applet again.
    • Ran perfectly.
  • Tested the exported applet on macOS 13.6.3.
    • Ran perfectly.
  • Opened applet in SD, opened the script which uses Myriad lib, made a change, compiled (with a copy of Myriad lib in user Library), saved, closed, saved the applet, exported as run only and test on macOS 13.6.3.
    • Ran perfectly.
  • Ran the applet inside SD.
    • Crashed with “«script “Myriad Tables Lib”» doesn’t understand the
      “respondsToSelector_” message.”

So far today, I’ve not seen the “alloc” error. The only error today has been when running the applet inside SD. But, I did get the “alloc” error when running from the Desktop yesterday and the day before.

All this still leaves the question, why do SD and SE not see the Myriad lib inside the bundle when compiling yet, running the applet from the Desktop works i.e. the script does see Myriad lib inside the bundle.

I have another idea which might help. My applet installs a copy of Myriad lib in the user library so that it can be used by another script running from outside the bundle. At present I use a shell command "cp -R " to do the copy. “cp” seems to behave weirdly when copying app bundles so, maybe using Finder would be better.

Many thanks.

Because it’s not in the app’s search path. Libraries have to be in one of the designated search paths for the app that is running the script – Script Debugger when you’re editing, or the applet when you save.

Many thanks. Is it possible to review/change the designated search paths (especially for SD) ?

The search paths are designated by Apple.

Thanks. I found some old documentation on http://macosxautomation.com but, is there any Apple documentation ? Have also read through AppleScript Language Guide (2016).

I don’t understand why I don’t have this issue with the DTP library. All scripts inside my applet which use DTP compile without error even though DTP is not stored outside the bundle. But, any bundled script which uses Myriad Tables can only see Myriad Tables if a copy is in ~/Library/Script Libraries/. Could this be because Myriad Tables is Run-Only ?

UPDATE: main.scpt compiles without error if Myriad Tables is not ~/Library/Script Libraries/, but other scripts in the bundle do not.

I have some more detail on crashes involving Myriad Tables Lib when my applet is not exported. The first error I get is:

Error

Clicking on “OK” is followed by another error dialog:

Can't get text item 1 of "OK"

The only use of “OK” in my script and data used in the table is in the Myriad Tables call:

set my_table to make new table with data all_table_rows editable columns {1} column headings format_chooser_headings with prompt theFormatsDiagPromptLabel with title diag_Title with empty selection allowed and multiple lines allowed
modify table my_table initial position window_Position OK button name theButtonDownloadLabel cancel button name theButtonReturnLabel extra button name theButtonSkipLabel
modify columns in table my_table columns list {1} column width 35
set theResult to display table my_table giving up after 600

I don’t understand why repeated tests with the same data and same code usually results in that "OK error and sometimes works i.e. a correctly formatted table is displayed.

Also, on rare occasions, only when my exported applet is using Myriad Tables Lib, I get a kernel crash with:

Termination Reason: Namespace SIGNAL, Code 11 Segmentation fault: 11

This is an example of the data in the all_table_rows variable (converted from a list).

Content of all_table_rows.pdf (19.2 KB)

The table has two columns: first is a checkbox, second is the data. There are three buttons with button names supplied by variables.

Any insights would help greatly.

The first error simply means the lib’s framework can’t be loaded – that’s usually because of a lack of permission, although it can happen intermittently for no apparent reason.

The second error has nothing to do with Myriad Tables. «bhit» is the code for the button returned property of either an alert reply from display alert or a dialog reply from display dialog. It sounds like you’re trying to get text item 1 of what you assume is some text, but is in fact a reply from a dialog in which you hit the OK button.

Many thanks, again.

That’s what I found - sometimes an error, sometimes not. I do check all the permissions for the applet I can think of.

There is no OK button in the script and I always use this form of display dialog:

set noFormatsButton to button returned of (display dialog theNoFormatsLabel with title diag_Title buttons {theButtonReturnLabel, theButtonSkipLabel, theChooseLabel} default button 3 with icon file custom_icon_file giving up after 600)

if noFormatsButton is theButtonReturnLabel then ......

Suspect some badly formed data (which contains “OK”) might be slipping through and causing this grief.

Cheers.

That’s odd. Does the text item 1 give you a clue?

Don’t think so. The only use of that in the script is:

set AppleScript's text item delimiters to " "
...
set file_id_test to text item 1 of full_file_format

full_file_format contains a paragraph of text that is output by a separate Python script. There is some processing of the Python-sourced text (e.g. removing extraneous space characters). There is a repeat loop to iterate through the paragraphs. There can be 50 paragraphs.

I can add some flags to find out when the error occurs.

The script is separate to main.scpt – because it’s the only part of the applet which needs Myriad Tables.

In the end, don’t usually get these errors when running as a Run-Only Apple application, which is what users see.

Found cause of the “OK” button issue – when the call to Myriad Tables fails (e.g. with the “alloc” error), my calling script continues and tries to parse the data returned which must include things like “bhit”. So the calling script bangs the error.

Sorry about not checking that first. Now, I’d like to find the reason why I only get the “alloc” error sometimes.

UPDATE: And why I’m sometimes getting a crash on macOS Ventura and Monterey (the kind of crash which is reported in Console/DiagnosticReports) when running an exported version.

Cheers.

I fear it’s just one of those Apple mysteries. It’s been happening for quite a while…