Myriad Tables Questions

Same thing was happening to me, and I was able to determine I had multiple copies of Shane’s library app installed. Look in:

User Script Libraries
System Script Libraries

And maybe do a search for “Shane’s Script Library Pack” and delete all but the most recent. (The ones in the Library folders may not show up in a spotlight search)

You could also change this line of the script

use script "Myriad Tables Lib" version "1.0.13

to this

use script "Myriad Tables Lib"

That would use the first version of Myriad Tables if finds, regardless of the version.

I had a couple old versions of the App in a folder but none were in Applications…deleted now. No old copies in User Script Libraries or System Script Libraries. I think the OS must cache the Library until rebooted or something. Script Debugger quit and restart didn’t resolve but restart fixed it.

I’ve noticed a couple issues with setting column widths in tables.

  • The dictionary says real for column width, but it should be integer
  • If I use any value for column width from 1 to 9, it errors. It works with 0 or 10 and any number more than 10
  • If the MT window is wide, and I want the first column to be narrow and the extra width taken up in the later columns, it doesn’t work. The first column always appears to wide.

Here an example that illustrates the issue (with comments in the script)

use scripting additions
use script "Myriad Tables Lib"
set playerRoster to {¬
   {"1", "Clint", "Eastwood"}, ¬
   {"2", "Mel", "Brooks"}, ¬
   {"3", "Woody", "Allen"}, ¬
   {"4", "Woody", "Harrelson"}, ¬
   {"5", "Mel", "Gibson"}, ¬
   {"6", "Mary", "Tyler Moore"}, ¬
   {"7", "Katharine", "Hepburn"}, ¬
   {"8", "Lauren", "Bacall"}, ¬
   {"9", "James", "Stewart"}, ¬
   {"10", "Clark", "Gable"}, ¬
   {"11", "Carey", "Grant"}, ¬
   {"12", "Colin", "Firth"}, ¬
   {"13", "Henry", "Fonda"}, ¬
   {"14", "Humphrey", "Bogart"} ¬
      }

set tableData to playerRoster
set tableTitle to "Edit Roster"
set tablePrompt to "Add/Delete or Edit Player names and numbers. Click column headings to sort"

set newTable to make new table with data tableData ¬
   with title tableTitle ¬
   with prompt tablePrompt ¬
   with empty selection allowed

--modify column
set columnsToModify to {1} 
set columnWidth to 0
-- Does not accept numbers from 1 to 9
--Will not allow a narrow first column if the window is wide


modify columns in table newTable ¬
   columns list columnsToModify ¬
   column width columnWidth ¬
   
--Modify table
set OKButtonName to "Accept"
set OKButtonIsDefault to true
set cancelButtonName to "Cancel (Without Saving)"

modify table newTable cancel button name cancelButtonName
--If you note out the modify table line above you'll see how it works when the window in not unusually wide.

set tableResult to display table newTable ¬
   with extended results

→ Mac OS Version 11.6.8 (20G730)

–Applications
→ Script Debugger 8.0.5 (8A61)

–Script Libraries
→ Myriad Tables Lib 1.0.13

It should accept either.

The dictionary says:

A width of 0 means automatic sizing, and the minimum is 10 points.

Then don’t set its width to automatic (0).

If I set its width to 10, and the buttons are wide, it adds space to the columns (including the first one, where the width is set). If the buttons are narrow, it displays correctly.

This version displays two tables. The only difference the width of the buttons. (and the title and prompt, but those have no effect)

Ideally, if space is added to columns to fit a wider window, it should be added to those whose widths are not set.

If widths are set in all columns, then no space should be added and the window should simply have a margin from the right side of the table to the right side of the window.

use scripting additions
use script "Myriad Tables Lib"
set playerRoster to {¬
   {"1", "Clint", "Eastwood"}, ¬
   {"2", "Mel", "Brooks"}, ¬
   {"3", "Woody", "Allen"}, ¬
   {"4", "Woody", "Harrelson"}, ¬
   {"5", "Mel", "Gibson"}, ¬
   {"6", "Mary", "Tyler Moore"}, ¬
   {"7", "Katharine", "Hepburn"}, ¬
   {"8", "Lauren", "Bacall"}, ¬
   {"9", "James", "Stewart"}, ¬
   {"10", "Clark", "Gable"}, ¬
   {"11", "Carey", "Grant"}, ¬
   {"12", "Colin", "Firth"}, ¬
   {"13", "Henry", "Fonda"}, ¬
   {"14", "Humphrey", "Bogart"} ¬
      }
set tableData to playerRoster

set firstColumnWidth to 10
set OKButtonName to "Accept"
set OKButtonIsDefault to true
set cancelButtonName to "Cancel (Without Saving)"
set tableTitle to "With Wide Buttons"
set tablePrompt to "Column width for first column is set to 10 and no space is added. Space is added to all three columns"


set newTable to make new table with data tableData ¬
   with title tableTitle ¬
   with prompt tablePrompt ¬
   with empty selection allowed

--modify column
set columnsToModify to {1}
set columnWidth to firstColumnWidth
--Will not allow a narrow first column if the window is wide

modify columns in table newTable ¬
   columns list columnsToModify ¬
   column width columnWidth ¬
   
--Modify table


modify table newTable cancel button name cancelButtonName
--If you note out the modify table line above you'll see how it works when the window in not unusually wide.

set tableResult to display table newTable ¬
   with extended results

set OKButtonName to "OK"
set cancelButtonName to "Cancel"

set tableTitle to "With Narrow Buttons"
set tablePrompt to "Column width for first column is set to 10. No space is added to the columns."

set newTable to make new table with data tableData ¬
   with title tableTitle ¬
   with prompt tablePrompt ¬
   with empty selection allowed

--modify column
set columnsToModify to {1}
set columnWidth to firstColumnWidth
--Will not allow a narrow first column if the window is wide

modify columns in table newTable ¬
   columns list columnsToModify ¬
   column width columnWidth ¬
   
--Modify table


modify table newTable cancel button name cancelButtonName
--If you note out the modify table line above you'll see how it works when the window in not unusually wide.

set secondTableResult to display table newTable ¬
   with extended results

That’s right – width required to show the buttons takes precedence.

That’s just not going to happen. If you need strict control over column widths, you need to first make sure your buttons will accommodate it.