Posted by Darren | Posted in Programming, Work | Posted on 07-04-2008
0
I was asked the question “I can create a combo box where users can select from a menu. Is it possible to create a second combo box BUT the choices change depending on the selection in the first combo box?”
Private Sub Combo1_AfterUpdate()
If Combo1.Text = "Option 1 Text" Then
'Focus must be set before next line
Combo2.SetFocus
'Get new options from a table
Combo2.RowSource = "SELECT * FROM tbl1"
'Select the first option
Combo2.Value = 1
ElseIf Combo1.Text = "Option 2 Text" Then
Combo2.SetFocus
'To select a different column from the table
Combo2.RowSource = "SELECT tbl2.ID, tbl2.column FROM tbl2 Order By tbl2.column"
Combo2.Value = 1
End If
End Sub
Posted by Darren | Posted in Programming | Posted on 10-09-2007
0
Instead of using VBScript to maximize and unmute the volume, I thought I might use AutoIt. But when looking for a script to do the job in AutoIt, I stumbled across the program AutoHotkey. AutoHotkey makes the job a lot easier and doesn’t open up the volume dialog (although that’s funny). AutoHotkey also allows you to compile the script to an executable file (.exe), just like AutoIt. Here is the AutoHotkey code:
Send {Volume_Mute}
SoundSet, 100
SoundSet, 100, WAVE
SoundSet, 100, SYNTH
SoundSet, 100, CD
SoundSet, 100, MICROPHONE
SoundSet, 100, LINESoundPlay, C:\WINDOWS\Media\notify.wav, WAIT
Posted by Darren | Posted in Programming | Posted on 10-08-2007
0
I’ve never played around much with VBScript, but it’s pretty neat. Rusty was showing me some code he did after reading this TechEBlog article. We thought it would be funny to write a script that unmuted, maxed the volume, and played a sound file. Here is the VBScript I came up with (save as .vbs):
set oshell=createobject(“wscript.shell”)
oshell.run “sndvol32″
oshell.appactivate “volume control”
WScript.sleep 600
oshell.appactivate “volume control”
oshell.sendkeys “{tab}”
wscript.sleep 600
For X = 1 To 500
oshell.sendkeys “^{UP}”
oshell.appactivate “volume control”
Next
wscript.sleep 600
oshell.sendkeys “m”
wscript.sleep 600
oshell.sendkeys Chr(32)
wscript.sleep 600
oshell.appactivate “volume control”
wscript.sleep 600
oshell.sendkeys “%{f4}”strSoundFile = “C:\WINDOWS\Media\notify.wav”
Set objShell = CreateObject(“Wscript.Shell”)
strCommand = “sndrec32 /play /close ” & chr(34) & strSoundFile & chr(34)
objShell.Run strCommand, 0, False
Wscript.Sleep 1000
Continue = MsgBox (“Message Box Message”, vbYesNo, “Message Box Title”)
Here is the batch file to copy files to computer (save as .bat):
@echo off
xcopy /Y “sound.vbs” “c:\temp\”
xcopy /Y “sound.ico” “c:\temp\”
xcopy /Y “sound.lnk” “%USERPROFILE%\Desktop”