Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

asoundconf script

Status
Not open for further replies.

krammer

IS-IT--Management
Jul 15, 2007
59
US
Does anyone know how to make a asoundconf script for ubuntu/kubuntu to switch sound cards? What I can do now, is run:

sudo asoundconf set-default-card "Card name"

..in the command line to switch my default sound card. What I'm trying to do is make a script that I can run that will do this automatically when clicking it, so I don't have to run this from the command line every time. This will probably have to prompt me for my root password too...is this possible?
 
Yes

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those Who Say It Cannot Be Done Are Usually Interrupted by Someone Else Doing It; Give the wrong symptoms, get the wrong solutions;
 
Can you help me out with this? I'm a beginner with perl scripting and I don't know where to start...
 
You should look into system calls


If you can do it from command line already then you can just make a system call do it for you.

If you can do it from command line why not just make a shell script and double click on that?

Does that command you run prompt you for a password?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those Who Say It Cannot Be Done Are Usually Interrupted by Someone Else Doing It; Give the wrong symptoms, get the wrong solutions;
 
I actually did find out how to make the shell script, but I still couldn't just double click it and have it run...I had to link it to an application link and then double click that, and it worked. That command actually doesn't prompt me for a password because I put the permissions on it for my profile, and not root. But it would normally prompt for a password...

I'm still going to try and make it work with perl...I'll check out that link and see what I can do, thanks.
 
Yeah your basically looking at a two line script

#!/usr/bin/perl
`/path/to/sudo /path/to/asoundconf set-default-card "Card name"`;


or something :)
I'm not big on any desktops (everything I have is just cli ) but if that's the only way to do it I guess it will work for you.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those Who Say It Cannot Be Done Are Usually Interrupted by Someone Else Doing It; Give the wrong symptoms, get the wrong solutions;
 
Oh...I guess thats pretty much the same thing for a shell script...why can't anything ever be one file? lol. Ok thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top