DGlower Posted April 14, 2009 Posted April 14, 2009 (edited) Hi, I am trying to write a code that will install my bluetooth device automatically when I run it.So basically, it will first open this window; select the titled "Input device" or else "Nint ..." and press "Next" to continue as shown in the below picture:From the picture below, it should choose "Pair without using a code" and press "Next" then close.This is the code I have written for the moment:expandcollapse popup; ; ; AutoIt Version: 3.0 ; Language: English ; Platform: WinVista 32bit ; Author: DGlower ; ; Script Function: ; Intalls Bluetooth Device ; ; Run the devicepairingwizard Run("devicepairingwizard.exe") ; Wait for the devicepairingwizard become active WinWaitActive("Pair with a wireless device") ;Wait 2 seconds for devices to appear (an estimation I made) Sleep ( 1000 ) ;Check for devices having names containing "Input" If StringInStr ( "Input", "Input" ) then Send( "inp" );"inp" will be typed in order to select this device Send("{ENTER}") ;Make it check for "Nint" in "Input" is not found ElseIf StringInStr( "Nint", "Nint" ) then Send( "nint" );"nint" will be typed in order to select this device Send("{ENTER}") EndIf ;Wait 2 seconds for the loading Sleep ( 2000 ) ;Will choose "Pair without using a code" and proceed send( "{P}" ) ;Wait 5 seconds for the configuration to end Sleep ( 5000 ) ;Will press the "Close" button Send("{ENTER}") ; Finished!1. Everything works fine but not the "ElseIf" statement. I tried this for that second statement to work but it would fail: If...Then...Endif Or If...Then...EndifIs there any solution for that?2. If possible, I would like to create a loop statement instead of waiting 1 second for the device to appear in the first steps because the loading time is very random.Any help would be greatly appreciated. Edited April 14, 2009 by DGlower
Authenticity Posted April 14, 2009 Posted April 14, 2009 (edited) Hmm..? If StringInStr("Input", "Input") Then ?Edit: As for the second question, you can use AutoIt Window Info (included with the AutoIt installation) to control name or something else that may help your script to identify it and loop until one of the conditions you want is satisfied. Edited April 14, 2009 by Authenticity
DGlower Posted April 14, 2009 Author Posted April 14, 2009 (edited) Hmm..? If StringInStr("Input", "Input") Then ? Edit: As for the second question, you can use AutoIt Window Info (included with the AutoIt installation) to control name or something else that may help your script to identify it and loop until one of the conditions you want is satisfied. Thanks for the advice!! I was not aware of such tool! I was not able to determine the controlID of the "Input Device" but I was able to determine the control ID of the box containg it and has the controlID/ClassnameNN: SysListView321 . So I tried: If ControlShow( "Input", "Device Input", "SysListView321") = True Then Send("{ENTER}");to continue the process EndIf But when I do that, it does not select "Input Device" and proceed. What are my doing wrong? Edited April 14, 2009 by DGlower
Authenticity Posted April 14, 2009 Posted April 14, 2009 You need the list-view control using $hListView = ControlGetHandle("Input", "Device Input", "SysListView321") and then you can manipulate (if it's not an owner-drawn one) using the _GUICtrlListView_* functions, #include <GuiListView.au3>. Read the help file.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now