Batch File for "Sounds and Audio Device" Property Sheet

J

jp

System: Windows XP
I currently have a batch file in my startup folder to launch the sheet. It
is simply written as:

"rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl"

Once the sheet is up, I have to manually check "Place volume icon in task
bar", then click [OK].

Is there a way via the batch file to automate this process so that the batch
file itself will both check the box and OK it's way out?

Don't ask why I have to do this - it's image-related. It's the only way I
can get the volume icon on the taskbar.

Thanks in advance.

jp
 
P

Pegasus \(MVP\)

jp said:
System: Windows XP
I currently have a batch file in my startup folder to launch the sheet. It
is simply written as:

"rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl"

Once the sheet is up, I have to manually check "Place volume icon in task
bar", then click [OK].

Is there a way via the batch file to automate this process so that the
batch
file itself will both check the box and OK it's way out?

Don't ask why I have to do this - it's image-related. It's the only way I
can get the volume icon on the taskbar.

Thanks in advance.

jp

This batch/VB Script hybrid works on my machine. Please note that it is
fragile: If a pop-up message interferes with it, e.g. a virus pattern file
update then it will fail.
@echo off
set delay=5000
start /b "" rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl
echo > "%temp%\Send.vbs" Set ws=CreateObject("WScript.Shell")
echo >>"%temp%\Send.vbs" WScript.Sleep(%delay%)
echo >>"%temp%\Send.vbs" ws.sendkeys("{Enter}")
cscript //nologo "%temp%\Send.vbs"
 
J

jp

Pegasus (MVP) said:
jp said:
System: Windows XP
I currently have a batch file in my startup folder to launch the sheet. It
is simply written as:

"rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl"

Once the sheet is up, I have to manually check "Place volume icon in task
bar", then click [OK].

Is there a way via the batch file to automate this process so that the
batch
file itself will both check the box and OK it's way out?

Don't ask why I have to do this - it's image-related. It's the only way I
can get the volume icon on the taskbar.

Thanks in advance.

jp

This batch/VB Script hybrid works on my machine. Please note that it is
fragile: If a pop-up message interferes with it, e.g. a virus pattern file
update then it will fail.
@echo off
set delay=5000
start /b "" rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl
echo > "%temp%\Send.vbs" Set ws=CreateObject("WScript.Shell")
echo >>"%temp%\Send.vbs" WScript.Sleep(%delay%)
echo >>"%temp%\Send.vbs" ws.sendkeys("{Enter}")
cscript //nologo "%temp%\Send.vbs"

Hi Pegasus,

Thank you for your time. The batch/script didn't work. The property sheet
does come up *and* go away on it's own, but the options and OK button are not
executed. I even tried to fiddle with the delay you had set in there (making
it longer) to no avail. You did issue the caveat that it was fragile and I'm
wondering whether or not the McAfee ePolicy Orchestrator and/or Host
Intrusion Prevention (neither of which do I have any admin control over) are
precluding this batch/script?
 
P

Pegasus \(MVP\)

jp said:
Pegasus (MVP) said:
jp said:
System: Windows XP
I currently have a batch file in my startup folder to launch the sheet.
It
is simply written as:

"rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl"

Once the sheet is up, I have to manually check "Place volume icon in
task
bar", then click [OK].

Is there a way via the batch file to automate this process so that the
batch
file itself will both check the box and OK it's way out?

Don't ask why I have to do this - it's image-related. It's the only way
I
can get the volume icon on the taskbar.

Thanks in advance.

jp

This batch/VB Script hybrid works on my machine. Please note that it is
fragile: If a pop-up message interferes with it, e.g. a virus pattern
file
update then it will fail.
@echo off
set delay=5000
start /b "" rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl
echo > "%temp%\Send.vbs" Set ws=CreateObject("WScript.Shell")
echo >>"%temp%\Send.vbs" WScript.Sleep(%delay%)
echo >>"%temp%\Send.vbs" ws.sendkeys("{Enter}")
cscript //nologo "%temp%\Send.vbs"

Hi Pegasus,

Thank you for your time. The batch/script didn't work. The property sheet
does come up *and* go away on it's own, but the options and OK button are
not
executed. I even tried to fiddle with the delay you had set in there
(making
it longer) to no avail. You did issue the caveat that it was fragile and
I'm
wondering whether or not the McAfee ePolicy Orchestrator and/or Host
Intrusion Prevention (neither of which do I have any admin control over)
are
precluding this batch/script?

