Jump to content

Selection of Items (and keyboard action)

Recommended Posts


I have a bluetooth device at home and this disconnects itself after approx 1hour. After this time it selects my laptops loudspeakers as default.  Since I'm fed up with this manual activation I wanna have a mechanism to activate my bluetooth loudspeaker automatically (or set it as default in some additional cases). What I did up till now is the following


;Playback Controlpanel aufrufen
Run("C:\Windows\system32\rundll32.exe Shell32.dll,Control_RunDLL mmsys.cpl,,playback")
;Index des Sound-Devices von Oben gesehen (0-basiert)
$eintragIndex = 1
; Eintrag auswählen

;Kontextmenü aufrufen

; hier die Prozedur zum Click auf "Verbinden
; um z.B zwei Einträge im Kontextmenü runter zu gehen und dann Enter drücken (im Moment noch auskommentiert)
;Send("{DOWN 2}")

; select the connection key (in German = 'V' in English ?)
; using the key 'V' prevents me to select the second item which is - when already connected - Testing ==> but I don't wanna have a testing function => so if 'V' is not available then already connected and everything fine ;-)

; Select item
; and than set it as default


So my MAIN problem here now is at the ending: Cuz I thought I select the second item and then press ALT+A (German keyboard shortcut to set as default). When I do the keyboard action manually this worx. But here in the script it does NOT work. Question:

  1. How to send the keyboard action properly after the second item is selected? Or is there another way to select the combobox and 'click' onto?
  2. Connecting to the bluetooth might take some time until its properly established. Is there an 'easy' way to check it and than proceed with the script? E.g. the 'default combo' is deselected until it has a connection. I can only think about 'Sleep' - alternatives?

Share this post

Link to post
Share on other sites

Did you try:

; and than set it as default

If that doesn't work, you might try changing the a to an uppercase A.

Edited by MuffinMan

Share this post

Link to post
Share on other sites

No, thx this worx :) Although I don't understand why the {ALT} doesn't work. Anyway this worx.

Any ideas how to check the combo if already enabled? (Cuz this will be enabled automatically when the bluetooth connection is established.)



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