Jump to content

Recommended Posts

  • Replies 63
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted

fighting a bit with dictionary 'conversion' but i'm near solution. Final goal : everyone can build own dictionary.

Follow soon download of English, French, Spanish, German, Italian, Portuguese dictionary.

I follow also forum for 'various skillful' people (person with handicap). One of mine relatives is blind.

He ask if is possible to map varius button with numeric pad ones, find your job brillant.

I don't know maybe we found a way to do good things for people ?

(not only for HTPC maniacs as me) :mellow:

see you,

m.

Posted

in your opinion dictionary must be ordered by number, to help program find quikly word ?

Request : when prog find exact number can display on top of list ?

m.

Posted

Ok, so put the dictionary files in a folder called "Dic" then here is the code. A file dialog will popup asking you to select a dictionary. I have not fixed the wanted word problem yet.

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>

Opt("GUIOnEventMode", 1); Change to OnEvent mode
Opt("MouseCoordMode", 2);1=absolute, 0=relative, 2=client

Global $GuiW = 120, $GuiH = 180
Global $sFile = FileOpenDialog("T9 - Select dictionary", @ScriptDir & '\Dic', 'Dictionary Files (*.dic)'), $in, $out
Global $aCPos = ControlGetPos("[CLASS:Shell_TrayWnd]", "", ""); Taskbar
Global $Width = @DesktopWidth, $Height = @DesktopHeight, $user_insert, $sIn = "", $Edit
Dim $gridWidth = 3, $gridHeight = 4, $btnArray[$GuiH][$GuiW]

; Get the desktop size without the taskbar
If $aCPos[3] > $aCPos[2] Then
    $Width = @DesktopWidth - $aCPos[2]
Else
    $Height = @DesktopHeight - $aCPos[3]
EndIf

; Create the GUI
$hGui = GUICreate("My Main", $GuiW, $GuiH, $Width - $GuiW, $Height - $GuiH, $WS_POPUPWINDOW, $WS_EX_TOPMOST)
GUISetOnEvent($GUI_EVENT_CLOSE, "Close")

$cWord = GuiCtrlCreateLabel("", 0, 0, $GuiW - 10, 20)
GuiCtrlSetFont(-1, 9)
$cNext = GuiCtrlCreateLabel("", $GuiW - 10, 0, 10, 20)
GUICtrlSetBkColor(-1, 0xff0000)

; Generate Buttons
$num = 1
For $Y = 0 To $gridHeight - 1
    For $X = 0 To $gridWidth - 1
        $btnArray[$Y][$X] = GUICtrlCreateButton($num, ($X * 40), ($Y * 40) + 20, 40, 40)
        GUICtrlSetOnEvent(-1, "buttonPress")
        $num += 1
    Next
Next

; Set the last 3 to extra buttons
GUICtrlSetData($btnArray[3][0], "*")
GUICtrlSetData($btnArray[3][1], "0")
GUICtrlSetData($btnArray[3][2], "#")

GUISetState()

While 1
; Handle the GUI
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func buttonPress()
    Local $aString, $sOut = ""
    For $Y = 0 To $gridHeight - 1
        For $X = 0 To $gridWidth - 1
            If @GUI_CtrlId = $btnArray[$Y][$X] Then
           ; MsgBox(0, "Grid Ref", $Y & "," & $X)
                Button(GUICtrlRead($btnArray[$Y][$X]))
           ; ConsoleWrite("!>BUTTON: " & GUICtrlRead($btnArray[$Y][$X]) & @CRLF)
           ; ConsoleWrite("->USER_INSERT: " & $user_insert & @CRLF)
                If Not $Edit = "" Then 
                    ConsoleWrite("+>OUTPUT: " & $Edit & @CRLF)
                    GUICtrlSetData($cWord, $Edit)
                EndIf
            EndIf
        Next
    Next
EndFunc ;==>buttonPress

Func Button($iNum)
    $user_insert = $user_insert & $inum

    If $iNum = 1 then
        $user_insert = ""
        $edit = ""
        GUICtrlSetData($cWord, $edit)
        GUICtrlSetBkColor($cNext, 0xff0000)
    Else
        If $inum = 'nul' Then
            $in = $in & 0
        Else
            $in = $in & $user_insert
        EndIf
    EndIf

    Search_Word($user_insert)
EndFunc ;==>Button