You need to play a little more with the navigation keys that move you from
one tick box to the next, e.g. like so:
@echo off
set delay=5000
start /b "" rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl
echo > "%temp%\Send.vbs" Set ws=CreateObject("WScript.Shell")
echo >>"%temp%\Send.vbs" WScript.Sleep(%delay%)
echo >>"%temp%\Send.vbs" ws.sendkeys("{Tab}")
echo >>"%temp%\Send.vbs" WScript.Sleep(500)
echo >>"%temp%\Send.vbs" ws.sendkeys("{Tab}")
echo >>"%temp%\Send.vbs" WScript.Sleep(500)
echo >>"%temp%\Send.vbs" ws.sendkeys(" ")
echo >>"%temp%\Send.vbs" WScript.Sleep(5000)
echo >>"%temp%\Send.vbs" ws.sendkeys("{Enter}")
cscript //nologo "%temp%\Send.vbs"

Again this script is fragile: It will toggle the contents of the tick box,
regardless of what's there before. A direct registry hack might be far more
robust.

After finishing your testing session, you should temove the 5000 millisecond
delay before issuing the Enter command.
 
J

jp

Pegasus (MVP) said:
jp said:
Pegasus (MVP) said:
System: Windows XP
I currently have a batch file in my startup folder to launch the sheet.
It
is simply written as:

"rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl"

Once the sheet is up, I have to manually check "Place volume icon in
task
bar", then click [OK].

Is there a way via the batch file to automate this process so that the
batch
file itself will both check the box and OK it's way out?

Don't ask why I have to do this - it's image-related. It's the only way
I
can get the volume icon on the taskbar.

Thanks in advance.

jp


This batch/VB Script hybrid works on my machine. Please note that it is
fragile: If a pop-up message interferes with it, e.g. a virus pattern
file
update then it will fail.
@echo off
set delay=5000
start /b "" rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl
echo > "%temp%\Send.vbs" Set ws=CreateObject("WScript.Shell")
echo >>"%temp%\Send.vbs" WScript.Sleep(%delay%)
echo >>"%temp%\Send.vbs" ws.sendkeys("{Enter}")
cscript //nologo "%temp%\Send.vbs"

Hi Pegasus,

Thank you for your time. The batch/script didn't work. The property sheet
does come up *and* go away on it's own, but the options and OK button are
not
executed. I even tried to fiddle with the delay you had set in there
(making
it longer) to no avail. You did issue the caveat that it was fragile and
I'm
wondering whether or not the McAfee ePolicy Orchestrator and/or Host
Intrusion Prevention (neither of which do I have any admin control over)
are
precluding this batch/script?

You need to play a little more with the navigation keys that move you from
one tick box to the next, e.g. like so:
@echo off
set delay=5000
start /b "" rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl
echo > "%temp%\Send.vbs" Set ws=CreateObject("WScript.Shell")
echo >>"%temp%\Send.vbs" WScript.Sleep(%delay%)
echo >>"%temp%\Send.vbs" ws.sendkeys("{Tab}")
echo >>"%temp%\Send.vbs" WScript.Sleep(500)
echo >>"%temp%\Send.vbs" ws.sendkeys("{Tab}")
echo >>"%temp%\Send.vbs" WScript.Sleep(500)
echo >>"%temp%\Send.vbs" ws.sendkeys(" ")
echo >>"%temp%\Send.vbs" WScript.Sleep(5000)
echo >>"%temp%\Send.vbs" ws.sendkeys("{Enter}")
cscript //nologo "%temp%\Send.vbs"

Again this script is fragile: It will toggle the contents of the tick box,
regardless of what's there before. A direct registry hack might be far more
robust.

After finishing your testing session, you should temove the 5000 millisecond
delay before issuing the Enter command.


Pegasus!

Good show! It works - but there is still one TINY problem. I noticed that no
matter what I set the delay, the batch will launch directly after the startup
scripts are complete, THEN that is when the "delay" starts it's countdown.
The problem I'm encountering is the programs in the systray have yet to
complete loading. As they are doing so, the property sheet (how should I say
this?) does not "remain on top" if you will. In other words, although it is
the ONLY property sheet, it becomes inactive due to systray loading. I have
tested this on multiple logons - I can get it to work by simply hitting
Alt-Tab to make the sheet active. Is there a way within the hybrid you
created to keep the property sheet on top? Man...fine job!

jp
 
P

Pegasus \(MVP\)

jp said:
Pegasus (MVP) said:
jp said:
:


System: Windows XP
I currently have a batch file in my startup folder to launch the
sheet.
It
is simply written as:

"rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl"

Once the sheet is up, I have to manually check "Place volume icon in
task
bar", then click [OK].

Is there a way via the batch file to automate this process so that
the
batch
file itself will both check the box and OK it's way out?

