How to refresh Logic's cache?
Hi all,
I've been having issues trying to get Logic to refresh the "Bounce Project" window's values (PCM, MP3, File Format etc.)
I have written a code for bouncing stems and it goes through it perfectly until it loops and starts bouncing the next track, suddenly all values in the Bounce window cannot be seen and it fails, any workaround this?.
I have tried invalidating windows, values and Logic at different stages of the code but haven't had any luck, I have even tried openning and closing say an "Import" window. Also, is there a "left keypress" quick refresh like in Pro Tools maybe?.
Thanks all,
Nic.
Kitch Membery @Kitch2024-02-27 21:39:13.819ZHave you tried creating a preset in the "Bounce Project or Selection" Command template in the Logic package?

In reply toNicolas_Aparicio⬆:Kitch Membery @Kitch2024-02-27 21:41:20.557ZThe Command template allows you to make presets where you can set all your custom settings.

- NIn reply toNicolas_Aparicio⬆:Nicolas Aparicio @Nicolas_Aparicio
Hi Kitch,
I have though the code I've written loops through different stems, can also bounce the mix and import the Mixes into the session, hence the need to have everything in one code. My code works fine for all options until it loops through stems, I have tried:
- Invalidating logic
- Invalidating the bounce window
- Ivalidating Values
- Reseting the menus
- Opening and closing the bounce window
- Opening and closing other windows
All good if it's a long shot but thought to ask first.
Kitch Membery @Kitch2024-02-28 00:28:55.542ZWithout seeing your code I'd be unable to provide an answer, as the invalidating would need to happen each time the loop occurs, to ensure that the the cache is refreshed. :-)
- NNicolas Aparicio @Nicolas_Aparicio
Sure thing Kitch,
Here you go, btw when looping, it fail on line 519 as it fails to see the values:
sf.ui.logic.appActivateMainWindow() sf.ui.logic.invalidate() let isCycleOn = sf.ui.logic.mainWindow.groups.whoseDescription.is("Control Bar").first.checkBoxes.whoseTitle.is("Cycle").first.isCheckBoxChecked if (!isCycleOn) { alert('CYCLE IS NOT ON!') throw 0 }; const iconWarning = '/Volumes/NICO MAIN B/SF ICONS/WARNING SIGN.webp' const iconLogic = '/Volumes/NICO MAIN B/SF ICONS/LOGIC PRO.png' const logic = sf.ui.app('com.apple.logic10'); const logicSessionName = sf.ui.logic.mainWindow.title.value.split('.logicx')[0] const filePath = logic.mainWindow.getString("AXDocument").slice(7, -1); const folderPath = filePath.split('/').slice(0, -1).join('/'); const desktop = '/Users/nicolasaparicio/Desktop' const ticioMusicSessionsCurrent = '/Volumes/NICO MAIN B/- TICIOMUSIC/TICIOMUSIC SESSIONS/2024' const ticioMusicSessions = '/Volumes/NICO MAIN B/- TICIOMUSIC/TICIOMUSIC SESSIONS' var BitDepth = sf.ui.logic.windows.first.groups.first.popupButtons.allItems[4] var SampleRate = sf.ui.logic.windows.first.groups.first.popupButtons.allItems[3] let BouncesFolderPath = [folderPath + '/Bounces/'].map(i => i.split('%20')).map(i => i.join(' '))[0] let PCM = sf.ui.logic.windows.first.scrollAreas.first.tables.first.children.whoseRole.is("AXRow").allItems[0].children.whoseRole.is("AXCell").first.checkBoxes.first let MP3 = sf.ui.logic.windows.first.scrollAreas.first.tables.first.children.whoseRole.is("AXRow").allItems[1].children.whoseRole.is("AXCell").first.checkBoxes.first /// Filter Folder Names Only /// let desktopPathNames = sf.file.directoryGetEntries({ path: desktop, sortOrder: 'NameAsc', includeFiles: false, isRecursive: true }). paths.filter(i => !i.includes('.')).filter(i => !i.includes('Audio Files') && !i.includes('Bounces') && !i.includes('Audio Files') && !i.includes('Alchemy Samples') && !i.includes('Freeze Files') && !i.includes('Video Files') ); let ticioMusicSessionsCurrentNames = sf.file.directoryGetDirectories({ path: ticioMusicSessionsCurrent, sortOrder: 'NameAsc' }).paths.filter(i => !i.includes('.')) let ticioMusicSessionsNames = sf.file.directoryGetDirectories({ path: ticioMusicSessions, sortOrder: 'NameAsc' }).paths.filter(i => !i.includes('.')) let AllFolders = ( desktopPathNames.join() + ',' + ticioMusicSessionsCurrentNames.join() + ',' + ticioMusicSessionsNames.join() ).split(',').filter(i => i.replace("", '')).sort() //////////////////////// BOUNCE CASA LIST OPTIONS //////////////////////// let BounceCasa = sf.interaction.selectFromList({ title: 'BOUNCE CASA', prompt: 'Select Bounce Options:', allowEmptySelection: false, allowMultipleSelections: true, items: [ '▫️ BOUNCE MIX - 44100khz', '▫️ BOUNCE MIX - Mp3', '▫️ BOUNCE MIX - 48000khz', '\n\'', '---------------------------------------------------', '\n\'', '▫️ BOUNCE STEMS', '▫️ Import Mix Into Session', '▫️ Export Files' ], // defaultItems: ['▫️ BOUNCE MIX - 44100khz', '▫️ BOUNCE MIX - mp3'], }).list var isBouncesFolderCreated = sf.file.directoryExists({ path: BouncesFolderPath }).exists if (isBouncesFolderCreated == true) { var BouncedFilesNames = sf.file.directoryGetFiles({ path: BouncesFolderPath }).paths.map(i => i.split('/').slice(-1)[0]).map(i => i).toString().replace(/,/g, '\n').replace('.DS_Store', '') } else { var NoBouncedFilesNames = '' }; /////// NAME PROMPT //////// if (BounceCasa[0] != '▫️ Export Files') { //////////////////////// NAME MIX DIALOG //////////////////////// var nameMixDialog = sf.interaction.displayDialog({ title: 'PLEASE NAME YOUR MIX', prompt: `Bounced Files:\n\n` + `${BouncedFilesNames || NoBouncedFilesNames}`, buttons: ['Cancel', 'OK'], defaultButton: 'OK', defaultAnswer: logicSessionName + '_', icon: iconLogic }).text.toLocaleUpperCase() }; var bounceMix44100 = BounceCasa.filter(i => i.includes('▫️ BOUNCE MIX - 44100khz'))[0] === "▫️ BOUNCE MIX - 44100khz" var bounceMix48000 = BounceCasa.filter(i => i.includes('▫️ BOUNCE MIX - 48000khz'))[0] === "▫️ BOUNCE MIX - 48000khz" var bounceMixMp3 = BounceCasa.filter(i => i.includes('▫️ BOUNCE MIX - Mp3'))[0] === "▫️ BOUNCE MIX - Mp3" var bounceStems = BounceCasa.filter(i => i.includes('▫️ BOUNCE STEMS'))[0] === "▫️ BOUNCE STEMS" var imporMixIntoSession = BounceCasa.filter(i => i.includes('▫️ Import Mix Into Session'))[0] === "▫️ Import Mix Into Session" if (bounceStems) { var StemsToBounce = sf.interaction.selectFromList({ title: 'STEMS TO BOUNCE', prompt: 'Select the Stems to Bounce:', items: ['Drums Stem', 'Bass Stem', 'Gtrs Stem', 'Keys Stem', 'Perc Stem', 'Orch Stem', 'VO Stem'], allowMultipleSelections: true, defaultItems: ['Drums Stem', 'Bass Stem', 'Gtrs Stem', 'Keys Stem', 'VO Stem'] }).list }; function preBounceSettings() { sf.ui.logic.invalidate() sf.keyboard.press({ keys: '1' }) /// Open Bounce Window /// sf.ui.logic.menuClick({ menuPath: ['File', 'Bounce', 'Project or Section'], looseMatch: true }) sf.ui.logic.windows.first.elementWaitFor({ waitType: 'Appear', timeout: 1000, pollingInterval: 50, onError: "Continue" }); sf.wait({ intervalMs: 500 }) // Pre Bounce Settings // let Offline = sf.ui.logic.windows.first.radioButtons.whoseTitle.is("Offline").first let IncludeAudioTail = sf.ui.logic.windows.first.checkBoxes.whoseTitle.is("Include Audio Tail").first let IncludeTempoInfo = sf.ui.logic.windows.first.checkBoxes.whoseTitle.is("Include Tempo Information").first let Normalize = sf.ui.logic.windows.first.popupButtons.first let AAC = sf.ui.logic.windows.first.scrollAreas.first.tables.first.children.whoseRole.is("AXRow").allItems[2].children.whoseRole.is("AXCell").first.checkBoxes.first let BurnToCD = sf.ui.logic.windows.first.scrollAreas.first.tables.first.children.whoseRole.is("AXRow").allItems[3].children.whoseRole.is("AXCell").first.checkBoxes.first if (Normalize.value.value != 'Off') { Normalize.popupMenuSelect({ menuPath: ['Off'] }) }; if (AAC.isCheckBoxChecked) { AAC.checkboxSet({ targetValue: 'Disable' }) }; if (BurnToCD.isCheckBoxChecked) { BurnToCD.checkboxSet({ targetValue: 'Disable' }) }; if (!Offline.isCheckBoxChecked) { Offline.elementClick() }; if (IncludeAudioTail.isCheckBoxChecked) { IncludeAudioTail.elementClick() }; if (IncludeTempoInfo.isCheckBoxChecked) { IncludeTempoInfo.elementClick() }; // UnCheck all Destinations // sf.ui.logic.children.whoseRole.is("AXWindow").first.scrollAreas.first.checkBoxes.forEach(box => box.checkboxSet({ targetValue: "Disable" })); }; function pcmPreSettings() { /// Click On PCM /// sf.ui.logic.windows.first.scrollAreas.first.tables.first.children.whoseRole.is("AXRow").first.children. whoseRole.is("AXCell").allItems[1].getElement("AXTitleUIElement").mouseClickElement() sf.wait({ intervalMs: 300 }) // PCM Pre Settings // let FileFormat = sf.ui.logic.windows.first.groups.first.popupButtons.allItems[1] let FileType = sf.ui.logic.windows.first.groups.first.popupButtons.first let Dithering = sf.ui.logic.windows.first.groups.first.popupButtons.allItems[2] let AddToProject = sf.ui.logic.windows.first.groups.first.checkBoxes.whoseTitle.is("Add to Project").first let AddToMusic = sf.ui.logic.windows.first.groups.first.checkBoxes.whoseTitle.is("Add to Music").first if (FileFormat.value.value != 'AIFF') { FileFormat.popupMenuSelect({ menuPath: ['AIFF'], onError: "Continue" }) }; if (FileType.value.value != 'Interleaved') { FileType.popupMenuSelect({ menuPath: ['Interleaved'], onError: "Continue" }) }; if (Dithering.value.value != 'None') { Dithering.popupMenuSelect({ menuPath: ['None'], onError: "Continue" }) }; if (AddToProject.isCheckBoxChecked) { AddToProject.elementClick() }; if (AddToMusic.isCheckBoxChecked) { AddToMusic.elementClick() }; }; function SettingsAIFF44100() { pcmPreSettings(); try { if (BitDepth.value.value != '16-bit') { BitDepth.popupMenuSelect({ menuPath: ['16-bit'] }) }; if (SampleRate.value.value != '44100') { SampleRate.popupMenuSelect({ menuPath: ['44100'] }) }; } catch (onError) { sf.interaction.displayDialog({ title: 'CANNOT REFRESH WINDOW!', prompt: 'Please Check/Change the Settings for 44100:', defaultButton: 'OK', icon: iconWarning }); } finally { } }; function SettingsAIFF48000() { pcmPreSettings(); try { if (BitDepth.value.value != '24-bit') { BitDepth.popupMenuSelect({ menuPath: ['24-bit'] }) }; if (SampleRate.value.value != '48000') { SampleRate.popupMenuSelect({ menuPath: ['48000'] }) }; } catch (onError) { sf.interaction.displayDialog({ title: 'CANNOT REFRESH WINDOW!', prompt: 'Please Check/Change the Settings for 48000:', defaultButton: 'OK', icon: iconWarning }); } finally { } }; function SettingsMP3() { let bitRateMono = sf.ui.logic.windows.first.groups.first.popupButtons.allItems[3] let bitRateStereo = sf.ui.logic.windows.first.groups.first.popupButtons.allItems[1] let variableBitRate = sf.ui.logic.windows.first.groups.first.checkBoxes.whoseTitle.is("Use Variable Bit Rate Encoding (VBR)").first let useBestEnconding = sf.ui.logic.windows.first.groups.first.checkBoxes.whoseTitle.is("Use best encoding").first let filterFrequencies = sf.ui.logic.windows.first.groups.first.checkBoxes.whoseTitle.is("Filter frequencies below 10 Hz").first let stereoMode = sf.ui.logic.windows.first.groups.first.popupButtons.first let writeTags = sf.ui.logic.windows.first.groups.first.checkBoxes.whoseTitle.is("Write ID3 tags").first let addToMusicMp3 = sf.ui.logic.windows.first.groups.first.checkBoxes.whoseTitle.is("Add to Music").first /// Click on Mp3 /// sf.ui.logic.windows.first.scrollAreas.first.tables.first.children.whoseRole.is("AXRow").allItems[1].children. whoseRole.is("AXCell").allItems[1].getElement("AXTitleUIElement").mouseClickElement() if (bitRateMono.value.value != '320 kbps') { bitRateMono.popupMenuSelect({ menuPath: ['320 kbps'] }) }; if (bitRateStereo.value.value != '320 kbps') { bitRateStereo.popupMenuSelect({ menuPath: ['320 kbps'] }) }; if (variableBitRate.isCheckBoxChecked) { variableBitRate.checkboxSet({ targetValue: 'Disable' }) }; if (!useBestEnconding.isCheckBoxChecked) { useBestEnconding.checkboxSet({ targetValue: 'Enable' }) }; if (!filterFrequencies.isCheckBoxChecked) { filterFrequencies.checkboxSet({ targetValue: 'Enable' }) }; if (stereoMode.value.value != 'Joint Stereo') { stereoMode.popupMenuSelect({ menuPath: ['Joint Stereo'] }) }; if (writeTags.isCheckBoxChecked) { writeTags.checkboxSet({ targetValue: 'Disable' }) }; if (addToMusicMp3.isCheckBoxChecked) { addToMusicMp3.checkboxSet({ targetValue: 'Disable' }) }; }; function unhideTrack(trackName) { if (sf.ui.logic.selectedTrackNames[0] !== trackName) { /// Reset Cache /// sf.ui.logic.appActivateMainWindow() sf.ui.logic.invalidate() sf.ui.logic.getMenuItem('Edit', 'Select Tracks', 'All').elementClick() var IsTrackVisible = sf.ui.logic.selectedTrackNames.includes(trackName) var TrackHButton = sf.ui.logic.mainWindow.groups.whoseDescription.is("Tracks").first.groups.whoseDescription.is("Tracks").allItems[1].splitGroups.first.splitGroups.allItems[1]. scrollAreas.first.groups.whoseDescription.is("Tracks header").first.children.whoseRole.is("AXLayoutItem").first.checkBoxes.whoseDescription.is("Hide Track").first var FolderHButtonFolder = sf.ui.logic.mainWindow.groups.whoseDescription.is("Tracks").first.groups.whoseDescription.is("Tracks").allItems[1].splitGroups.first.splitGroups.allItems[1]. scrollAreas.first.groups.whoseDescription.is("Tracks header").first.children.whoseRole.is("AXLayoutItem").allItems[1].checkBoxes. whoseDescription.is("Hide Track").first var Hbutton = sf.ui.logic.mainWindow.groups.whoseDescription.is("Tracks").first.groups.whoseDescription.is("Tracks").allItems[1].splitGroups.first.splitGroups.first.groups. whoseDescription.is("Tracks legend").first.checkBoxes.whoseDescription.is("Show/Hide Hidden Tracks H").first var IsTrackFolder = sf.ui.logic.mainWindow.groups.whoseDescription.is("Tracks").first.groups.whoseDescription.is("Tracks").allItems[1].splitGroups.first.splitGroups. allItems[1].scrollAreas.first.groups.whoseDescription.is("Tracks header").first.children.whoseRole.is("AXLayoutItem").allItems[1].children. whoseRole.is("AXDisclosureTriangle").first if (IsTrackVisible == false) { if (Hbutton.exists) { Hbutton.mouseClickElement() } else { sf.keyboard.press({ keys: 'h' }) } sf.ui.logic.getMenuItem('Edit', 'Select Tracks', 'All').elementClick() var IsTrackVisibleReset = sf.ui.logic.selectedTrackNames.includes(trackName) if (IsTrackVisibleReset == true) { sf.ui.logic.getMenuItem('Edit', 'Select Tracks', 'Aux').elementClick() sf.ui.logic.trackSelectByName({ names: [trackName] }) sf.wait({ intervalMs: 200 }) if (TrackHButton.exists && TrackHButton.isCheckBoxChecked == true) { TrackHButton.mouseClickElement() } else if (FolderHButtonFolder.exists && FolderHButtonFolder.isCheckBoxChecked == true) { FolderHButtonFolder.mouseClickElement() Hbutton.mouseClickElement() } if (Hbutton.isCheckBoxChecked) { Hbutton.mouseClickElement() } } } else { sf.ui.logic.getMenuItem('Edit', 'Select Tracks', 'Aux').elementClick() sf.ui.logic.trackSelectByName({ names: [trackName] }) sf.wait({ intervalMs: 200 }) if (TrackHButton.exists && TrackHButton.isCheckBoxChecked == true) { TrackHButton.mouseClickElement() } else if (FolderHButtonFolder.exists && FolderHButtonFolder.isCheckBoxChecked == true) { FolderHButtonFolder.mouseClickElement() }; if (Hbutton.isCheckBoxChecked) { Hbutton.mouseClickElement() } } } }; function bounceMix() { sf.wait({ intervalMs: 200 }) // sf.ui.logic.invalidate() /// Continue to Bounce /// if (sf.ui.logic.windows.first.getElement("AXDefaultButton").exists) { sf.ui.logic.windows.first.getElement("AXDefaultButton").elementClick() }; sf.ui.logic.windows.first.splitGroups.first.splitGroups.first.elementWaitFor({ waitType: 'Appear', timeout: 1000, pollingInterval: 50, onError: "Continue" }); sf.ui.logic.windows.first.textFields.first.elementSetTextAreaValue({ value: nameMixDialog }); sf.wait({ intervalMs: 300 }) sf.ui.logic.windows.first.buttons.whoseTitle.is("Bounce").first.elementClick(); /// Replace if Exists Dialog /// if (sf.ui.logic.windows.first.sheets.first.children.whoseRole.is("AXStaticText"). whoseValue.is("A file or folder with the same name already exists in the folder Bounces. Replacing it will overwrite its current contents.").first.exists) { sf.ui.logic.windows.first.sheets.first.buttons.whoseTitle.is("Replace").first.elementClick() }; if (sf.ui.logic.windows.whoseDescription.is("alert").first.children.whoseRole.is("AXStaticText").whoseValue.is("Replace the file or save with a unique file name?").first.exists) { sf.ui.logic.windows.whoseDescription.is("alert").first.buttons.whoseTitle.is("Replace").first.elementClick() }; sf.wait({ intervalMs: 2000 }) if (sf.ui.logic.windows.whoseTitle.is("Logic Pro").first.children.whoseRole.is("AXStaticText").whoseValue.is("Bouncing…").first.exists) { while (sf.ui.logic.windows.whoseTitle.is("Logic Pro").first.children.whoseRole.is("AXStaticText").whoseValue.is("Bouncing…").first.exists) { sf.wait({ intervalMs: 300 }) }; }; }; function importBounceIntoSession() { sf.ui.logic.getMenuItem('Navigate', 'Go To', 'Left Locator').elementClick() sf.ui.logic.menuClick({ menuPath: ['File', 'Import', 'Audio File'], looseMatch: true, forceClick: true }) while (!sf.ui.logic.windows.whoseTitle.is("Open File").first.splitGroups.first.splitGroups.first.exists) { sf.wait({ intervalMs: 300 }) }; sf.keyboard.press({ keys: 'shift+cmd+g' }) while (!sf.ui.logic.windows.whoseTitle.is("Open File").first.sheets.first.textFields.first.exists) { sf.wait({ intervalMs: 300 }) } sf.ui.logic.windows.whoseTitle.is("Open File").first.sheets.first.textFields.first.elementSetTextAreaValue({ value: `${BouncesFolderPath}/${nameMixDialog}` }) sf.wait({ intervalMs: 500 }) sf.keyboard.press({ keys: 'enter' }) sf.wait({ intervalMs: 500 }) sf.keyboard.press({ keys: 'enter' }) sf.wait({ intervalMs: 500 }) if (sf.ui.logic.windows.whoseDescription.is("alert").first.buttons.whoseTitle.is("Convert File").first.exists) { sf.ui.logic.windows.whoseDescription.is("alert").first.buttons.whoseTitle.is("Convert File").first.elementClick() }; }; function bounceListVariables() { //////// List Variables ////////// if (bounceMix44100 || bounceMix48000 || bounceMixMp3) { preBounceSettings(); /// 44100 & Mp3 /// if (bounceMix44100 && bounceMixMp3) { if (!MP3.isCheckBoxChecked) { MP3.checkboxSet({ targetValue: 'Enable' }) }; SettingsMP3(); if (!PCM.isCheckBoxChecked) { PCM.checkboxSet({ targetValue: 'Enable' }) }; SettingsAIFF44100(); /// 44100 /// } else if (bounceMix44100) { if (MP3.isCheckBoxChecked) { MP3.checkboxSet({ targetValue: 'Disable' }) }; if (!PCM.isCheckBoxChecked) { PCM.checkboxSet({ targetValue: 'Enable' }) }; SettingsAIFF44100(); /// 48000 /// } else if (bounceMix48000) { if (MP3.isCheckBoxChecked) { MP3.checkboxSet({ targetValue: 'Disable' }) }; if (!PCM.isCheckBoxChecked) { PCM.checkboxSet({ targetValue: 'Enable' }) }; SettingsAIFF48000(); /// Mp3 /// } else if (bounceMixMp3) { if (!MP3.isCheckBoxChecked) { MP3.checkboxSet({ targetValue: 'Enable' }) }; if (PCM.isCheckBoxChecked) { PCM.checkboxSet({ targetValue: 'Disable' }) }; SettingsMP3(); }; bounceMix(); if (imporMixIntoSession) { unhideTrack('PRINT'); importBounceIntoSession(); }; }; /// Stems /// if (bounceStems) { var StemFolderTrackstoBounce = [] if (StemsToBounce.filter(i => i.includes('Drums Stem'))[0] === 'Drums Stem') { var DrumsStem = StemsToBounce.filter(i => i.includes('Drums Stem'))[0].replace('Drums Stem', '[DRMS]') StemFolderTrackstoBounce.push(DrumsStem) } if (StemsToBounce.filter(i => i.includes('Bass Stem'))[0] === 'Bass Stem') { var BassStem = StemsToBounce.filter(i => i.includes('Bass Stem'))[0].replace('Bass Stem', '[BASS]') StemFolderTrackstoBounce.push(BassStem) } if (StemsToBounce.filter(i => i.includes('Gtrs Stem'))[0] === 'Gtrs Stem') { var GtrsStem = StemsToBounce.filter(i => i.includes('Gtrs Stem'))[0].replace('Gtrs Stem', '[GTRS]') StemFolderTrackstoBounce.push(GtrsStem) } if (StemsToBounce.filter(i => i.includes('Keys Stem'))[0] === 'Keys Stem') { var KeysStem = StemsToBounce.filter(i => i.includes('Keys Stem'))[0].replace('Keys Stem', '[KEYS]') StemFolderTrackstoBounce.push(KeysStem) } if (StemsToBounce.filter(i => i.includes('Perc Stem'))[0] === 'Perc Stem') { var PercStem = StemsToBounce.filter(i => i.includes('Perc Stem'))[0].replace('Perc Stem', '[PERC]') StemFolderTrackstoBounce.push(PercStem) } if (StemsToBounce.filter(i => i.includes('Orch Stem'))[0] === 'Orch Stem') { var OrchStem = StemsToBounce.filter(i => i.includes('Orch Stem'))[0].replace('Orch Stem', '[ORCH]') StemFolderTrackstoBounce.push(OrchStem) } if (StemsToBounce.filter(i => i.includes('VO Stem'))[0] === 'VO Stem') { var VOStem = StemsToBounce.filter(i => i.includes('VO Stem'))[0].replace('VO Stem', '[VO]') StemFolderTrackstoBounce.push(VOStem) }; for (let i = 0; i < StemFolderTrackstoBounce.length; i++) { sf.ui.logic.invalidate() sf.ui.logic.trackSelectByName({ names: [StemFolderTrackstoBounce[i]] }) sf.keyboard.press({ keys: 's' }) preBounceSettings(); if (MP3.isCheckBoxChecked) { MP3.checkboxSet({ targetValue: 'Disable' }) }; if (!PCM.isCheckBoxChecked) { PCM.checkboxSet({ targetValue: 'Enable' }) }; SettingsAIFF44100(); sf.wait({ intervalMs: 200 }) /// Continue to Bounce /// if (sf.ui.logic.windows.first.getElement("AXDefaultButton").exists) { sf.ui.logic.windows.first.getElement("AXDefaultButton").elementClick() }; sf.ui.logic.windows.first.splitGroups.first.splitGroups.first.elementWaitFor({ waitType: 'Appear', timeout: 1000, pollingInterval: 50, onError: "Continue" }); sf.ui.logic.windows.first.textFields.first.elementSetTextAreaValue({ value: nameMixDialog + '_' + StemsToBounce[i] }); sf.wait({ intervalMs: 300 }) sf.ui.logic.windows.first.buttons.whoseTitle.is("Bounce").first.elementClick(); /// Replace if Exists Dialog /// if (sf.ui.logic.windows.first.sheets.first.children.whoseRole.is("AXStaticText"). whoseValue.is("A file or folder with the same name already exists in the folder Bounces. Replacing it will overwrite its current contents.").first.exists) { sf.ui.logic.windows.first.sheets.first.buttons.whoseTitle.is("Replace").first.elementClick() }; if (sf.ui.logic.windows.whoseDescription.is("alert").first.children.whoseRole.is("AXStaticText").whoseValue.is("Replace the file or save with a unique file name?").first.exists) { sf.ui.logic.windows.whoseDescription.is("alert").first.buttons.whoseTitle.is("Replace").first.elementClick() }; sf.wait({ intervalMs: 2000 }) if (sf.ui.logic.windows.whoseTitle.is("Logic Pro").first.children.whoseRole.is("AXStaticText").whoseValue.is("Bouncing…").first.exists) { while (sf.ui.logic.windows.whoseTitle.is("Logic Pro").first.children.whoseRole.is("AXStaticText").whoseValue.is("Bouncing…").first.exists) { sf.wait({ intervalMs: 300 }) }; }; sf.ui.logic.trackSelectByName({ names: [StemFolderTrackstoBounce[i]] }) sf.keyboard.press({ keys: 's' }) if (imporMixIntoSession) { unhideTrack('STEMS') let isFolderOpen = sf.ui.logic.mainWindow.groups.whoseDescription.is("Tracks").first.groups.whoseDescription.is("Tracks").allItems[1].splitGroups.first.splitGroups. allItems[1].scrollAreas.first.groups.whoseDescription.is("Tracks header").first.children.whoseRole.is("AXLayoutItem").allItems[1].children. whoseRole.is("AXDisclosureTriangle").first if (isFolderOpen.isCheckBoxChecked == false) { isFolderOpen.mouseClickElement() }; sf.ui.logic.invalidate() sf.ui.logic.getMenuItem('Edit', 'Select Tracks', 'All').elementClick() // Reset Names // sf.ui.logic.selectedTrackNames sf.ui.logic.getMenuItem('Edit', 'Select Tracks', 'Aux').elementClick() sf.wait({ intervalMs: 300 }) sf.ui.logic.trackSelectByName({ names: [StemsToBounce[i]] }) sf.ui.logic.appActivateMainWindow() sf.ui.logic.getMenuItem('Navigate', 'Go To', 'Left Locator').elementClick() sf.ui.logic.menuClick({ menuPath: ['File', 'Import', 'Audio File'], looseMatch: true, forceClick: true }) while (!sf.ui.logic.windows.whoseTitle.is("Open File").first.splitGroups.first.splitGroups.first.exists) { sf.wait({ intervalMs: 300 }) }; sf.keyboard.press({ keys: 'shift+cmd+g' }) while (!sf.ui.logic.windows.whoseTitle.is("Open File").first.sheets.first.textFields.first.exists) { sf.wait({ intervalMs: 300 }) } let stemsNameInLoop = `${BouncesFolderPath}/${nameMixDialog}_${StemsToBounce[i]}` sf.ui.logic.windows.whoseTitle.is("Open File").first.sheets.first.textFields.first.elementSetTextAreaValue({ value: stemsNameInLoop }) sf.wait({ intervalMs: 500 }) sf.keyboard.press({ keys: 'enter' }) sf.wait({ intervalMs: 500 }) sf.keyboard.press({ keys: 'enter' }) sf.wait({ intervalMs: 500 }) if (sf.ui.logic.windows.whoseDescription.is("alert").first.buttons.whoseTitle.is("Convert File").first.exists) { sf.ui.logic.windows.whoseDescription.is("alert").first.buttons.whoseTitle.is("Convert File").first.elementClick() }; }; }; } }; bounceListVariables(); if (BounceCasa.filter(i => !i.includes('▫️ Import Mix Into Session'))) { alert('DONE') } else { alert("Mix(es) Imported Into Session") }
- NIn reply toNicolas_Aparicio⬆:Nicolas Aparicio @Nicolas_Aparicio
Quick update:
I bypassed lines 514 to 519 to avoid these checkboxes and everything is working fine and loops until the end.
I'll be curious if this can still be fixed otherwise I'll change the code around so actions get triggered in a different order.Thanks.