Highlighted

Changing Audio Preferences with Extendscript?

Explorer ,
Feb 25, 2020

Copy link to clipboard

Copied

I'm trying to make a script that can change settings in Premiere using Extendscript - similar to this thread https://community.adobe.com/t5/premiere-pro/is-it-possible-change-adobe-premiere-preferences-using-e...

 

My idea is to eventually turn it into an extension panel with common settings to avoid digging in the preferences menu.

 

I have managed to make it work when changing Audio Default Keyframe Duration, but now I am trying to make it work for the Audio Hardware Setup, specifically the default output. I've found the setting int the preferences file under  'App.Prefs.AudioHardwareSetup' but this setting is not a simple string, number or bool, but seemingly an object? I have tried using app.properties.setProperty() but it doesn't seem to work.

 

Here is a code sample. can this be done? Any help much appreciated!

 

//SETUP VARS
var prefToModify = 'App.Prefs.AudioHardwareSetup';
var appProperties = app.properties;
var newValue = '{"abe.io.audio.classes":[{"abe.io.audio.class.default":true,"abe.io.audio.class.id":1668248165,"abe.io.audio.coreaudio.inputdevicename":"Display Audio","abe.io.audio.coreaudio.inputdeviceuid":"AppleUSBAudioEngine:Apple Inc.:Display Audio:161902EC:2,1","abe.io.audio.coreaudio.ioblocksize":512,"abe.io.audio.coreaudio.masterdevice":false,"abe.io.audio.coreaudio.max.ioblocksize":2048,"abe.io.audio.coreaudio.min.ioblocksize":16,"abe.io.audio.coreaudio.outputdevicename":"Display Audio","abe.io.audio.coreaudio.outputdeviceuid":"AppleUSBAudioEngine:Apple Inc.:Display Audio:161902EC:2,1","abe.io.audio.coreaudio.samplerate":48000,"abe.io.audio.coreaudio.srvalue":[44100,48000]}],"abe.io.audio.outputonly":false,"abe.io.audio.userdata":{"PrefDontShowAgain_DeviceListChange":{"type":"bool","value":true},"abe.io.audio.DefaultDeviceClassID":{"type":"std::uint32_t","value":1668248165},"kPrefDontShowAgain_PerformDeviceChange":{"type":"bool","value":false}}}';

// DOING THE ACTUAL CHANGING
if (appProperties){
var propertyExists = app.properties.doesPropertyExist(prefToModify);
var propertyIsReadOnly = app.properties.isPropertyReadOnly(prefToModify);
var originalValue = app.properties.getProperty(prefToModify);

alert(appProperties.getProperty(prefToModify));

appProperties.setProperty(prefToModify, newValue, 1);
var safetyCheck = app.properties.getProperty(prefToModify);
if (safetyCheck == 'false') {
    alert("False");
} else {
    alert("Success?.");
}
} else {
    alert("Properties not found.");
}

 

In a prefs file containing the 'canonical' settings you want to copy, aren't there several other preferences, other than App.Prefs.AudioHardwareSetup, that need to be changed? 

0 Delete PPro prefs.

1 Launch PPro.

2 Immediately close PPro.

3 Make a copy of prefs, "Before".

4 Launch PPro.
5 Set preferences as you want them to be.

6 Close PPro.

7 Compare the 'before' prefs, to the current prefs; I think you'll find a few other preferences are changed.

TOPICS
Audio, Error or problem, How to, SDK

Views

230

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Changing Audio Preferences with Extendscript?

Explorer ,
Feb 25, 2020

Copy link to clipboard

Copied

I'm trying to make a script that can change settings in Premiere using Extendscript - similar to this thread https://community.adobe.com/t5/premiere-pro/is-it-possible-change-adobe-premiere-preferences-using-e...

 

My idea is to eventually turn it into an extension panel with common settings to avoid digging in the preferences menu.

 

I have managed to make it work when changing Audio Default Keyframe Duration, but now I am trying to make it work for the Audio Hardware Setup, specifically the default output. I've found the setting int the preferences file under  'App.Prefs.AudioHardwareSetup' but this setting is not a simple string, number or bool, but seemingly an object? I have tried using app.properties.setProperty() but it doesn't seem to work.

 

Here is a code sample. can this be done? Any help much appreciated!

 

//SETUP VARS
var prefToModify = 'App.Prefs.AudioHardwareSetup';
var appProperties = app.properties;
var newValue = '{"abe.io.audio.classes":[{"abe.io.audio.class.default":true,"abe.io.audio.class.id":1668248165,"abe.io.audio.coreaudio.inputdevicename":"Display Audio","abe.io.audio.coreaudio.inputdeviceuid":"AppleUSBAudioEngine:Apple Inc.:Display Audio:161902EC:2,1","abe.io.audio.coreaudio.ioblocksize":512,"abe.io.audio.coreaudio.masterdevice":false,"abe.io.audio.coreaudio.max.ioblocksize":2048,"abe.io.audio.coreaudio.min.ioblocksize":16,"abe.io.audio.coreaudio.outputdevicename":"Display Audio","abe.io.audio.coreaudio.outputdeviceuid":"AppleUSBAudioEngine:Apple Inc.:Display Audio:161902EC:2,1","abe.io.audio.coreaudio.samplerate":48000,"abe.io.audio.coreaudio.srvalue":[44100,48000]}],"abe.io.audio.outputonly":false,"abe.io.audio.userdata":{"PrefDontShowAgain_DeviceListChange":{"type":"bool","value":true},"abe.io.audio.DefaultDeviceClassID":{"type":"std::uint32_t","value":1668248165},"kPrefDontShowAgain_PerformDeviceChange":{"type":"bool","value":false}}}';

