No internet connection
  1. Home
  2. How to

Script that Get the PT Project file path and paste in AudioFinder

By Victor Bresse @Victor_Bresse
    2021-08-23 15:43:35.092Z

    Hello All,
    I know, Idon't have Soundminer... I'm using Audio Finder cause it's way cheaper ...
    Anyhow, In AudioFinder I have to access The Preferences eachtime I want my processing Folder to Follow My ProTools Project.
    I wrote this Script: Actually Copy pasted all bits and Pieces from The Forum ... But I'm stuck I'm unable to Paste the Variable (filePath) in the Textfield...

    sf.ui.proTools.appActivate();
    var projectDir = sf.ui.proTools.mainWindow.sessionPath.split('/').slice(0, -1).join('/');
    var filePath = ${projectDir}/Audio Files;

    sf.ui.app('com.icedaudio.audiofinder').appActivate();

    sf.ui.app('com.icedaudio.audiofinder').menuClick({
    menuPath: ["AudioFinder","Preferences..."],
    });

    sf.keyboard.press({
    keys: "tab",
    });

    sf.interaction.displayDialog(filePath);

    textfield.elementSetTextFieldWithAreaValue({
    value: filePath
    });


    Could'nt put it in a Script Way!! Sorry for that Admin please edit...

    Thanks for any help

    Solved in post #2, click to view
    • 6 replies
    1. Chris Shaw @Chris_Shaw2021-08-23 18:37:04.761Z2021-08-24 19:20:23.127Z

      It so happens that I use AudioFinder as well…
      Here you go:

      const audioFinder = sf.ui.app('com.icedaudio.audiofinder');
      
      /* Get path of current PT session's Audio folder */
      sf.ui.proTools.appActivate();
      var projectDir = sf.ui.proTools.mainWindow.sessionPath.split('/').slice(0, -1).join('/');
      var filePath = `${projectDir}/Audio Files`;
      
      /* Switch to AudioFinder */
      audioFinder.appActivate();
      
      /*Switch to AudioFinder Open Prefs window, choose General tab */
      audioFinder.menuClick({
      menuPath: ["AudioFinder","Preferences..."],
      });
      
      /*           Define Prefs window */
      const prefsWindow = audioFinder.mainWindow.sheets.first.tabGroups
      
      prefsWindow.first.radioButtons.whoseTitle.is("General").first.elementClick();
      
      /* set Processing Output Folder */
      prefsWindow.first.textFields.first.elementSetTextAreaValue({
          value: filePath
      });
      
      /* Click OK */
      audioFinder.mainWindow.sheets.first.buttons.whoseTitle.is("OK").first.elementClick();
      
      
      Reply1 LikeSolution
      1. For future reference - here's how to quote code in the forums:
        How to quote code in the SoundFlow forum.

      2. V
        In reply toVictor_Bresse:
        Victor Bresse @Victor_Bresse
          2021-08-24 08:57:51.186Z

          Thanks a million @Chris_Shaw!!!
          I'm new to AudioFinder.... Still figuring the best way to work with it...
          If you have any other trick up your sleave and don't mind sharing i'd be delighted...
          Thanks again

          1. I bought AF ages ago when it first came out. I use it primarily for playing back audio in the finder, looking at the waveforms, and examining metadata/MP3 tags

          2. In reply toVictor_Bresse:
            Chris Shaw @Chris_Shaw2021-08-24 19:21:31.957Z2021-08-24 20:09:35.124Z

            I edited the code slightly to make it more readable by converting sf.ui.app('com.icedaudio.audiofinder') into a constant.
            The above code has ben changed to reflect this.

            1. V
              In reply toVictor_Bresse:
              Victor Bresse @Victor_Bresse
                2021-08-25 14:15:01.072Z

                Sweet! Sanks