Use environment variables in the audacity.cfg file?

This section is now closed.
Forum rules
Audacity 1.3.x is now obsolete. Please use the current Audacity 2.1.x version.

The final version of Audacity for Windows 98/ME is the legacy 2.0.0 version.
Locked
semo
Posts: 1
Joined: Thu Dec 23, 2010 9:06 am
Operating System: Please select

Use environment variables in the audacity.cfg file?

Post by semo » Thu Dec 23, 2010 1:15 pm

I need to set audacity to default to certain directories (i.e. not going to the program files when you go to File --> Open for the first time).

For example I'm trying to do something like this:

TempDir=%TMP%audacity_temp
PresetsDir=%APPDATA%RoamingAudacitypresets
DefaultOpenPath=%HOMEDRIVE%My Music

As far as I can understand, you can only use absolute paths which means I would have to use C# to generate the file once a user logs in and launches the app which is a bit beyond me (I can just about copy a template file to the user's roaming location).

Any suggestions?

Thanks

Gale Andrews
Quality Assurance
Posts: 41761
Joined: Fri Jul 27, 2007 12:02 am
Operating System: Windows 10

Re: Use environment variables in the audacity.cfg file?

Post by Gale Andrews » Fri Dec 24, 2010 11:43 pm

semo wrote:I need to set audacity to default to certain directories (i.e. not going to the program files when you go to File --> Open for the first time).

For example I'm trying to do something like this:

TempDir=%TMP%audacity_temp
PresetsDir=%APPDATA%RoamingAudacitypresets
DefaultOpenPath=%HOMEDRIVE%My Music

As far as I can understand, you can only use absolute paths which means I would have to use C# to generate the file once a user logs in and launches the app which is a bit beyond me (I can just about copy a template file to the user's roaming location).
Are you a network admin - is that why you need to force settings?

The user can set the temporary directory themselves in the Directories preferences, but it initialises by default to the directory you quote above anyway, so I don't know why you want to change it.

The PresetsDir also initialises by default to the directory you quote (on Vista/7). However I don't know offhand of any dialogue in Audacity that respects the PresetsDir in .cfg. FFmpeg custom export remembers the last used directory and other dialogues seem to always open in the user's Audacity data directory rather than the presets folder within that (irrespective of .cfg).

User can set the Open path themselves by opening a file - that directory will then always be used. Otherwise, Audacity Open path initialises to the app's working directory.

As a network admin you can write a script if you wish to modify your users' audacity.cfg when they log on (but yes I think the script will have to generate the required absolute path from the user's home directory). See if this information on ExpandEnvironmentStrings method helps.

If you require user to launch Audacity when they log on, place a shortcut to audacity.exe in the users' startup folder.



Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual

Locked