2

I have a large table with about 1000 rows. If I try to get selected rows from the table, it takes more than 30 seconds. Is there way to speed up the process? I use JXA.

selected = table.rows.whose({selected:true})()
names = ""
for (r in selected) {
    names+=", "+selected[r].uiElements[1].name()
}
console.log(names)

Is there a faster way? Thanks!

chibop
  • 119
  • 9
  • Strange as it sounds, depending on the app you are targeting, it is sometimes faster to just repeat through all the rows, and collect the selected rows into a list. – Craig Smith Oct 18 '16 at 20:41
  • Thanks Craig for the suggestion. Unfortunately that was even slower in this situation. – chibop Oct 19 '16 at 01:27
  • Your example script is insufficient to analyze. Please provide complete script, including the application object. It would also be helpful to know what you plan to do with the selected rows in JXA. – JMichaelTX Oct 19 '16 at 04:52
  • @JMichaelTX, I revised the question to provide more code, but there isn't much to it really since it's just test script for now. – chibop Oct 19 '16 at 14:16

1 Answers1

1

Apparently you can just narrow down using specifier without going through each element to get names for them.

names = table.rows.whose({selected:true}).uiElements[1].name()

This was much faster for my case.

chibop
  • 119
  • 9