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

 

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

;Kontextmenü aufrufen
Send("^+{F10}")

; 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}")
;Send("{ENTER}")

; select the connection key (in German = 'V' in English ?)
Send("V")
; 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
ControlListView("Sound","","SysListView321","Select",$eintragIndex)
Sleep(500)
; and than set it as default
Send("{ALT}+a")

 

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?
Link to comment
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.)

 

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...