Don't ask why I have to do this - it's image-related. It's the only
way
I
can get the volume icon on the taskbar.

Thanks in advance.

jp


This batch/VB Script hybrid works on my machine. Please note that it
is
fragile: If a pop-up message interferes with it, e.g. a virus pattern
file
update then it will fail.
@echo off
set delay=5000
start /b "" rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl
echo > "%temp%\Send.vbs" Set ws=CreateObject("WScript.Shell")
echo >>"%temp%\Send.vbs" WScript.Sleep(%delay%)
echo >>"%temp%\Send.vbs" ws.sendkeys("{Enter}")
cscript //nologo "%temp%\Send.vbs"

Hi Pegasus,

Thank you for your time. The batch/script didn't work. The property
sheet
does come up *and* go away on it's own, but the options and OK button
are
not
executed. I even tried to fiddle with the delay you had set in there
(making
it longer) to no avail. You did issue the caveat that it was fragile
and
I'm
wondering whether or not the McAfee ePolicy Orchestrator and/or Host
Intrusion Prevention (neither of which do I have any admin control
over)
are
precluding this batch/script?

You need to play a little more with the navigation keys that move you
from
one tick box to the next, e.g. like so:
@echo off
set delay=5000
start /b "" rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl
echo > "%temp%\Send.vbs" Set ws=CreateObject("WScript.Shell")
echo >>"%temp%\Send.vbs" WScript.Sleep(%delay%)
echo >>"%temp%\Send.vbs" ws.sendkeys("{Tab}")
echo >>"%temp%\Send.vbs" WScript.Sleep(500)
echo >>"%temp%\Send.vbs" ws.sendkeys("{Tab}")
echo >>"%temp%\Send.vbs" WScript.Sleep(500)
echo >>"%temp%\Send.vbs" ws.sendkeys(" ")
echo >>"%temp%\Send.vbs" WScript.Sleep(5000)
echo >>"%temp%\Send.vbs" ws.sendkeys("{Enter}")
cscript //nologo "%temp%\Send.vbs"

Again this script is fragile: It will toggle the contents of the tick
box,
regardless of what's there before. A direct registry hack might be far
more
robust.

After finishing your testing session, you should temove the 5000
millisecond
delay before issuing the Enter command.


Pegasus!

Good show! It works - but there is still one TINY problem. I noticed that
no
matter what I set the delay, the batch will launch directly after the
startup
scripts are complete, THEN that is when the "delay" starts it's countdown.
The problem I'm encountering is the programs in the systray have yet to
complete loading. As they are doing so, the property sheet (how should I
say
this?) does not "remain on top" if you will. In other words, although it
is
the ONLY property sheet, it becomes inactive due to systray loading. I
have
tested this on multiple logons - I can get it to work by simply hitting
Alt-Tab to make the sheet active. Is there a way within the hybrid you
created to keep the property sheet on top? Man...fine job!

jp

The simplest solution might be to use a two-batch-file method:

Batch1.bat (invoked at startup time):
@echo off
ping localhost -n 120 > nul
{To delay things by 120 seconds}
call c:\Batch2.bat

Batch2.bat (invoked by Batch1.bat)
@echo off
set delay=5000
start /b "" rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl
echo > "%temp%\Send.vbs" Set ws=CreateObject("WScript.Shell")
echo >>"%temp%\Send.vbs" WScript.Sleep(%delay%)
echo >>"%temp%\Send.vbs" ws.sendkeys("{Tab}")
echo >>"%temp%\Send.vbs" WScript.Sleep(500)
echo >>"%temp%\Send.vbs" ws.sendkeys("{Tab}")
echo >>"%temp%\Send.vbs" WScript.Sleep(500)
echo >>"%temp%\Send.vbs" ws.sendkeys(" ")
echo >>"%temp%\Send.vbs" WScript.Sleep(500)
echo >>"%temp%\Send.vbs" ws.sendkeys("{Enter}")
cscript //nologo "%temp%\Send.vbs"
 
J

jp

Pegasus (MVP) said:
jp said:
Pegasus (MVP) said:
:


System: Windows XP
I currently have a batch file in my startup folder to launch the
sheet.
It
is simply written as:

"rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl"

Once the sheet is up, I have to manually check "Place volume icon in
task
bar", then click [OK].

Is there a way via the batch file to automate this process so that
the
batch
file itself will both check the box and OK it's way out?

Don't ask why I have to do this - it's image-related. It's the only
way
I
can get the volume icon on the taskbar.

Thanks in advance.

jp


