Anybody else seeing this error:
“The bundle “SMSTableDialogBuilder” couldn’t be loaded because it is damaged or missing necessary resources.” number -4960 from framework “SMSTableDialogBuilder”
I get the error when running the script below (and others) from Script Editor, but not Script Debugger. (Also errors in osascript, which is how I first encountered it).
I know this script as is has run in the past in SE (not sure about osascript).
→ Mac OS: 26.4.1 (25E253)
→ Script Debugger 8.0.10 (8A88)
→ Script Editor 2.11 (234)
→ AppleScript 2.8
Could it be a tahoe thing?
use AppleScript version "2.4"
use framework "Foundation"
use framework "AppKit"
use script "Myriad Tables Lib" version "1.0.9"
use scripting additions
property theCheckbox : missing value
property thePopup : missing value
property theAccessoryView : missing value
set popupList to {"Fred", "Frieda", "George", "Georgina"}
-- Manipulation of views should be done on the main thread
if current application's NSThread's isMainThread() as boolean then
my createCheckBoxMainThread:{"Check me", "checkboxClicked:"}
my createPopupMainThread:{popupList, "Georgina"}
my buildAccessoryViewMainThread:{theCheckbox, thePopup}
else
my performSelectorOnMainThread:"createCheckBoxMainThread:" withObject:{"Check me", "checkboxClicked:"} waitUntilDone:true
my performSelectorOnMainThread:"createPopupMainThread:" withObject:{popupList, "Georgina"} waitUntilDone:true
my performSelectorOnMainThread:"buildAccessoryViewMainThread:" withObject:{theCheckbox, thePopup} waitUntilDone:true
end if
-- make a table and add the accessory view
set theTable to make new table with data {¬
("One"), ¬
("Two"), ¬
("Three"), ¬
("Four"), ¬
("Five") ¬
}
modify table theTable accessory view theAccessoryView
set theAccessoryView to missing value -- to avoid error messages when saving
display table theTable
-- get the state of the checkbox
set theState to theCheckbox's state() as boolean
set theCheckbox to missing value -- to avoid error messages when saving
set theValue to thePopup's title() as text
set thePopup to missing value
display dialog theValue
on createCheckBoxMainThread:theArg
set {theTitle, theAction} to theArg as list
-- build a checkbox
set my theCheckbox to current application's NSButton's alloc()'s initWithFrame:{{10, 10}, {150, 18}}
tell theCheckbox
its setButtonType:(current application's NSSwitchButton)
its setTitle:theTitle
its setTarget:me
its setAction:theAction -- a handler in this script
end tell
end createCheckBoxMainThread:
on createPopupMainThread:theArg
set {entryList, defaultValue} to theArg as list
set my thePopup to current application's NSPopUpButton's alloc()'s initWithFrame:{{10, 35}, {150, 26}} pullsDown:false
thePopup's addItemsWithTitles:entryList
thePopup's selectItemWithTitle:defaultValue
end createPopupMainThread:
on buildAccessoryViewMainThread:theControls
set my theAccessoryView to current application's NSView's alloc()'s initWithFrame:{{0, 0}, {160, 60}}
repeat with aControl in theControls
(theAccessoryView's addSubview:aControl)
end repeat
end buildAccessoryViewMainThread:
-- this is called when the checkbox is clicked
on checkboxClicked:sender
-- make an alert and show it as a sheet over the table window
set theWindow to sender's |window|()
set theAlert to current application's NSAlert's alloc()'s init()
theAlert's setMessageText:"You clicked the checkbox"
theAlert's setInformativeText:"Now close this sheet"
theAlert's beginSheetModalForWindow:theWindow completionHandler:(missing value)
end checkboxClicked: