Jump to content
Sign in to follow this  
n9mfk9

updateing a Label?

Recommended Posts

n9mfk9

Hi all here is my code

#include <GUIConstants.au3>
#Region ### START Koda GUI section ### Form=c:\documents and settings\beau thompson\my documents\agui.kxf
$agui_1 = GUICreate("audio slect", 366, 264, 294, 269)
$Button1 = GUICtrlCreateButton("IMIC", 24, 16, 57, 25, 0)
$Button2 = GUICtrlCreateButton("AC97", 96, 16, 57, 25, BitOR($BS_CENTER,$WS_GROUP))
$Button3 = GUICtrlCreateButton("IMIC/AC97", 23, 45, 57, 25, 0)
$Button4 = GUICtrlCreateButton("A97/IMIC", 95, 45, 57, 25, BitOR($BS_CENTER,$WS_GROUP))
$Button5 = GUICtrlCreateButton("INPUT", 24, 72, 57, 25, 0)
$Button6 = GUICtrlCreateButton("OUTPUT", 96, 72, 57, 25, BitOR($BS_CENTER,$WS_GROUP))
$Button7 = GUICtrlCreateButton("AButton1", 23, 100, 57, 25, 0)
$Button8 = GUICtrlCreateButton("AButton1", 95, 100, 57, 25, BitOR($BS_CENTER,$WS_GROUP))
$Group1 = GUICtrlCreateGroup("", 16, 128, 177, 49)
$Label1 = GUICtrlCreateLabel("", 24, 144, 163, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1

$nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        
        
        
        Case $Button1
        $Playback = "iMic USB audio system"
        $Record = "iMic USB audio system"
        RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Multimedia\Sound Mapper", "Playback", "REG_SZ",$Playback)
        RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Multimedia\Sound Mapper", "Record", "REG_SZ",$Record)
Sleep(9000)
 $Label1 = GUICtrlCreateLabel($readout, 24, 144, 163, 25)
        
        Case $Button2
        $Playback = "Realtek AC97 Audio" 
        $Record= "Realtek AC97 Audio"
        RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Multimedia\Sound Mapper", "Playback", "REG_SZ",$Playback)
        RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Multimedia\Sound Mapper", "Record", "REG_SZ",$Record)
Sleep(9000)
$Label1 = GUICtrlCreateLabel($readout, 24, 144, 163, 25)
    
        Case $Button3
        $Playback = "iMic USB audio system"
        $Record = "Realtek AC97 Audio"
        RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Multimedia\Sound Mapper", "Playback", "REG_SZ",$Playback)
        RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Multimedia\Sound Mapper", "Record", "REG_SZ",$Record)
Sleep(9000)
    $Label1 = GUICtrlCreateLabel($readout, 24, 144, 163, 25)

        Case $Button4
        $Playback = "Realtek AC97 Audio"
        $Record = "iMic USB audio system"
        RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Multimedia\Sound Mapper", "Playback", "REG_SZ",$Playback)
        RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Multimedia\Sound Mapper", "Record", "REG_SZ",$Record)

$Label1 = GUICtrlCreateLabel($readout, 24, 144, 163, 25)

        
        Case $Button5
        Run("C:\WINDOWS\system32\sndvol32.exe")

        
        Case $Button6
        Run("C:\WINDOWS\system32\sndvol32.exe -R")

            
        Case $Button7
        
        Case $Button8
    EndSwitch

$Card1= " Playback: "&RegRead("HKEY_CURRENT_USER\Software\Microsoft\Multimedia\Sound Mapper", "Playback")
$card2= " Record: "&RegRead("HKEY_CURRENT_USER\Software\Microsoft\Multimedia\Sound Mapper", "Record")
$readout= $card1&@CR &$card2
WEnd

I went $readout updated every time i puch a button so that $Label1 is updated

i have modve my code around but can not see were to do so it will bee updated every button push

thanks beau

Share this post


Link to post
Share on other sites
Valuater

you are trying to create the label over-and-over

take these out

$Label1 = GUICtrlCreateLabel($readout, 24, 144, 163, 25)

and replace it with

GUICtrlSetData( $Label1, $readout)

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
Somniis

Func _Update($status)
       GUICtrlSetData($Label1, $status)
EndFunc

Then do _Update($readout) to pass the information to update the input. ;)

Could this help you?

Edited by Somniis

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.