This batch/VB Script hybrid works on my machine. Please note that it
is
fragile: If a pop-up message interferes with it, e.g. a virus pattern
file
update then it will fail.
@echo off
set delay=5000
start /b "" rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl
echo > "%temp%\Send.vbs" Set ws=CreateObject("WScript.Shell")
echo >>"%temp%\Send.vbs" WScript.Sleep(%delay%)
echo >>"%temp%\Send.vbs" ws.sendkeys("{Enter}")
cscript //nologo "%temp%\Send.vbs"

Hi Pegasus,

Thank you for your time. The batch/script didn't work. The property
sheet
does come up *and* go away on it's own, but the options and OK button
are
not
executed. I even tried to fiddle with the delay you had set in there
(making
it longer) to no avail. You did issue the caveat that it was fragile
and
I'm
wondering whether or not the McAfee ePolicy Orchestrator and/or Host
Intrusion Prevention (neither of which do I have any admin control
over)
are
precluding this batch/script?

You need to play a little more with the navigation keys that move you
from
one tick box to the next, e.g. like so:
@echo off
set delay=5000
start /b "" rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl
echo > "%temp%\Send.vbs" Set ws=CreateObject("WScript.Shell")
echo >>"%temp%\Send.vbs" WScript.Sleep(%delay%)
echo >>"%temp%\Send.vbs" ws.sendkeys("{Tab}")
echo >>"%temp%\Send.vbs" WScript.Sleep(500)
echo >>"%temp%\Send.vbs" ws.sendkeys("{Tab}")
echo >>"%temp%\Send.vbs" WScript.Sleep(500)
echo >>"%temp%\Send.vbs" ws.sendkeys(" ")
echo >>"%temp%\Send.vbs" WScript.Sleep(5000)
echo >>"%temp%\Send.vbs" ws.sendkeys("{Enter}")
cscript //nologo "%temp%\Send.vbs"

Again this script is fragile: It will toggle the contents of the tick
box,
regardless of what's there before. A direct registry hack might be far
more
robust.

After finishing your testing session, you should temove the 5000
millisecond
delay before issuing the Enter command.


Pegasus!

Good show! It works - but there is still one TINY problem. I noticed that
no
matter what I set the delay, the batch will launch directly after the
startup
scripts are complete, THEN that is when the "delay" starts it's countdown.
The problem I'm encountering is the programs in the systray have yet to
complete loading. As they are doing so, the property sheet (how should I
say
this?) does not "remain on top" if you will. In other words, although it
is
the ONLY property sheet, it becomes inactive due to systray loading. I
have
tested this on multiple logons - I can get it to work by simply hitting
Alt-Tab to make the sheet active. Is there a way within the hybrid you
created to keep the property sheet on top? Man...fine job!

jp

The simplest solution might be to use a two-batch-file method:

Batch1.bat (invoked at startup time):
@echo off
ping localhost -n 120 > nul
{To delay things by 120 seconds}
call c:\Batch2.bat

Batch2.bat (invoked by Batch1.bat)
@echo off
set delay=5000
start /b "" rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl
echo > "%temp%\Send.vbs" Set ws=CreateObject("WScript.Shell")
echo >>"%temp%\Send.vbs" WScript.Sleep(%delay%)
echo >>"%temp%\Send.vbs" ws.sendkeys("{Tab}")
echo >>"%temp%\Send.vbs" WScript.Sleep(500)
echo >>"%temp%\Send.vbs" ws.sendkeys("{Tab}")
echo >>"%temp%\Send.vbs" WScript.Sleep(500)
echo >>"%temp%\Send.vbs" ws.sendkeys(" ")
echo >>"%temp%\Send.vbs" WScript.Sleep(500)
echo >>"%temp%\Send.vbs" ws.sendkeys("{Enter}")
cscript //nologo "%temp%\Send.vbs"

Pegasus,

You *DID* it! *That* was the key - the 2-Batch resolution method - genius!
Ironically, I was able to tweak the time in Batch1 down to 10sec. Batch1
window was inactive (no surprise), but 10 sec was enough to allow the systray
programs to completely load so that by the time Batch2 launched it was free
and clear (and active). Works like a champ! Thank you SO much for your time,
persistence and rapid response; I can't thank you enough!

jp
 
P

Pegasus \(MVP\)

Pegasus,

You *DID* it! *That* was the key - the 2-Batch resolution method - genius!
Ironically, I was able to tweak the time in Batch1 down to 10sec. Batch1
window was inactive (no surprise), but 10 sec was enough to allow the
systray
programs to completely load so that by the time Batch2 launched it was
free
and clear (and active). Works like a champ! Thank you SO much for your
time,
persistence and rapid response; I can't thank you enough!

jp

Thanks for the feedback.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top