More Myriad Table Questions

(Starting a new topic because Safari freezes when I scroll to the bottom of the original)

I’ve been having an issue using Myriad Tables from an Applet as an AppleScript Palette with inDesign. About every 10th time I launch a script, the applet crashes and I get an apple Crash notification.

I’ve been using the applet for months, and aside from this issue it works fine.

I can use this applet myself but I don’t think I can inflict a frequently crashing applet on users.

I don’t know if the issue is with Myriad Tables, the applet, inDesign or some combination of all three.

I’m not sure how to proceed.

Any suggestions?

Also, when I save it as an enhanced app there are other issues that I haven’t been able to track down. Errors that variables are not set that just don’t make sense.

And, it sometimes causes SD to crash if I run from SD (send crash report this morning).

Can you send me a crash report?

I’ll send you a bunch in the morning, I usually have half a dozen

So the app continued to crash, but without the appleCrash report appearing. I ran it from within SD and that generated the SD crash report which I sent from within the app.

Not so much a question but more of a feature request.

Would it be difficult to allow an icon to be displayed with a table? Not in the table itself, but in the window the way it’s done with display dialog and display alert.

(I have two identical scripts, one that controls Safari, the other Chrome, I’d like to have an icon displaying in the window to let the user know at a glance which one to click on)

It’s more work than I want to take on, honestly. But you can pretty much do what you like with the accessory view.

Create an image view and fill it with your pic (doesn’t need to be .icns file):

set theImage to current application's NSImage's alloc()'s initWithContentsOfURL:theFile
set theView to current application's NSImageView's alloc()'s initWithFrame:{{0, 0}, {64, 64}}
theView's setImage:theImage
theView's setImageScaling:(current application's NSImageScaleProportionallyUpOrDown)

Then pass that as the accessory view. The placement is a bit odd, above the buttons, but it should get the message across.

OK, I’ll try that. thanks.

Quick question about adding a row. Is it possible to ad a row with default values? I have a table where only one or two of several variables need to change when the user click +, but they have to fill them all in.

It’s theoretically possible…

When “OK Button is default” is set to true, shouldn’t the OK button be highlighted? It’s not, but it’s still default. (it activates when you hit return)

That’s the OS’s doing, I’m afraid.

The script below is part of a large script that’s nearly complete. But it has one nagging issue. It displays a table with two columns and the first column is basically labels and doesn’t need much space. The second column is data, and needs more space.

I’ve tried numerous combinations of
modify columns column width
and
modify table column widths pattern
But I can’t get the first column to be narrow and the second column to be wide.

Any suggestions?

use AppleScript version "2.4"
use scripting additions
use framework "Foundation"
use framework "AppKit"
use script "Myriad Tables Lib"
use script "Dialog Toolkit Plus"
set initialPosition to {30, 30}

set titleLists to {¬
   {"dataTitle", "Category", "Channel", true, ¬
      "PreferredTitle", ¬
      "TitleOption1", ¬
      "TitleOption2", ¬
      "TitleOption3", ¬
      "TitleOption4", ¬
      "TitleOption5"}, ¬
   {"Two and a Half Men", "Series -- Syndicated", "", false, ¬
      "2 & 1/2 Men"}, ¬
   {"Last Man Standing", "Series -- First Run and Syndicated", "Fox", false, ¬
      "Last Man Standing", ¬
      "Last Standing"}, ¬
   {"The Daily Show With Trevor Noah", "Series -- First Run", "Comedy Central", false, ¬
      "The Daily Show With Trevor Noah", ¬
      "The Daily Show: Trevor Noah", ¬
      "Daily Show: Trevor Noah", ¬
      "The Daily Show", ¬
      "Trevor Noah", ¬
      "Daily Show"}, ¬
   {"Saturday Night Live", "Series -- First Run and Syndicated", "NBC", false, ¬
      "Saturday Night Live", ¬
      "SNL"} ¬
      }

repeat
   set titleInfo to some item of titleLists
   set {thisTitle, category, channel, episodeTitles} to titleInfo
   set titleOptionlist to items 5 through -1 of titleInfo
   set item 1 of titleOptionlist to {"Preferred", item 1 of titleOptionlist}
   repeat with x from 2 to count of titleOptionlist
      set thisTitleOption to item x of titleOptionlist
      set thisTitleOption to {"Alt-" & ((x - 1) as text), (thisTitleOption as text)}
      set item x of titleOptionlist to thisTitleOption
   end repeat
   
   set rowTemplate to {"", ""}
   set selectedRows to {}
   set tableTitle to thisTitle & " title options"
   set theCategory to category
   set theChannel to channel
   
   --set viewParams to BuildAcceccoryView(episodeTitles, theCategory, theChannel)
   --   
   --my CreateAccessory(viewParams)
   --   
   -- create accessory view, passing controls plus size (as {width, height})
   set tablePrompt to "Edit info and options for " & thisTitle
   
   set theTable to make new table with data titleOptionlist ¬
      with title tableTitle ¬
      with prompt tablePrompt ¬
      multiple selections allowed false ¬
      empty selection allowed true ¬
      row template rowTemplate ¬
      can add and delete true ¬
      editable columns {2} ¬
      column headings {"", "Title Options"} ¬
      row numbering false ¬
      initially selected rows selectedRows
   
   set OKButton to "Save" --1
   set CancelButton to "Cancel (without saving)" --ERROR
   set extraButton to "Edit" --2
   modify table theTable ¬
      OK button name OKButton ¬
      cancel button name CancelButton ¬
      extra button name extraButton ¬
      highlighted rows {} ¬
      grid style grid between columns ¬
      column widths pattern {1, 2} ¬
      alternate backgrounds true ¬
      initial position initialPosition ¬
      row dragging false ¬
      without column reordering
   --   modify table theTable accessory view theAccessoryView
   modify columns in table theTable ¬
      columns list {1} ¬
      column width 5
   modify columns in table theTable ¬
      columns list {2} ¬
      column width 35
   
   try
      set tableResult to display table theTable ¬
         with extended results
   on error errMsg number errNum
      exit repeat
   end try
end repeat

The ‘column widths pattern’ parameter is to set equal columns; it’s no use for what you’re trying to do. And your column width values are being ignored because they’re way too small. Try values of 50 and 350 instead.

Thanks, that put me on the right track.

modify columns in table theTable ¬
			columns list {2} ¬
			column width 480
		--modify columns in table theTable ¬
		--	columns list {1} ¬
		--	column width 10
		

So, I figured out that if I drop the column widths patterns parameter, and just set the width of the longer column, the shorter column will fill the rest of the space.

Thanks!

Now I’m off to storing and retrieving from multiple applications in SQL Lite!