Sign in to follow this  
Followers 0
Hendricius

Don't find the mistake in my script

7 posts in this topic

$cm = 8902893; my headset
$cr = 0; my surroundsystem
$ib = InputBox("Inputbox","cm=headset, cr=surroundsystem",)
 
Sleep(2000);
Mouseclick("left",16,755,1,0); Startmenu
Sleep(500);
Send("y"); Systemcontrols
Sleep(3000);
Send("S");
Send("O");
Send("U"); Sound Options
Send("{ENTER}");
Sleep(2000);
AutoItSetOption ( "MouseCoordMode",0)
MouseClick("left",185,46,1,0); at the place where  you can change audio options
Sleep(2000);
If $ib = "cr" Then
    If PixelGetColor(206, 117) = $cm Then
        Send("{DOWN}");  <-------------- dont know if this is correct
        Send("{ENTER}");
        EndIf
    ElseIf PixelGetColor(206, 117) = $cr Then
        MsgBox(0,"programm","nothing changed");
            
        EndIf
        
If $ib = "cm" Then
    If PixelGetColor(206, 117) = $cr Then
        Send("{DOWN}");
        Send("{ENTER}");
        EndIf
    ElseIf PixelGetColor(206, 117) = $cm Then
        MsgBox(0,"programm","nothing changed");
            
        EndIf

Basically what this prgoramm should do is: Change the Sound input device in my systemcontrols.

Thanks for the help :whistle:.

Share this post


Link to post
Share on other sites



http://www.autoitscript.com/fileman/users/gafrost/cbemoticon.gif

darnit, crystal ball isn't working. I guess you're going to have to tell us what's wrong.

Does it freeze your computer? give you a bsod? do nothing at all? make your computer smoke? take control of your friends and family and turn them into zombies?


The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites

Basically what this prgoramm should do is: Change the Sound input device in my systemcontrols.

@Hendricius: I see where you might be having some problems. First, I would open the Sound dialog using the RunDll32 method. Take a look at Dx21 for a reference on how to use RunDll32 to open this dialog. Next, I would use ControlClick and ControlSend to send clicks/text directly to the controls. With the Send function, you have to make sure the correct control is focused first before sending the text. Finally, see if you can get rid of all the sleep statements. They are a crutch and you should be writing the proper code to determine if the control/window is active and ready for input. Look at ControlCommand and in particular the section on "IsVisible" and "IsEnabled".

Auto3Lib: A library of over 1200 functions for AutoIt

Share this post


Link to post
Share on other sites

sorry have been on vacations. the programm just stops running :whistle:

If $ib = "cr" Then

If PixelGetColor(206, 117) = $cm Then

i think this is wrong. please tell me if yes or now ;). double if function.

Share this post


Link to post
Share on other sites

I think you are confused about how to use an if/then/else statement. Either that, or you don't know how to format your code so that it follows the execution flow:

If $ib = "cr" Then
  If PixelGetColor(206, 117) = $cm Then
    Send("{DOWN}");
    Send("{ENTER}");
  EndIf
ElseIf PixelGetColor(206, 117) = $cr Then <-- Executed if $ib <> "cr"
  MsgBox(0,"programm","nothing changed");
EndIfoÝ÷ Ù©Ýjëh×6If $ib = "cm" Then
  If PixelGetColor(206, 117) = $cr Then
    Send("{DOWN}");
    Send("{ENTER}");
  EndIf
ElseIf PixelGetColor(206, 117) = $cm Then <-- Executed if $ib <> "cm"
  MsgBox(0,"programm","nothing changed");
EndIf

Auto3Lib: A library of over 1200 functions for AutoIt

Share this post


Link to post
Share on other sites

I think the simplest way to go to sounds is to do

start menu >>> execute >>> mmsys.cpl >>> shift+tab >>> right

and you are on the sound tab !

Share this post


Link to post
Share on other sites

I think the simplest way to go to sounds is to do

start menu >>> execute >>> mmsys.cpl >>> shift+tab >>> right

and you are on the sound tab !

If you want to change something in the audio tab code like this to arrive to the correct tab

run("control.exe mmsys.cpl 0,2") ; where 2 is the tab number-1 (I have volume,sounds,audio,...)

...

code to do what you want

...

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  
Followers 0