Func Search_Word($sIn)
    If StringLen($sIn) >= 1 Then
        $sOut = ""
        $aRegEx = StringRegExp(FileRead($sFile), "(?i)(?m)^(" & $user_insert & ".*)$", 3)
        If IsArray($aRegEx) Then
            For $i = 1 To UBound($aRegEx) - 1
                $sOut &= $aRegEx[$i]
            Next
            If $Edit <> StringStripWS($sOut, 2) Then $Edit = StringStripWS($sOut, 2)
            If $Edit <> "" Then GUICtrlSetBkColor($cNext, 0x00ff00)
        EndIf
    EndIf
EndFunc ;==>Search_Word

Func GetHoveredHwnd()
    Local $iRet = DllCall("user32.dll", "int", "WindowFromPoint", "long", MouseGetPos(0), "long", MouseGetPos(1))
    If IsArray($iRet) Then Return HWnd($iRet[0])
    Return SetError(1, 0, 0)
EndFunc

Func Close()
    Exit
EndFunc ;==>Close
Posted

for me problem is in search function, my first script example is fast and working...

I see you modify original function, when typed word > 3 something going wrong.

m.

Posted

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>

Opt("GUIOnEventMode", 1); Change to OnEvent mode
Opt("MouseCoordMode", 2);1=absolute, 0=relative, 2=client

Global $GuiW = 120, $GuiH = 180
Global $sFile = FileOpenDialog("T9 - Select dictionary", @ScriptDir & '\Dic', 'Dictionary Files (*.dic)')
Global $aCPos = ControlGetPos("[CLASS:Shell_TrayWnd]", "", ""); Taskbar
Global $Width = @DesktopWidth, $Height = @DesktopHeight, $user_insert, $sIn = "", $Edit, $in, $out
Dim $gridWidth = 3, $gridHeight = 4, $btnArray[$GuiH][$GuiW]

; Get the desktop size without the taskbar
If $aCPos[3] > $aCPos[2] Then
    $Width = @DesktopWidth - $aCPos[2]
Else
    $Height = @DesktopHeight - $aCPos[3]
EndIf

; Create the GUI
$hGui = GUICreate("My Main", $GuiW, $GuiH, $Width - $GuiW, $Height - $GuiH, $WS_POPUPWINDOW, $WS_EX_TOPMOST)
GUISetOnEvent($GUI_EVENT_CLOSE, "Close")

$cWord = GuiCtrlCreateLabel("", 0, 0, $GuiW - 10, 20)
GuiCtrlSetFont(-1, 9)
$cNext = GuiCtrlCreateLabel("", $GuiW - 10, 0, 10, 20)
GUICtrlSetBkColor(-1, 0xff0000)

; Generate Buttons
$num = 1
For $Y = 0 To $gridHeight - 1
    For $X = 0 To $gridWidth - 1
        $btnArray[$Y][$X] = GUICtrlCreateButton($num, ($X * 40), ($Y * 40) + 20, 40, 40)
        GUICtrlSetOnEvent(-1, "buttonPress")
        $num += 1
    Next
Next

; Set the last 3 to extra buttons
GUICtrlSetData($btnArray[3][0], "*")
GUICtrlSetData($btnArray[3][1], "0")
GUICtrlSetData($btnArray[3][2], "#")

GUISetState()

While 1
; Handle the GUI
    $msg = GUIGetMsg()
    Switch $msg
  Case $GUI_EVENT_CLOSE
   Exit
 EndSwitch
WEnd

Func buttonPress()
    Local $aString, $sOut = ""
    For $Y = 0 To $gridHeight - 1
        For $X = 0 To $gridWidth - 1
            If @GUI_CtrlId = $btnArray[$Y][$X] Then
           ; MsgBox(0, "Grid Ref", $Y & "," & $X)
                Button(GUICtrlRead($btnArray[$Y][$X]))
           ; ConsoleWrite("!>BUTTON: " & GUICtrlRead($btnArray[$Y][$X]) & @CRLF)
           ; ConsoleWrite("->USER_INSERT: " & $user_insert & @CRLF)
                If Not $Edit = "" Then 
                    ConsoleWrite("+>OUTPUT: " & $Edit & @CRLF)
                    GUICtrlSetData($cWord, $Edit)
                EndIf
            EndIf
        Next
    Next
