Anyone know why this isn't working? It can easily switch from B to A (the 'AXDecrement'
) but can't seem to go from A to B (the 'AXIncrement'
). Is it somehow the initValue
is not 0
?
var pluginWin = sf.ui.proTools.windows.whoseTitle.is("Plug-in: ADPTR MetricAB").first
var pluginView = pluginWin.groups.whoseTitle.is("FXTDMEditView").first
if (!pluginView.exists) throw "Could Not Find MetricAB";
//Use this to log a list of all parameter names:
//log(pluginView.children.map(c => c.title.value).join('\n'));
//throw 0;
var parameterControl = pluginView.children.whoseTitle.is('AB Switch').first;
//Toggle A/B
if (parameterControl.value.invalidate().intValue === 0) {
parameterControl.elementClick({
actionName: 'AXIncrement'
});
} else {
parameterControl.elementClick({
actionName: 'AXDecrement'
});
}
Linked from:
- SSoundFlow Bot @soundflowbot
Thanks for posting a question or an issue related to the 'Dreamcatcher ADPTR Metric A/B Toggle Switch' package.
This package is made by @Dreamcatcher_Studio. We're auto-tagging them here so that they will hopefully be able to help you.Please note, that the best way to get help with a script, macro or other content installed from the Store is to select the script you installed, then click the red Need help button, and then click "Get help with this script or macro".
By using this workflow, the developer of the package will get access to more information so they'll be able to help you quicker.
You can read more about how to best get help in this article: bit.ly/sfscripthelpDustin Harris @Dustin_Harris
Maybe it’s a checkbox instead of a ‘slider’?
Nathan Salefski @nathansalefski
I tried
'AXPress'
as well but that didn't seem to work. How do I word it to work for something that is a checkbox?Dustin Harris @Dustin_Harris
try this; Its a shot in the dark since I don't have this plugin:
var pluginWin = sf.ui.proTools.windows.whoseTitle.is("Plug-in: ADPTR MetricAB").first var pluginView = pluginWin.groups.whoseTitle.is("FXTDMEditView").first if (!pluginView.exists) throw "Could Not Find MetricAB"; var parameterControl = pluginView.children.whoseTitle.is('AB Switch').first; parameterControl.checkboxSet({ targetValue: "Toggle" })
Nathan Salefski @nathansalefski
Unfortunately that's not working either. It's a very strange behavior. If I manually click the button once (switching it from A to B),
parameterControl.elementClick({actionName: 'AXIncrement'});
,parameterControl.elementClick({actionName: 'AXDecrement'});
andparameterControl.elementClick({actionName: 'AXPress'});
all work perfectly to switch it back (switching from B to A). I have no idea what the issue could be. @chrscheuer any ideas?Dustin Harris @Dustin_Harris
I downloaded the plugin, the button is actually a slider with two values: A is 0, and B is 2047. They are not settable director or with AXPress. SO, you can do a mouse click element conditionally:
var pluginWin = sf.ui.proTools.windows.whoseTitle.is("Plug-in: ADPTR MetricAB").first var pluginView = pluginWin.groups.whoseTitle.is("FXTDMEditView").first if (!pluginView.exists) throw "Could Not Find MetricAB"; //Use this to log a list of all parameter names: //log(pluginView.children.map(c => c.title.value).join('\n')); //throw 0; var parameterControl = pluginView.children.whoseTitle.is('AB Switch').first; if (parameterControl.value.invalidate().intValue === 0) { log('Button set to A') } else if ((parameterControl.value.invalidate().intValue === 2047)) { log('Button set to B') }
Nathan Salefski @nathansalefski
Thanks for taking the time to do that! I knew something had to be weird about it. I heard SoundFlow will soon be able to change Stream Deck icons based on the status of a script, is that functionality out yet? If not is there a way to have momentary alerts that dismiss by themselves? For instance:
var pluginWin = sf.ui.proTools.windows.whoseTitle.is("Plug-in: ADPTR MetricAB").first var pluginView = pluginWin.groups.whoseTitle.is("FXTDMEditView").first if (!pluginView.exists) throw "Could Not Find MetricAB"; //Use this to log a list of all parameter names: //log(pluginView.children.map(c => c.title.value).join('\n')); //throw 0; pluginWin.getElement("AXCloseButton").mouseClickElement({ relativePosition: {"x":143,"y":572},}); var parameterControl = pluginView.children.whoseTitle.is('AB Switch').first; if (parameterControl.value.invalidate().intValue === 0) { alert('Main Mix') } else if ((parameterControl.value.invalidate().intValue === 2047)) { alert('Reference') }
Dustin Harris @Dustin_Harris
Yeah, using log() instead of alert() produces a momentary notification :)
Nathan Salefski @nathansalefski
Awesome thank you!
- In reply toDustin_Harris⬆:
Nathan Salefski @nathansalefski
Any idea when Icon Status changes will be implemented?
Dustin Harris @Dustin_Harris
Not sure to be honest, that’s a @Kitch question :)
- In reply tonathansalefski⬆:
Kitch Membery @Kitch2023-08-08 23:39:34.885Z
Hi @nathansalefski,
Meta Command functionality that was introduced in SoundFlow 5.4 allows for the creation of single dynamic commands, however, due to the complexity of creating Meta Commands is reserved for developers only. If you have suggestions/requests for this sort of functionality please be sure to ask in the ideas section of the forum, that way they'll be logged for consideration in future versions of SoundFlow.
Thanks in advance.
Nathan Salefski @nathansalefski
Understood. While I have you here, @Dustin_Harris mentioned the parameter I'm trying to control is a slider. I saw here you were able to adjust the value of a slider in RX here RX Gain #post-11. Is it possible to do this in this instance?
sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.invalidate() //Click AB Function function aB() { var pluginWin = sf.ui.proTools.windows.whoseTitle.is("Plug-in: ADPTR MetricAB").first var pluginView = pluginWin.groups.whoseTitle.is("FXTDMEditView").first var parameterControl = pluginView.sliders.whoseTitle.is('AB Switch').first; const currentValue = Number(parameterControl.value.invalidate().intValue); if (currentValue === 0) { //Set Value to 2047 then log('Reference') } else if ((currentValue === 2047)) { //Set Value to 0 then log('Main Mix') } } aB();
Dustin Harris @Dustin_Harris
For that particular ‘slider’ seems to have 11-bit resolution but only two values (0, 2047) so even if you could use AxIncrement/decrement (which I don’t think you can?) you’d have to run it in a loop 2048 times. It’s much easier to use elementClick as you already have the element as a variable :)
- In reply tonathansalefski⬆:
Kitch Membery @Kitch2023-08-09 02:19:23.504Z
Hi @nathansalefski,
This is probably something that we'd need to implement internally as the slider values are bespoke for most parameters and the script would require some more complex logic. But it's certainly something that we'll look into. :-)
Nathan Salefski @nathansalefski
Fantastic. Thank you both very much @Dustin_Harris @Kitch. I put up a post for full integration in the ideas forum as suggested. If you’re not a user this plugin is incredibly helpful. I can’t mix without it
Dustin Harris @Dustin_Harris
The plug-in looks cool and well-designed, but I’m a post editor :)
Nathan Salefski @nathansalefski
That's awesome. It could still have some use to reference previous versions of your edits to the current but I definitely think it's more geared towards mixing music.
Dustin Harris @Dustin_Harris
here's a version of the script I made out of interest. It's using a newer version of the plugin so some of the element names have changed, but I think you'll be able to adapt it for your needs :)
function clickAbButton() { let position = sf.mouse.getPosition().position; let pluginWin = sf.ui.proTools.getAudioSuiteWindow("ADPTR MetricAB"); let f = pluginWin.frame; sf.mouse.setPosition({ position: { x: f.x + 145, y: f.y + 601 } }); sf.mouse.click({ position: { x: f.x + 145, y: f.y + 601 } }); sf.mouse.setPosition({position}); } function main() { sf.ui.proTools.appActivateMainWindow(); let pluginWin = sf.ui.proTools.getAudioSuiteWindow("ADPTR MetricAB"); let controlGroup = pluginWin.groups.whoseTitle.is("PluginView").first; let abSwitch = controlGroup.children.whoseTitle.is('AB Switch').first; clickAbButton(); if (abSwitch.value.invalidate().intValue === 0) { log('Button set to A') } else if ((abSwitch.value.invalidate().intValue === 2047)) { log('Button set to B') } } main();
Nathan Salefski @nathansalefski
Amazing. Thanks! I had something similar but implementing the secondary function is working great. The only gripe I have is when switching back and fourth frequently the log ends up taking up a lot of screen space. Other than that it's working perfectly.
sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.invalidate() let pluginWin = sf.ui.proTools.windows.whoseTitle.is("Plug-in: ADPTR MetricAB").first; function clickButton() { let position = sf.mouse.getPosition().position; let f = pluginWin.frame; sf.mouse.setPosition({ position: { x: f.x + 145, y: f.y + 601 } }); sf.mouse.click({ position: { x: f.x + 145, y: f.y + 601 } }); sf.mouse.setPosition({position}); } function aB() { clickButton(); var pluginView = pluginWin.groups.whoseTitle.is("FXTDMEditView").first var parameterControl = pluginView.children.whoseTitle.is('AB Switch').first; if (parameterControl.value.invalidate().intValue === 0) { log('Main Mix') } else if ((parameterControl.value.invalidate().intValue === 2047)) { log('Reference') } } function main() { //Select Monitor Track sf.ui.proTools.trackSelectByName({ names: ["MONITOR"],}); //Open "Insert 1" sf.ui.proTools.selectedTrack.trackInsertToggleShow({ insertNumber: 1,}); //Wait for Plugin Window to Appear pluginWin.elementWaitFor({waitType: "Appear"}); //AB Function aB(); //Close "Insert 1" sf.ui.proTools.selectedTrack.trackInsertToggleShow({ insertNumber: 1,}); //Wait for Plugin Window to Disappear pluginWin.elementWaitFor({waitType: "Disappear"}); } main();
- MIn reply tonathansalefski⬆:Marek Romanowski @Marek_Romanowski
Hi, I follow your advices guys and still can't get it work...
Behaviour of this script - "....It can easily switch from B to A (the 'AXDecrement') but can't seem to go from A to B (the 'AXIncrement')..."
Could you please give me entire script?
Maybe I am doing something wrong when pasting...
@nathansalefski ? @Dustin_Harris ?Nathan Salefski @nathansalefski
You're not. Internally the value for A is 0 but the value for B is 2047. 'AXIncrement' increases values by 1 so you'd need to 'AXIncrement' 2047 times in order to get from A to B. A work around for me is simply clicking the UI itself, like below.
function clickButton(buttonPosition) { let position = sf.mouse.getPosition().position; sf.mouse.setPosition({ position: buttonPosition }); sf.mouse.click({ position: buttonPosition }); sf.mouse.setPosition({ position }); } function aB(pluginWin, buttonPosition) { // Clicks A|B Button clickButton(buttonPosition); // Logs Button State let pluginView = pluginWin.groups.whoseTitle.is("FXTDMEditView").first let parameterControl = pluginView.children.whoseTitle.is('AB Switch').first; if (parameterControl.value.invalidate().intValue === 0) { log('Main Mix'); } else if (parameterControl.value.invalidate().intValue === 2047) { log('Reference'); } } function main() { sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.invalidate(); let pluginWin = sf.ui.proTools.windows.whoseTitle.is("Plug-in: ADPTR MetricAB").first; let buttonPosition = { x: pluginWin.frame.x + 145, y: pluginWin.frame.y + 601 }; const monitorTrack = sf.ui.proTools.trackGetByName({ name: "MONITOR" }).track; // Select Track by Name: 'Monitor' if (!monitorTrack.isSelected) { sf.ui.proTools.trackSelectByName({ names: ["MONITOR"] }); } // Toggle Insert: 1 sf.ui.proTools.selectedTrack.trackInsertToggleShow({ insertNumber: 1 }); // Wait for Plugin Window to Appear pluginWin.elementWaitFor(); // A|B Function: Clicks A|B button and logs button state aB(pluginWin, buttonPosition); // If you'd rather not log button state, use: // clickButton(buttonPosition); // Toggle Insert: 1 sf.ui.proTools.selectedTrack.trackInsertToggleShow({ insertNumber: 1 }); // Wait for Plugin Window to Disappear pluginWin.elementWaitFor({ waitType: "Disappear" }); } main();
- MMarek Romanowski @Marek_Romanowski
Thanks a lot sir!
- AIn reply tonathansalefski⬆:Asi Tal @Asi_Tal
Hey,, Did you solved this issue? I have a script that can only switch from B to A.
I would appreciate it a lot if you could help me with this issue.
Thanks!!
@nathansalefski- In reply toAsi_Tal⬆:
Nathan Salefski @nathansalefski
This should do the trick ADPTR MetricAB Toggle #post-23
- AAsi Tal @Asi_Tal
Thanks.. unfortunatly I keep getting error messages..
- AAsi Tal @Asi_Tal
Is this the entire script you uses? (ADPTR MetricAB Toggle #post-23)
@nathansalefskiNathan Salefski @nathansalefski
function clickButton(buttonPosition) { let position = sf.mouse.getPosition().position; sf.mouse.setPosition({ position: buttonPosition }); sf.mouse.click({ position: buttonPosition }); sf.mouse.setPosition({ position }); } function aB(pluginWin, buttonPosition) { // Clicks A|B Button clickButton(buttonPosition); // Logs Button State let pluginView = pluginWin.groups.whoseTitle.is("FXTDMEditView").first let parameterControl = pluginView.children.whoseTitle.is('AB Switch').first; if (parameterControl.value.invalidate().intValue === 0) { log('Main Mix'); } else if (parameterControl.value.invalidate().intValue === 2047) { log('Reference'); } } function main() { sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.invalidate(); let pluginWin = sf.ui.proTools.windows.whoseTitle.is("Plug-in: ADPTR MetricAB").first; let buttonPosition = { x: pluginWin.frame.x + 145, y: pluginWin.frame.y + 601 }; const monitorTrack = sf.ui.proTools.trackGetByName({ name: "MONITOR" }).track; // Select Track by Name: 'Monitor' if (!monitorTrack.isSelected) { sf.ui.proTools.trackSelectByName({ names: ["MONITOR"] }); } // Toggle Insert: 1 sf.ui.proTools.selectedTrack.trackInsertToggleShow({ insertNumber: 1 }); // Wait for Plugin Window to Appear pluginWin.elementWaitFor(); // A|B Function: Clicks A|B button and logs button state aB(pluginWin, buttonPosition); // If you'd rather not log button state, use: // clickButton(buttonPosition); // Toggle Insert: 1 sf.ui.proTools.selectedTrack.trackInsertToggleShow({ insertNumber: 1 }); // Wait for Plugin Window to Disappear pluginWin.elementWaitFor({ waitType: "Disappear" }); } main();
- AAsi Tal @Asi_Tal
Thanks. still getting error message. I guess I'm doing something wrong.
The ADPTR plugin is on my Master and on slot 6 (if it helps)
@nathansalefskiNathan Salefski @nathansalefski
There are specific parameter you may need to adjust for it to work with your personal workflow like changing the track name in lines 37 and 41 and the insert number on lines 45 and 57.
- AAsi Tal @Asi_Tal
Yes, sorry , I'm really new with Soundflow and scripts.
I succeeded to over come this. Now It works but only if I manually click the AB plugin just to open it after I press the trigger.
I recorded my screen for reference . (link below)on 0:03 I press the trigger key
on 0:04 I click manually on the adptr plugin.and on the second try I didn't click manually on the plugin to open it and you can see the error message.
0:09 I press the trigger again
0:12 I receive the error message.Is there any way to fix it so I wouldn't need to click the AB plugin every time?
Thanks again for your help.
- In reply tonathansalefski⬆:AAsi Tal @Asi_Tal
Solved!!!
Needed to add this after line 45:targetValue: "Enable"
Thanks for your time!