// DOING THE ACTUAL CHANGING
if (appProperties){
var propertyExists = app.properties.doesPropertyExist(prefToModify);
var propertyIsReadOnly = app.properties.isPropertyReadOnly(prefToModify);
var originalValue = app.properties.getProperty(prefToModify);

alert(appProperties.getProperty(prefToModify));

appProperties.setProperty(prefToModify, newValue, 1);
var safetyCheck = app.properties.getProperty(prefToModify);
if (safetyCheck == 'false') {
    alert("False");
} else {
    alert("Success?.");
}
} else {
    alert("Properties not found.");
}

 

In a prefs file containing the 'canonical' settings you want to copy, aren't there several other preferences, other than App.Prefs.AudioHardwareSetup, that need to be changed? 

0 Delete PPro prefs.

1 Launch PPro.

2 Immediately close PPro.

3 Make a copy of prefs, "Before".

4 Launch PPro.
5 Set preferences as you want them to be.

6 Close PPro.

7 Compare the 'before' prefs, to the current prefs; I think you'll find a few other preferences are changed.

TOPICS
Audio, Error or problem, How to, SDK

Views

231

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Feb 25, 2020 0
Adobe Employee ,
Feb 26, 2020

Copy link to clipboard

Copied

In a prefs file containing the 'canonical' settings you want to copy, aren't there several other preferences, other than App.Prefs.AudioHardwareSetup, that need to be changed? 

0 Delete PPro prefs.

1 Launch PPro.

2 Immediately close PPro.

3 Make a copy of prefs, "Before".

4 Launch PPro.
5 Set preferences as you want them to be.

6 Close PPro.

7 Compare the 'before' prefs, to the current prefs; I think you'll find a few other preferences are changed.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 26, 2020 0
Explorer ,
Feb 26, 2020

Copy link to clipboard

Copied

Hey @bbb_999,

 

You're absolutely right there's heaps more being changed behind the scenes, including some things that seem to have nothing to do with the audio.

 

Seems like it's probably just too much hassle. bit of a shame as I think it would be a really useful feature for people working with clients to be able to switch it!

 

Thanks for your response!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 26, 2020 0
Adobe Employee ,
Feb 27, 2020

Copy link to clipboard

Copied

I know at least a few broadcasters are managing audio preferences, using the manner I described. 🙂 
You'll see some preference keys with crazy, GUID-like names; those are the ones you'd need to manage.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 27, 2020 0
Explorer ,
Feb 27, 2020

Copy link to clipboard

Copied

Oh, so it's possible!

 

That's great to hear. I don't suppose you could put me in contact with one of them? Understand if not but it would be great to hear from them how to do it properly.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 27, 2020 0
Adobe Employee ,
Feb 28, 2020

Copy link to clipboard

Copied

Sorry I can't, but I do know at least some of them frequent these forums. 

They're following the same instructions I provided, above. 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 28, 2020 0
New Here ,
Oct 29, 2020

Copy link to clipboard

Copied

@Megaman9 Did you ever get a script working for this? I use bluetooth headphones for normal editing, but speakers to do my audio clip adjustments, and it's a pain to have to go into the preferences menu every time I want to change it. I'd love just a panel or script that I could easily use to change the settings.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 29, 2020 0
Adobe Employee ,
Oct 29, 2020

Copy link to clipboard

Copied

Have you tried following the provided instructions? They work. 🙂

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 29, 2020 0
New Here ,
Oct 29, 2020

Copy link to clipboard

Copied

@Bruce Bullis I don't know how to write scripts. I was hoping he could provide the file that he uses.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 29, 2020 0
Adobe Employee ,
Oct 29, 2020

Copy link to clipboard

Copied

Ahhh, sorry.

 

Unless your configuration is nearly identical to MegaMan9's, using his prefs won't work correctly on your system.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 29, 2020 1
New Here ,
Oct 29, 2020

Copy link to clipboard

Copied

Okay thanks! (that last reply was also from me. I was logged into the wrong account).

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 29, 2020 0
Explorer ,
Oct 29, 2020

Copy link to clipboard

Copied

Hey @MikeDiliberto !

I tried a few times to get Bruce's instructions to work but it never worked for me for whatever reason. However I did come up with something else.

 

You can set a keyboard shortcut directly to "Audio Hardware Settings". After that I made a macro using Keyboard Maestro on Mac (you could use autohotkey if your on pc) to press the shortcut key, press tab the correct amount of times to get to the drop-down, and press either up or down to change the hardware, then change a variable in the macro to make sure it did the opposite direction next time it was activated. This worked well.

 

Are you on Mac or PC? I can help you set up the script.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 29, 2020 0
New Here ,
Oct 30, 2020

Copy link to clipboard

Copied

Thanks for responding! I didn't even think about using a hotkey, that's a great idea. I'm on windows and just installed AutoHotkey. Any tips on how to set up a script for this? I've never used this before.

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 30, 2020 0