EndFunc ;==>buttonPress

Func Button($iNum)
    $user_insert = $user_insert & $inum

    If $iNum = 1 then
        $user_insert = ""
        $edit = ""
        GUICtrlSetData($cWord, $edit)
        GUICtrlSetBkColor($cNext, 0xff0000)
 Elseif $iNum = "0" Then
  MsgBox(0, "T9", "Woops, the 0 key is not added yet!")
 Elseif $iNum = "*" Then
  MsgBox(0, "T9", "Woops, the * key is not added yet!")
 Elseif $iNum = "#" Then
  MsgBox(0, "T9", "Woops, the # key is not added yet!")
    Else
        If $inum = 'nul' Then
            $in = $in & 0
        Else
            $in = $in & $user_insert
        EndIf
    EndIf

    Search_Word($user_insert)
EndFunc ;==>Button

Func Search_Word($sIn)
    If StringLen($sIn) >= 1 Then
        $sOut = ""
        $aRegEx = StringRegExp(FileRead($sFile), "(?i)(?m)^(" & $user_insert & ".*)$", 3)
        If IsArray($aRegEx) Then
            For $i = 0 To UBound($aRegEx) - 1
                $sOut &= $aRegEx[$i]
            Next
            If $Edit <> StringStripWS($sOut, 2) Then $Edit = StringStripWS($sOut, 2)
            If $Edit <> "" Then GUICtrlSetBkColor($cNext, 0x00ff00)
        EndIf
    EndIf
EndFunc ;==>Search_Word

Func GetHoveredHwnd()
    Local $iRet = DllCall("user32.dll", "int", "WindowFromPoint", "long", MouseGetPos(0), "long", MouseGetPos(1))
    If IsArray($iRet) Then Return HWnd($iRet[0])
    Return SetError(1, 0, 0)
EndFunc

Func Close()
    Exit
EndFunc ;==>Close

Posted

You put a lot of time into this one James...

Both of you should see this.... heck, I just post it here too!

Skin...

Posted Image

and the code....

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <_ControlHover.au3>

Global Const $WM_LBUTTONDOWN = 0x0201
Global $B[10], $Time, $Wait, $Voice = 0, $action = " Numbers"
Global $Info_Read = "Dave 555-1255|Cindy 447-4145|Ray 332-1988|Hotty 978-LOVE"
; read in data from a file?
Global $Key[10], $Symbol[10] = ["", "", "@", "%", "?", "!", ".", "+", "-", "="]
$Key[2] = "A,B,C,a,b,c"
$Key[3] = "D,E,F,d,e,f"
$Key[4] = "G,H,I,g,h,i"
$Key[5] = "J,K,L,j,k,l"
$Key[6] = "M,N,O,m,n,o"
$Key[7] = "P,Q,R,S,p,q,r,s"
$Key[8] = "T,U,V,t,u,v"
$Key[9] = "W,X,Y,Z,w,x,y,z"

$My_pic = @TempDir & "\Bckgrnd.jpg"
FileInstall(@ScriptDir & "\ipod.jpg", $My_pic)

