Jump to content

Recommended Posts

Posted (edited)

Hello
I designed this code To help the blind
Where screen readers users can  Identify the sefocus  item with audio files
In this code i define some elements
Unfortunately, I did not know how to define the other elements
I am waiting for your initiative to  define the other elements
Thank you in advance

Global $CFocus = ""

Func focus($window)
    Local $focusing = ControlGetFocus($window)
    Local $handle = ControlGetHandle($window, "", $focusing)
    If Not ($focusing = $CFocus) Then
        Switch StringTrimRight($focusing, 1)
            Case "button"
                If IsCheckBox($handle) Then
                    play("checkBox")
                ElseIf IsRadio($handle) Then
                    play("RadioButton")
                Else
                    play("focus")
                EndIf
                $CFocus = $focusing
            Case "comboBox", "ListBox"
                play("list")
                $CFocus = $focusing
            Case "edit", "input"
                play("edit")
                $CFocus = $focusing
            Case Else
                play("focus")
                $CFocus = $focusing


        EndSwitch
    EndIf
EndFunc   ;==>focus

Func IsCheckBox($ctrl_hwnd)
    $Style = _WinAPI_GetWindowLong($ctrl_hwnd, $GWL_STYLE)
    Return BitAND($Style, $BS_CHECKBOX) = $BS_CHECKBOX
EndFunc   ;==>IsCheckBox

Func IsRadio($ctrl_hwnd)
    $Style = _WinAPI_GetWindowLong($ctrl_hwnd, $GWL_STYLE)
    Return BitAND($Style, $BS_AUTORADIOBUTTON) = $BS_AUTORADIOBUTTON
EndFunc   ;==>IsRadio

Func play($name, $wait = 0)
    Local Const $SND_RESOURCE = 0x00040004
    Local Const $SND_ASYNC = 1
    ; Play the file - the script will pause as it sounds
    If $wait = 0 Then
        DllCall("winmm.dll", "int", "PlaySound", "str", $name, "hwnd", 0, "int", BitOR($SND_RESOURCE, $SND_ASYNC))
    Else
        DllCall("winmm.dll", "int", "PlaySound", "str", $name, "hwnd", 0, "int", $SND_RESOURCE)
    EndIf
    Return 1
EndFunc   ;==>play

 

Edited by nacerbaaziz
Added topic text and code tags
  • Moderators
Posted

You posted this in the Examples forum. You have been around long enough to know that if you're looking for help the thread should go in General Help and Support, and if you're looking to work collaboratively on a project it should go under AutoIt Projects and Collaboration. So which is it?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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
×
×
  • Create New...