Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


DGlower

4 posts

Wannabe Geek
Inactive user


#32132 14-Apr-2009 08:07
Send private message

I am trying to make my pc add automatically a bluetooth device by just double-clicking an icon on my desktop.
So I thought of making a batch that would open "devicepairingwizard" (I found that it can be opened just by typing it in the command line box); and then add automatically the device knowing its name or address(mac address) .
But is the creation of such batch possible? If yes, how should I proceed?
Thanks in advance!

Create new topic
d3Xt3r
688 posts

Ultimate Geek

Trusted

  #207800 18-Apr-2009 16:54
Send private message

You could do it using AutoHotkey.

Start off the script with something like this:

Run, devicepairingwizard
WinWaitActive, Pair with a wireless device

Then keep using
SendInput, {Space}
or w/e, use this to click the default control - eg: 'Next', 'OK', etc. Use a combination of {Up}/{Down} or {Tab} to get to the appropriate control.

Also use WinWaitActive to wait till the window with the appropriate title (or text) is active.

SendInput, Name of the bluetooth device

If you can get the control name of the Edit box using AU3_Spy (included in package), then you can use ControlSetText, which can be faster and more reliable.

or w/e when the appropriate box is visible. Just use a combination of WinWaitActive, SendInput, ControlClick and Sleep if necessary. Everything is explained nicely in the help file.



DGlower

4 posts

Wannabe Geek
Inactive user


  #207804 18-Apr-2009 17:18
Send private message

Thanks! I actually already started coding with autokey and it works! But I still need to do some debugging because it does not always run how it is supposed to... Also I am trying to do some optimisations and remove the "Sleep" and replace them by some conditions like "if ... then" or "while",
Here is my code:
_______________________________________________

;
;
; AutoIt Version: 3.0
; Language:       English
; Platform:       WinVista 32bit
; Author:         DGlower
;
; Script Function:
;   Intalls Bluetooth Device
;

;TODO:
;_Make sound when installed or finished
;_replace sleep statements with conditions


; Run the devicepairingwizard
Run("devicepairingwizard.exe")


; Wait for the devicepairingwizard become active
WinWaitActive("Pair with a wireless device")

Sleep (1000)
$WinTitle = 'Pair with a wireless device'            ;;Fill in details
$WinText = ''                                        
$CID1 = "SysListView321"
$CID2 = "SysLink2"

$Name1 = "Input Device"                    ;wiimote name before recognition  
$Name2 = "Nintendo RVL-CNT-01"                ;wiimote name after recongnition

$Name3 = "&Pair without using a code"
$Name4 = "Click Close to continue using your computer while driver installation completes."
$NameSearch1 = ControlListView($WinTitle,$WinText, $CID1,"FindItem",$Name1)
$NameSearch2 = ControlListView($WinTitle,$WinText, $CID1,"FindItem",$Name2)
$NameSearch4 = ControlListView($WinTitle,$WinText, "Static14" ,"FindItem",$Name4)

$NameSelect1 = ControlListView($WinTitle,$WinText, $CID1, "Select", $NameSearch1)
$NameSelect2 = ControlListView($WinTitle,$WinText, $CID1, "Select", $NameSearch2)
$NameSelect4 = ControlListView($WinTitle,$WinText, "Static14", "Select", $NameSearch4)



    Func check()
        Sleep ( 2000 )    ;wait for loading of phase 1 to finish
        $NameSearch3 = ControlListView($WinTitle,$WinText, "Button6","FindItem",$Name3)
        $NameSelect3 = ControlListView($WinTitle,$WinText, "Button6", "Select", $NameSearch3)    ;Select $Name3
       
        If $NameSelect3 <> -1  Then
            Sleep ( 400 )
            $Confirm1 = ControlClick($WinTitle,$WinText,'Button6')    ;confirm selection of $Name3
            Sleep ( 5500 )         ;wait for loading phase 2 to finish
           
            ;try to eliminate the previous Sleep(5000) but closing action occures to fast
            If $Confirm1 <> -1 Then
                While $NameSelect4 <> -1
                    ControlClick($WinTitle,$WinText,'Button2')
                    $Confirm2 = ControlSend($WinTitle,$WinText, "DirectUIHWND1",'{ENTER}')
                    If $Confirm2 <> -1 Then
                    $NameSelect4 = -1
                    EndIf
                WEnd
            EndIf
        EndIf
    EndFunc
   
;___________________________

    If $NameSearch1 <> -1 Then
        $NameSelect1 = 1    ;execute selection of $Name1
        ControlSend($WinTitle,$WinText, $CID1,'{ENTER}')
        check()
       
   
    ElseIf $NameSearch2 <> -1 Then
        $NameSelect2 = 1    ;execute selection of $Name2
        ControlSend($WinTitle,$WinText, $CID1,'{ENTER}')
        Check()
       
    Else
        Sleep (500)
        MsgBox(0, "Bluetooth Device Remover by NAL", "Wiimote was NOT installed!", 2 )
        WinClose($WinTitle, "" )
   
    EndIf

_______________________________________________

Create new topic





News and reviews »

Air New Zealand Starts AI adoption with OpenAI
Posted 24-Jul-2025 16:00


eero Pro 7 Review
Posted 23-Jul-2025 12:07


BeeStation Plus Review
Posted 21-Jul-2025 14:21


eero Unveils New Wi-Fi 7 Products in New Zealand
Posted 21-Jul-2025 00:01


WiZ Introduces HDMI Sync Box and other Light Devices
Posted 20-Jul-2025 17:32


RedShield Enhances DDoS and Bot Attack Protection
Posted 20-Jul-2025 17:26


Seagate Ships 30TB Drives
Posted 17-Jul-2025 11:24


Oclean AirPump A10 Water Flosser Review
Posted 13-Jul-2025 11:05


Samsung Galaxy Z Fold7: Raising the Bar for Smartphones
Posted 10-Jul-2025 02:01


Samsung Galaxy Z Flip7 Brings New Edge-To-Edge FlexWindow
Posted 10-Jul-2025 02:01


Epson Launches New AM-C550Z WorkForce Enterprise printer
Posted 9-Jul-2025 18:22


Samsung Releases Smart Monitor M9
Posted 9-Jul-2025 17:46


Nearly Half of Older Kiwis Still Write their Passwords on Paper
Posted 9-Jul-2025 08:42


D-Link 4G+ Cat6 Wi-Fi 6 DWR-933M Mobile Hotspot Review
Posted 1-Jul-2025 11:34


Oppo A5 Series Launches With New Levels of Durability
Posted 30-Jun-2025 10:15









Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.