$Main = GUICreate("T-90", 320, 480, -1, -1, $WS_POPUP)
$back = GUICtrlCreatePic($My_pic, 0, 0, 320, 480);, $WS_CLIPSIBLINGS)
GUICtrlSetState(-1, $GUI_DISABLE)
$exit = GUICtrlCreateLabel("", 295, 4, 20, 10)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$sound = GUICtrlCreateLabel("     OFF", 39, 3, 35, 12)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$save = GUICtrlCreateLabel("", 267, 29, 47, 25)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$cancel = GUICtrlCreateLabel("", 8, 29, 55, 25)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$Edit1 = GUICtrlCreateInput("~Phone #", 18, 110, 285, 53)
GUICtrlSetFont(-1, 30)
$Edit2 = GUICtrlCreateList("A Phone List", 18, 175, 285, 72)
GUICtrlSetFont(-1, 24)
GUICtrlSetData(-1, $Info_Read, 1)
$B[1] = GUICtrlCreateLabel(" Clear", 0, 265, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$B[2] = GUICtrlCreateLabel(" @", 107, 265, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$B[3] = GUICtrlCreateLabel(" %", 214, 265, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$B[4] = GUICtrlCreateLabel(" ?", 0, 319, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$B[5] = GUICtrlCreateLabel(" !", 107, 319, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$B[6] = GUICtrlCreateLabel(" .", 214, 319, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$B[7] = GUICtrlCreateLabel(" +", 0, 373, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$B[8] = GUICtrlCreateLabel(" -", 107, 373, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$B[9] = GUICtrlCreateLabel(" =", 214, 373, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$star = GUICtrlCreateLabel(" Numbers", 0, 427, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$B[0] = GUICtrlCreateLabel(" Space", 107, 427, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$del = GUICtrlCreateLabel("", 214, 427, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$back = GUICtrlCreatePic($My_pic, 0, 0, 320, 480, $WS_CLIPSIBLINGS)
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetState()
_GuiRoundCorners($Main, 1, 1, 10, 10)
GUIRegisterMsg($WM_LBUTTONDOWN, "_WinMove")

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $exit, -3
            Exit
        Case $save, $cancel
            MsgBox(0X0, "Sorry", "This action is not currently available.... 8)    ")
        Case $star
            If GUICtrlRead($star) = " Numbers" Then
                $action = " Letters"
                GUICtrlSetData($star, $action)
                If $Voice Then Speak_Now("Letters")
            ElseIf GUICtrlRead($star) = " Letters" Then
                $action = " Symbols"
                GUICtrlSetData($star, $action)
                If $Voice Then Speak_Now("Symbols")
            Else
                $action = " Numbers"
                GUICtrlSetData($star, $action)
                If $Voice Then Speak_Now("Numbers")
            EndIf
        Case $del
            GUICtrlSetData($Edit1, StringTrimRight(GUICtrlRead($Edit1), 1))
            If $Voice Then Speak_Now("BackSpace")
            While GUIGetMsg() = $del
                GUICtrlSetData($Edit1, StringTrimRight(GUICtrlRead($Edit1), 1))
                If $Voice Then Speak_Now("BackSpace")
                Sleep(10)
            WEnd
        Case $sound
            If StringInStr(GUICtrlRead($sound), "ON") Then
                $Voice = 0
                GUICtrlSetData($sound, "     OFF")
            Else
                $Voice = 1
                GUICtrlSetData($sound, "     ON")
                If $Voice Then Speak_Now("Voice, On")
            EndIf
            
        Case Else
            For $x = 0 To 9
                If $msg = $B[$x] Then
                    Set_Text($x)
                    ;ExitLoop
                EndIf
            Next
    EndSwitch
    
WEnd

Func Set_Text($in)
    $Info = GUICtrlRead($Edit1)
    If StringInStr($Info, "~") Then $Info = ""
    If $action = " Numbers" Then
        If $Voice Then Speak_Now($in)
        Return GUICtrlSetData($Edit1, $Info & $in)
    EndIf
    If $in = "1" Then
        If $Voice Then Speak_Now("Clear")
        Return GUICtrlSetData($Edit1, "")
    EndIf
    If $in = "0" Then
        If $Voice Then Speak_Now("Space")
        Return GUICtrlSetData($Edit1, GUICtrlRead($Edit1) & " ")
    EndIf
    If $action = " Symbols" Then
        If $Voice Then Speak_Now("Symbol")
        Return GUICtrlSetData($Edit1, $Info & $Symbol[$in])
    EndIf
    Local $lock = GUIGetCursorInfo($Main), $Split = StringSplit($Key[$in], ","), $cnt = 1
    GUICtrlSetData($Edit1, $Info & $Split[$cnt])
    If $Voice Then Speak_Now($Split[$cnt])
    While IsArray($lock) And $lock[4] == $B[$in]
        Sleep(100)
        $lock = GUIGetCursorInfo($Main)
        If IsArray($lock) And $lock[2] = "1" Then
            $cnt += 1
            $Info = StringTrimRight(GUICtrlRead($Edit1), 1)
            GUICtrlSetData($Edit1, $Info & $Split[$cnt])
            If $Voice Then Speak_Now($Split[$cnt])
            If $cnt >= $Split[0] Then $cnt = 0
            Sleep(100)
        EndIf
        Sleep(100)
    WEnd
EndFunc   ;==>Set_Text

Func Speak_Now($Now_text)
    Local $oi_speech = ObjCreate("SAPI.SpVoice")
    If IsObj($oi_speech) Then $oi_speech.Speak($Now_text)
    $oi_speech = ""
EndFunc   ;==>Speak_Now

Func _WinMove($HWnd, $Command, $wParam, $lParam)
    If BitAND(WinGetState($HWnd), 32) Then Return $GUI_RUNDEFMSG
    DllCall("user32.dll", "long", "SendMessage", "hwnd", $HWnd, "int", $WM_SYSCOMMAND, "int", 0xF009, "int", 0)
EndFunc   ;==>_WinMove

Func _GuiRoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3) ; thanks gafrost
    Dim $XS_pos, $XS_ret, $XS_ret2
    $XS_pos = WinGetPos($h_win)
    $XS_ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $XS_pos[2], "long", $XS_pos[3], "long", $i_x3, "long", $i_y3)
    If $XS_ret[0] Then
        $XS_ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $XS_ret[0], "int", 1)
    EndIf
EndFunc   ;==>_GuiRoundCorners

8)

NEWHeader1.png

Posted

Holy crap that's amazing.

I have spent a lot of time on that code but you just did me over 9000 times.

I didn't get into the dictionary or word functions like you did... so maybe you can integrate them into this working visual GUI. Also the letters need some help

8)

NEWHeader1.png

Posted

Hello,

post some awful code under there.

Post because i can't explain me in better way. Attach also superb FreeText.au3 by Valuater,

that do all hard job.

My intention is to have variable hard printed on monitor as OSD (on screen display)

usefull to see clearly on video passed value. (usefull for T9 script)

Example (bad bad script) allows to cicle in an array with mouse wheel to have changing values on screen.

(this is main request)

Apologize for bad englsh and ridiculus script, but when need all help .

m.

Posted

Oh, I just thought that it might need something else. I will get to this straight away :mellow:

You can work the back-end and I will put a little more into the Interface. I am working on the "hover" effect he described... ( will look at = working ... lol )

8)

NEWHeader1.png

Posted

OK... got "AutoClick" working

added slider for sound

added slider for transparency

added slider for "pause" time between clicks

*** When in need of two letters from the same key, just clcik or Autoclick on the input

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>

Global Const $WM_LBUTTONDOWN = 0x0201
Global $XS_n, $B[10], $Time, $Wait, $Voice = 0, $action = " Numbers", $Hover = 0, $Pause = 200
Global $Info_Read = "Dave 555-1255|Cindy 447-4145|Ray 332-1988|Hotty 978-LOVE"
; read in data from a file?
Global $Trans = 100, $Tmin = 20, $level = _SoundGetWaveVolume(), $aHold, $cHold
Global $Key[10], $Symbol[10] = ["", "", "@", "%", "?", "!", ".", "+", "-", "="]
$Key[2] = "A,B,C,a,b,c"
$Key[3] = "D,E,F,d,e,f"
$Key[4] = "G,H,I,g,h,i"
$Key[5] = "J,K,L,j,k,l"
$Key[6] = "M,N,O,m,n,o"
$Key[7] = "P,Q,R,S,p,q,r,s"
$Key[8] = "T,U,V,t,u,v"
$Key[9] = "W,X,Y,Z,w,x,y,z"

$My_pic = @TempDir & "\Bckgrnd.jpg"
FileInstall(@ScriptDir & "\ipod.jpg", $My_pic)

$Main = GUICreate("T-90", 320, 480, -1, -1, $WS_POPUP)
$back = GUICtrlCreatePic($My_pic, 0, 0, 320, 480)
GUICtrlSetState(-1, $GUI_DISABLE)
$exit = GUICtrlCreateLabel("", 295, 4, 20, 10)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$sound = GUICtrlCreateLabel("     OFF", 39, 3, 35, 12)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$AutoClick = GUICtrlCreateLabel(" AUTO_CLICK", 99, 3, 70, 14)

GUICtrlSetBkColor(-1, 0x4876FF) ;FF0000) ; red
$save = GUICtrlCreateLabel("", 267, 29, 47, 25)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$cancel = GUICtrlCreateLabel("", 8, 29, 55, 25)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$Edit1 = GUICtrlCreateInput("~Phone #", 18, 110, 285, 53)
GUICtrlSetFont(-1, 30)
$Edit2 = GUICtrlCreateList("A Phone List", 18, 175, 285, 72)
GUICtrlSetFont(-1, 24)
GUICtrlSetData(-1, $Info_Read, 1)
$Slider1 = GUICtrlCreateSlider(0, 245, 159, 20)
GUICtrlSetBkColor(-1, 0xDCDDE1)
GUICtrlSetLimit(-1, 100, 0)
GUICtrlSetData(-1, $level)
$Slider2 = GUICtrlCreateSlider(160, 245, 159, 20)
GUICtrlSetBkColor(-1, 0xDCDDE1)
GUICtrlSetLimit(-1, 100, 0)
GUICtrlSetData($Slider2, $Trans * 2.55)
$Slider3 = GUICtrlCreateSlider(0, 225, 159, 20)
GUICtrlSetBkColor(-1, 0xDCDDE1)
GUICtrlSetLimit(-1, 300, 0)
GUICtrlSetData($Slider3, $Pause)
$B[1] = GUICtrlCreateLabel(" Clear", 0, 265, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$B[2] = GUICtrlCreateLabel(" @", 107, 265, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$B[3] = GUICtrlCreateLabel(" %", 214, 265, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$B[4] = GUICtrlCreateLabel(" ?", 0, 319, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$B[5] = GUICtrlCreateLabel(" !", 107, 319, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$B[6] = GUICtrlCreateLabel(" .", 214, 319, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$B[7] = GUICtrlCreateLabel(" +", 0, 373, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$B[8] = GUICtrlCreateLabel(" -", 107, 373, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$B[9] = GUICtrlCreateLabel(" =", 214, 373, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$star = GUICtrlCreateLabel(" Numbers", 0, 427, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$B[0] = GUICtrlCreateLabel(" Space", 107, 427, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$del = GUICtrlCreateLabel("", 214, 427, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$back = GUICtrlCreatePic($My_pic, 0, 0, 320, 480, $WS_CLIPSIBLINGS)
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetState()
_GuiRoundCorners($Main, 1, 1, 10, 10)
GUIRegisterMsg($WM_LBUTTONDOWN, "_WinMove")

While 1
    
    
    If $Hover Then
        Sleep($Pause * 10)
        ToolTip("")
        $inf = GUIGetCursorInfo($Main)
        $msg = $inf[4]
    Else
        $msg = GUIGetMsg()
        $inf = GUIGetCursorInfo($Main)
        If $inf[4] = $AutoClick Then $msg = $inf[4]
    EndIf
    
    Switch $msg
        Case $exit, -3
            Exit
        Case $save, $cancel
            MsgBox(0X0, "Sorry", "This action is not currently available.... 8)    ", 3)
        Case $Edit1, $Edit2
            $aHold = ""
            If $Hover Then MouseClick("")
        Case $star
            If GUICtrlRead($star) = " Numbers" Then
                $action = " Letters"
                GUICtrlSetData($star, $action)
                If $Voice Then Speak_Now("Letters")
            ElseIf GUICtrlRead($star) = " Letters" Then
                $action = " Symbols"
                GUICtrlSetData($star, $action)
                If $Voice Then Speak_Now("Symbols")
            Else
                $action = " Numbers"
                GUICtrlSetData($star, $action)
                If $Voice Then Speak_Now("Numbers")
            EndIf
        Case $del
            GUICtrlSetData($Edit1, StringTrimRight(GUICtrlRead($Edit1), 1))
            If $Voice Then Speak_Now("BackSpace")
        Case $sound
            If StringInStr(GUICtrlRead($sound), "ON") Then
                $Voice = 0
                GUICtrlSetData($sound, "     OFF")
            Else
                $Voice = 1
                GUICtrlSetData($sound, "     ON")
                If $Voice Then Speak_Now("Voice, On")
            EndIf
        Case $AutoClick
            If $Hover = 0 Then
                $Hover = 1
                GUICtrlSetBkColor($AutoClick, 0x00ff00) ; Green
                If $Voice Then Speak_Now("Auto, Click, On")
            Else
                $Hover = 0
                GUICtrlSetBkColor($AutoClick, 0x4876FF) ;FF0000) ; red
                If $Voice Then Speak_Now("Auto, Click, Off")
                Sleep(1000)
            EndIf
        Case $Slider1
            If $Hover Then MouseClick("")
            ToolTip("")
        Case $Slider2
            If $Hover Then MouseClick("")
            ToolTip("")
            If $Trans <= 20 Then
                $Trans = $Tmin
                WinSetTrans($Main, "", $Trans * 2.55)
                GUICtrlSetData($Slider2, $Trans)
            EndIf
        Case $Slider3
            If $Hover Then MouseClick("")
            ToolTip("")
        Case Else
            For $x = 0 To 9
                If $msg = $B[$x] Then
                    Set_Text($x)
                EndIf
            Next
    EndSwitch
    If $level <> GUICtrlRead($Slider1) Then
        $level = GUICtrlRead($Slider1)
        ToolTip("Volume = " & $level)
        SoundSetWaveVolume($level)
    EndIf
    If $Trans <> GUICtrlRead($Slider2) Then
        $Trans = GUICtrlRead($Slider2)
        ToolTip("Transparency = " & $Trans)
        WinSetTrans($Main, "", $Trans * 2.55)
    EndIf
    If $Pause <> GUICtrlRead($Slider3) Then
        $Pause = GUICtrlRead($Slider3)
        ToolTip("AutoClick Pause = " & $Pause)
    EndIf
WEnd

; -------- Functions -----------------------


Func Set_Text($in)
    $Info = GUICtrlRead($Edit1)
    If StringInStr($Info, "~") Then $Info = ""
    If $action = " Numbers" Then
        If $Voice Then Speak_Now($in)
        Return GUICtrlSetData($Edit1, $Info & $in)
    EndIf
    If $in = "1" Then
        If $Voice Then Speak_Now("Clear")
        Return GUICtrlSetData($Edit1, "")
    EndIf
    If $in = "0" Then
        If $Voice Then Speak_Now("Space")
        Return GUICtrlSetData($Edit1, GUICtrlRead($Edit1) & " ")
    EndIf
    If $action = " Symbols" Then
        If $Voice Then Speak_Now("Symbol")
        Return GUICtrlSetData($Edit1, $Info & $Symbol[$in])
    EndIf
    $Split = StringSplit($Key[$in], ",")
    $cnt = 1
    If $aHold = $Key[$in] And $cHold >= 1 Then $cnt = $cHold + 1
    If $cnt >= 2 Then $Info = StringTrimRight($Info, 1)
    If $cnt > $Split[0] Then $cnt = 1
    $aHold = $Key[$in]
    $cHold = $cnt
    GUICtrlSetData($Edit1, $Info & $Split[$cnt])
    If $Voice Then Speak_Now($Split[$cnt])
    Return
EndFunc   ;==>Set_Text


Func Speak_Now($Now_text)
    Local $oi_speech = ObjCreate("SAPI.SpVoice")
    If IsObj($oi_speech) Then $oi_speech.Speak($Now_text)
    $oi_speech = ""
EndFunc   ;==>Speak_Now

Func _WinMove($HWnd, $Command, $wParam, $lParam)
    If BitAND(WinGetState($HWnd), 32) Then Return $GUI_RUNDEFMSG
    DllCall("user32.dll", "long", "SendMessage", "hwnd", $HWnd, "int", $WM_SYSCOMMAND, "int", 0xF009, "int", 0)
EndFunc   ;==>_WinMove

Func _GuiRoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3) ; thanks gafrost
    Dim $XS_pos, $XS_ret, $XS_ret2
    $XS_pos = WinGetPos($h_win)
    $XS_ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $XS_pos[2], "long", $XS_pos[3], "long", $i_x3, "long", $i_y3)
    If $XS_ret[0] Then
        $XS_ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $XS_ret[0], "int", 1)
    EndIf
EndFunc   ;==>_GuiRoundCorners

Func _SoundGetWaveVolume()
    Local $WaveVol = -1, $p, $ret
    Const $MMSYSERR_NOERROR = 0
    $p = DllStructCreate("dword")
    If @error Then
        SetError(2)
        Return -2
    EndIf
    $ret = DllCall("winmm.dll", "long", "waveOutGetVolume", "long", -1, "long", DllStructGetPtr($p))
    If ($ret[0] == $MMSYSERR_NOERROR) Then
        $WaveVol = Round(Dec(StringRight(Hex(DllStructGetData($p, 1), 8), 4)) / 0xFFFF * 100)
    Else
        SetError(1)
    EndIf
    $Struct = 0
    Return $WaveVol
EndFunc   ;==>_SoundGetWaveVolume

8)

NEWHeader1.png

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
  • Recently Browsing   0 members

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