No internet connection
  1. Home
  2. How to

interaction select from list. Focus workaround?

By samuel henriques @samuel_henriques
    2020-12-19 15:51:50.079Z

    Hello everyone,

    I'm using this code to select from list but the window doesn't focus, I tryed this solution:
    https://forum.soundflow.org/-2349, but I need to select multiple items, is there a workaround for this?

    const chooser = sf.interaction.selectFromList({
        prompt: "Choose Masters to Commit:",
        title: "Available Masters",
        defaultItems: recTracks,
        items: recTracks,
        allowMultipleSelections: true,
    }).list
    

    Thank you.

    • 3 replies
    1. I don't think there is. As Christian stated at the bottom of the post you referred to, it seems to be a bug with AppleScript not focusing the window when it's opened.

      If I had to guess, the solution might be to have a background script running to detect if an applescript window is opened/exists and then focus it if it is. I'm not sure how to implement that however.

      1. samuel henriques @samuel_henriques
          2020-12-19 23:27:32.790Z

          Thank you Chris,
          Might be a good idea. I'll try not to obsess with this one too much, just to save me 1 click! 🤪

          1. In your case, where you need multiple selections, the following won't work, but for the cases where you just need a single selection, you can use the sf.interaction.popupSearch method instead