Has anyone had any success using Myriad Tables in a Keyboard Maestro AppleScript? I am trying to create a dialog with two columns, one a checkbox and the other a text field. I can run the script below in Script Debugger but running it from Keyboard Maestro I get the error "The bundle “SMSTableDialogBuilder” couldn’t be loaded." Maybe this is not possible with the new security protocols. I have included the 'use script "Myriad Tables Lib" version "1.0.10"' and tried wrapping the code with 'Tell Application "Shane's Script Library Pack" without any luck.
The code is included below.
Thanks for any help anyone can provide.
use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
-- use framework "AppKit"
use scripting additions
use script "Myriad Tables Lib" version "1.0.10"
set kmInst to system attribute "KMINSTANCE"
tell application "Keyboard Maestro Engine"
set the_list to getvariable "local_tagsup_prodven_file" instance kmInst
end tell
global tableContent
set tableContent to {}
set dialogWidth to 300
set dialogHeight to 350
set theResult to ""
set theBounds to centerDialog(dialogWidth, dialogHeight)
set old_delims to AppleScript's text item delimiters
set AppleScript's text item delimiters to {ASCII character 10}
set list_string to readFile("/Users/km/programming/applescripts/keyboard_maestro_scripts/kbm_support_tags_products.txt")
set new_string to do shell script "echo " & quoted form of list_string & " | sort -f"
set new_list to (paragraphs of new_string)
set AppleScript's text item delimiters to old_delims
repeat with ln in new_list
addLine(ln)
end repeat
tell application "Shane's Script Library Pack"
-- **********
-- *** This is where the script fails. ***
-- **********
--The checkboxes here can be clicked
set theTable to make new table with data tableContent with title "Choose Products" column headings {"", "Products"} editable columns {1} with prompt "Choose products to added to email tags." with multiple selections allowed and empty selection allowed
modify table theTable initial position theBounds
modify columns in table theTable column width (60)
set theResult to display table theTable
end tell
return parseResults(theResult)
on readFile(theFile)
-- Convert the file to a string
set theFile to theFile as string
tell application "Finder"
-- Read the file and return its contents
return read POSIX file theFile
end tell
end readFile
on addLine(ln)
if contents of ln is not equal to "" then
set the end of tableContent to {false, contents of ln}
end if
end addLine
on centerDialog(dHeight, dWidth)
set theFrame to current application's NSScreen's screens()'s firstObject()'s frame()
set screenWidth to item 1 of item 2 of theFrame
set screenHeight to item 2 of item 2 of theFrame
set dLeft to (screenWidth / 2) - (dWidth / 2)
set dTop to (screenHeight / 2) - (dHeight / 2)
set theResult to {}
set the end of theResult to dLeft
set the end of theResult to dTop
set the end of theResult to dHeight
set the end of theResult to dWidth
return theResult
end centerDialog
on parseResults(theTable)
set newTagList to ""
tell application "Shane's Script Library Pack"
set valuesReturned to values returned of theTable
end tell
repeat with prodOrVend in valuesReturned
if item 1 of prodOrVend is true then
set newTagList to newTagList & item 2 of prodOrVend & "
"
end if
end repeat
return newTagList
end parseResults