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

4 posts

Wannabe Geek

Topic # 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
639 posts

Ultimate Geek
+1 received by user: 95


  Reply # 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.

4 posts

Wannabe Geek

  Reply # 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

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

; Run the devicepairingwizard

; 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
                    $Confirm2 = ControlSend($WinTitle,$WinText, "DirectUIHWND1",'{ENTER}')
                    If $Confirm2 <> -1 Then
                    $NameSelect4 = -1

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


Create new topic

Donate via Givealittle

Twitter »

Follow us to receive Twitter updates when new discussions are posted in our forums:

Follow us to receive Twitter updates when news items and blogs are posted in our frontpage:

Follow us to receive Twitter updates when tech item prices are listed in our price comparison site:

News »

A call from the companies providing internet access for the great majority of New Zealanders, to the companies with the greatest influence over social media content
Posted 19-Mar-2019 15:21

Two e-scooter companies selected for Wellington trial
Posted 15-Mar-2019 17:33

GeForce GTX 1660 available now
Posted 15-Mar-2019 08:47

Artificial Intelligence to double the rate of innovation in New Zealand by 2021
Posted 13-Mar-2019 14:47

LG demonstrates smart home concepts at LG InnoFest
Posted 13-Mar-2019 14:45

New Zealanders buying more expensive smartphones
Posted 11-Mar-2019 09:52

2degrees Offers Amazon Prime Video to Broadband Customers
Posted 8-Mar-2019 14:10

D-Link ANZ launches D-Fend AC2600 Wi-Fi Router Protected by McAfee
Posted 7-Mar-2019 11:09

Slingshot commissions celebrities to design new modems
Posted 5-Mar-2019 08:58

Symantec Annual Threat Report reveals more ambitious, destructive and stealthy attacks
Posted 28-Feb-2019 10:14

FUJIFILM launches high performing X-T30
Posted 28-Feb-2019 09:40

Netflix is killing content piracy says research
Posted 28-Feb-2019 09:33

Trend Micro finds shifting threats require kiwis to rethink security priorities
Posted 28-Feb-2019 09:27

Mainfreight uses Spark IoT Asset Tracking service
Posted 28-Feb-2019 09:25

Spark IoT network now covers 98% of New Zealand population
Posted 19-Feb-2019 09:28

Geekzone Live »

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

Support Geekzone »

Our community of supporters help make Geekzone possible. Click the button below to join them.

Support Geezone on PressPatron

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.

Alternatively, you can receive a daily email with Geekzone updates.