use AppleScript version "2.4"
use scripting additions
use script "Myriad Tables Lib" version "1.0.7"
use script "FileManagerLib" version "2.2.1"
property lastTablePosition : {25, 25}
property paletteScriptFolder : ""
property myName : ""
set tableData to {¬
{"026)", "Close all but first Finder windows"}, ¬
{"011)", "textFromSelectedMessages"}, ¬
{"001)", "Delete Unwanted CalendarMail Emails"}, ¬
{"003)", "Missing TV Listings"}, ¬
{"003)", "AppVersionsApple", "AppVersionsApple.app:"}, ¬
{"100)", "zOpen This Scripts Folder"} ¬
}
set highlightedRows to {2, 4, 6, 8}
set tablePrompt to "Select a script to run"
set tableTitle to "Script Pallet"
set cancelName to "Close Pallet"
set extraButton to "Reset"
repeat
set myTable to make new table with data tableData ¬
with prompt tablePrompt ¬
with title tableTitle ¬
empty selection allowed true ¬
multiple lines allowed false ¬
row template {missing value, ""} ¬
with double click means OK
modify table myTable ¬
highlighted rows highlightedRows ¬
extra button name extraButton ¬
cancel button name cancelName
modify columns in table myTable ¬
sorting data column 1 ¬
sort method sort case insensitive
set tableResult to display table myTable ¬
with extended results
end repeat
Well, this is very odd, then. Because with the same script running in the same folder on my older Macs it displays the files in the ###) sorted order, but on this one they’re in a random order.
The list is generated by the handler below, and I could add a sort command, but it seemed to work flawlessly before.
on BuildTableFromScripts(folderWithScripts)
set myFiles to objects of folderWithScripts ¬
searching subfolders false ¬
include invisible items false ¬
include folders true ¬
include files true ¬
result type files list
set scriptNameExts to {"scpt", "scptd", "app"}
set tableData to {}
set highlightedRows to {}
repeat with thisFile in myFiles
set fileInfo to parse object thisFile with HFS results
set {fileName, nameExt, nameText, fileKind} to ¬
{full_name, name_extension, name_stub, file_kind} of fileInfo
set AppleScript's text item delimiters to {")"}
set displayText to (the rest of text items of nameText) as text
if displayText is "" then set displayText to nameText
if fileName is not myName then
if nameExt is in scriptNameExts or fileKind is "Alias" then
set the end of tableData to {fileName, displayText, thisFile as text}
else
set aFolder to object is folder thisFile
set the end of tableData to {fileName, " -->" & displayText, thisFile as text}
set the end of highlightedRows to count of tableData
end if
end if
end repeat
return {tableData, highlightedRows}
end BuildTableFromScripts
That suggests it’s a change in behavior of the underlying macOS code. I’ve looked at my code, and I’m setting how the column should be sorted, but not that it should be sorted initially. (That plays havoc with initial selection, apart from anything else.)