Hallo,
mein neues Projekt ist eigentlich fertig. Ein Windowslogon via Spracherkennung.
Beim Laufenlassen des Skriptes läuft alles sauber:
Spoiler anzeigen
#include <GUIConstants.au3>
#include <GDIPlus.au3>
#include <WinAPI.au3>
#include <Misc.au3>
#include <SAPIListBox.au3>
Local $x1, $y1, $x2 = 0
Local $y2 = @DesktopHeight / 2
Local $login = False
Local $password = IniRead(@ScriptDir & "\data.ini", "data", "pw", "hello")
Dim $wortbox_array[1] = [$password]
HotKeySet("0", "emergency")
$oTalk = ObjCreate('SAPI.SpVoice')
$oTalk.voice = $oTalk.GetVoices("Name=Microsoft Sam", "Language=409" ).Item(0)
$vUser32DLL = DllOpen("User32.dll")
$iGUIWidth = @DesktopWidth
$iGUIHeight = @DesktopHeight
$tSize = DllStructCreate($tagSIZE)
$pSize = DllStructGetPtr($tSize)
DllStructSetData($tSize, "X", $iGUIWidth)
DllStructSetData($tSize, "Y", $iGUIHeight)
$tSource = DllStructCreate($tagPOINT)
$pSource = DllStructGetPtr($tSource)
$tBlend = DllStructCreate($tagBLENDFUNCTION)
$pBlend = DllStructGetPtr($tBlend)
DllStructSetData($tBlend, "Alpha", 255)
DllStructSetData($tBlend, "Format", 1)
$hWnd = GUICreate("", $iGUIWidth, $iGUIHeight, 0, 0, 0x08000000, BitOR(0x00080000, 0x00000080))
GUISetState()
$hDC_Window = _WinAPI_GetDC($hWnd)
$hDC_Buffer = _WinAPI_CreateCompatibleDC($hDC_Window)
$hBitmap_Buffer = _WinAPI_CreateCompatibleBitmap($hDC_Window, $iGUIWidth, $iGUIHeight)
_WinAPI_SelectObject($hDC_Buffer, $hBitmap_Buffer)
$fenster = GUICreate("Speechlock by $2Billie", 400, 300)
$wortbox = _GUICtrlSAPIListBox_Create(10, 10, 380, 280)
_GUICtrlSAPIListBox_EnableSpeech($wortbox, 3)
_GUICtrlSAPIListBox_AddArray($wortbox, $wortbox_array)
GUISetState(@SW_HIDE, $fenster)
_GDIPlus_Startup()
$hGraphics = _GDIPlus_GraphicsCreateFromHDC($hDC_Buffer)
$img = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\startscreen.jpg")
$img2 = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\startscreen2.jpg")
_drawgdiplus("Please say your password")
Do
If @SEC = 30 Or @SEC = 0 Then
$oTalk.Speak("Please say your password.")
Sleep(1000)
EndIf
$gettext = _GUICtrlSAPIListBox_GetText($wortbox)
If _GUICtrlSAPIListBox_CurSelChanged($wortbox) = True Then
$gettext = _GUICtrlSAPIListBox_GetText($wortbox)
If $gettext = $password Then
$login = True
EndIf
EndIf
Until $login <> False
_drawgdiplus("Access was admitted")
Sleep(1000)
$oTalk.Speak("Access was admitted.")
While $x1 > (-@DesktopWidth) And $x2 < @DesktopWidth
_GDIPlus_GraphicsClear($hGraphics)
$x1 -= 2
$x2 += 2
_GDIPlus_GraphicsDrawImageRect($hGraphics, $img, $x1, $y1, @DesktopWidth, @DesktopHeight / 2)
_GDIPlus_GraphicsDrawImageRect($hGraphics, $img2, $x2, $y2, @DesktopWidth, @DesktopHeight / 2)
_WinAPI_UpdateLayeredWindow($hWnd, $hDC_Window, 0, $pSize, $hDC_Buffer, $pSource, 0, $pBlend, 2)
WEnd
If @HOUR - 12 >= 3 And @HOUR <= 12 Then $oTalk.Speak("Good morning " & @UserName)
If @HOUR >= 13 And @HOUR <= 17 Then $oTalk.Speak("Good Day " & @UserName)
If @HOUR >= 18 And @HOUR - 12 >= 2 Then $oTalk.Speak("Good Evening " & @UserName)
ShellExecute("explorer.exe")
Exit
[/autoit] [autoit][/autoit] [autoit]Func emergency()
$open = FileOpenDialog("Chose the file, where your password was saved.", @DesktopDir, "")
If $open = @ScriptDir & "\data.ini" Then
_drawgdiplus("Access was admitted")
Sleep(2000)
While $x1 > (-@DesktopWidth) And $x2 < @DesktopWidth
_GDIPlus_GraphicsClear($hGraphics)
$x1 -= 2
$x2 += 2
_GDIPlus_GraphicsDrawImageRect($hGraphics, $img, $x1, $y1, @DesktopWidth, @DesktopHeight / 2)
_GDIPlus_GraphicsDrawImageRect($hGraphics, $img2, $x2, $y2, @DesktopWidth, @DesktopHeight / 2)
_WinAPI_UpdateLayeredWindow($hWnd, $hDC_Window, 0, $pSize, $hDC_Buffer, $pSource, 0, $pBlend, 2)
WEnd
If @HOUR - 12 >= 3 And @HOUR <= 12 Then $oTalk.Speak("Good morning " & @UserName)
If @HOUR >= 13 And @HOUR <= 17 Then $oTalk.Speak("Good Day " & @UserName)
If @HOUR >= 18 And @HOUR - 12 >= 2 Then $oTalk.Speak("Good Evening " & @UserName)
ShellExecute("explorer.exe")
Sleep(2000)
Exit
[/autoit] [autoit][/autoit] [autoit]Else
$oTalk.Speak("You have said the wrong password.")
EndIf
EndFunc ;==>emergency
Func _GDIPlus_GraphicsDrawStringColor($hGraphics, $sString, $nX, $nY, $sFont = "Arial", $nSize = 10, $iFormat = 0, $iBrush = 0xFF000000)
Local $hBrush, $iError, $hFamily, $hFont, $hFormat, $aInfo, $tLayout, $bResult
$hBrush = _GDIPlus_BrushCreateSolid($iBrush)
$hFormat = _GDIPlus_StringFormatCreate($iFormat)
$hFamily = _GDIPlus_FontFamilyCreate($sFont)
$hFont = _GDIPlus_FontCreate($hFamily, $nSize)
$tLayout = _GDIPlus_RectFCreate($nX, $nY, 0, 0)
$aInfo = _GDIPlus_GraphicsMeasureString($hGraphics, $sString, $hFont, $tLayout, $hFormat)
$bResult = _GDIPlus_GraphicsDrawStringEx($hGraphics, $sString, $hFont, $aInfo[0], $hFormat, $hBrush)
$iError = @error
_GDIPlus_FontDispose($hFont)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_StringFormatDispose($hFormat)
_GDIPlus_BrushDispose($hBrush)
Return SetError($iError, 0, $bResult)
EndFunc ;==>_GDIPlus_GraphicsDrawStringColor
Func _drawgdiplus($htext)
_GDIPlus_GraphicsDrawImageRect($hGraphics, $img, $x1, $y1, @DesktopWidth, @DesktopHeight / 2)
_GDIPlus_GraphicsDrawImageRect($hGraphics, $img2, $x2, $y2, @DesktopWidth, @DesktopHeight / 2)
_GDIPlus_GraphicsDrawStringColor($hGraphics, $htext, "", @DesktopHeight / 2, "Arial", 40, 0, 0x4B0000FF)
_WinAPI_UpdateLayeredWindow($hWnd, $hDC_Window, 0, $pSize, $hDC_Buffer, $pSource, 0, $pBlend, 2)
EndFunc ;==>_drawgdiplus
[/autoit]
Spracherkennung funktioniert...und sonst auch alles!
Nachdem man die au3 kompiliert hat, kommt jedoch gerade in dem Moment, in dem das Passwort erkannt wurde, ein Error:
Zitatline 6640 the requested action with this object has failed
Ich weiß echt nicht, was ich falsch mach, wo der Fehler liegt!
Nötige Include von Peter Sean Griffin:
Spoiler anzeigen
#include-once
#include <IE.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region Header
#cs
Title: SAPIListBox UDF Library for AutoIt3
Filename: SAPIListBox.au3
Description: A collection of functions for creating and controlling a SAPIListBox control in AutoIT
Author: seangriffin
Version: V0.1
Last Update: 21/05/10
Requirements: AutoIt3 3.2 or higher,
the Microsoft Speech API SDK v5.1
Changelog:
---------21/05/10---------- v0.1
Initial release.
Note that a clipping problem currently exists in the VLC control.
#ce
#EndRegion Header
#Region Global Variables and Constants
Global $curr_speech_list_index = -1, $SpeechListBoxCtrl
#EndRegion Global Variables and Constants
#Region Core functions
; #FUNCTION# ;===============================================================================
;
; Name...........: _GUICtrlSAPIListBox_Create()
; Description ...: Creates a SAPI ListBox control.
; Syntax.........: _GUICtrlSAPIListBox_Create($left, $top, $width, $height, $enable_speech = True, $enable_listbox = True, $hide_listbox = False, $items = False)
; Parameters ....: $left - The left side of the control.
; $top - The top of the control.
; $width - The width of the control.
; $height - The height of the control.
; $enable_speech - A boolean value indicating whether to enable speech recognition.
; $enable_listbox - A boolean value indicating whether to enable the listbox.
; $hide_listbox - A boolean value indicating whether to hide the listbox.
; $items - An array of items to populate the listbox with.
; Return values .: On Success - Returns the identifier (controlID) of the new control.
; On Failure - Returns False.
; Author ........: seangriffin
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: Yes
;
; ;==========================================================================================
Func _GUICtrlSAPIListBox_Create($left, $top, $width, $height, $enable_speech = True, $enable_listbox = True, $hide_listbox = False, $items = False)
Local $SpeechListBox
[/autoit] [autoit][/autoit] [autoit]$SpeechListBox = ObjCreate("SAPI51ListBox.Sample")
[/autoit] [autoit][/autoit] [autoit]; If the SAPIListBox is not a valid object (ie. the SAPI 5.1 SDK is not installed), then return False.
if $SpeechListBox = 0 Then Return False
$SpeechListBoxCtrl = GUICtrlCreateObj ($SpeechListBox, $left, $top, $width, $height)
[/autoit] [autoit][/autoit] [autoit]if $enable_speech = True Then
[/autoit] [autoit][/autoit] [autoit]_GUICtrlSAPIListBox_EnableSpeech($SpeechListBox, 1)
Else
_GUICtrlSAPIListBox_EnableSpeech($SpeechListBox, 0)
EndIf
_GUICtrlSAPIListBox_Enable($SpeechListBox, $enable_listbox)
_GUICtrlSAPIListBox_Hide($SpeechListBox, $hide_listbox)
if IsArray($items) Then _GUICtrlSAPIListBox_AddArray($SpeechListBox, $items)
[/autoit] [autoit][/autoit] [autoit]Return $SpeechListBox
EndFunc
; #FUNCTION# ;===============================================================================
;
; Name...........: _GUICtrlSAPIListBox_EnableSpeech()
; Description ...: Enables or disables speech recognition in a SAPI ListBox control.
; Syntax.........: _GUICtrlSAPIListBox_EnableSpeech($SAPIListBox, $toggle)
; Parameters ....: $SAPIListBox - The control identifier (controlID) as returned by _GUICtrlSAPIListBox_Create.
; $toggle - 1 = enable
; 0 = disable
; Return values .: On Success - Returns True.
; On Failure - Returns False.
; Author ........: seangriffin
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: Yes
;
; ;==========================================================================================
Func _GUICtrlSAPIListBox_EnableSpeech($SAPIListBox, $toggle)
$SAPIListBox.SpeechEnabled = $toggle
[/autoit] [autoit][/autoit] [autoit]Return True
EndFunc
; #FUNCTION# ;===============================================================================
;
; Name...........: _GUICtrlSAPIListBox_Enable()
; Description ...: Enables or disables a SAPI ListBox control.
; Syntax.........: _GUICtrlSAPIListBox_Enable($SAPIListBox, $toggle)
; Parameters ....: $SAPIListBox - The control identifier (controlID) as returned by _GUICtrlSAPIListBox_Create.
; $toggle - 1 = enable
; 0 = disable
; Return values .: On Success - Returns True.
; On Failure - Returns False.
; Author ........: seangriffin
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: Yes
;
; ;==========================================================================================
Func _GUICtrlSAPIListBox_Enable($SAPIListBox, $toggle)
$SAPIListBox.Enabled = $toggle
[/autoit] [autoit][/autoit] [autoit]Return True
EndFunc
; #FUNCTION# ;===============================================================================
;
; Name...........: _GUICtrlSAPIListBox_Hide()
; Description ...: Hides or shows a SAPI ListBox control.
; Syntax.........: _GUICtrlSAPIListBox_Hide($SAPIListBox, $toggle)
; Parameters ....: $SAPIListBox - The control identifier (controlID) as returned by _GUICtrlSAPIListBox_Create.
; $toggle - 1 = hide
; 0 = show
; Return values .: On Success - Returns True.
; On Failure - Returns False.
; Author ........: seangriffin
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: Yes
;
; ;==========================================================================================
Func _GUICtrlSAPIListBox_Hide($SAPIListBox, $toggle)
if $toggle = 1 Then
[/autoit] [autoit][/autoit] [autoit]GUICtrlSetState($SpeechListBoxCtrl, $GUI_HIDE)
Else
GUICtrlSetState($SpeechListBoxCtrl, $GUI_SHOW)
EndIf
Return True
EndFunc
; #FUNCTION# ;===============================================================================
;
; Name...........: _GUICtrlSAPIListBox_AddString()
; Description ...: Adds a string to the end of a SAPI ListBox control.
; Syntax.........: _GUICtrlSAPIListBox_AddString($SAPIListBox, $text)
; Parameters ....: $SAPIListBox - The control identifier (controlID) as returned by _GUICtrlSAPIListBox_Create.
; $text - String that is to be added.
; Return values .: On Success - Returns True.
; On Failure - Returns False.
; Author ........: seangriffin
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: Yes
;
; ;==========================================================================================
Func _GUICtrlSAPIListBox_AddString($SAPIListBox, $text)
$SAPIListBox.AddItem ($text)
[/autoit] [autoit][/autoit] [autoit]Return True
EndFunc
; #FUNCTION# ;===============================================================================
;
; Name...........: _GUICtrlSAPIListBox_DeleteString()
; Description ...: Deletes a string from the SAPI ListBox control.
; Syntax.........: _GUICtrlSAPIListBox_DeleteString($SAPIListBox, $index)
; Parameters ....: $SAPIListBox - The control identifier (controlID) as returned by _GUICtrlSAPIListBox_Create.
; $index - Zero-based index of the string to be deleted.
; Return values .: On Success - Returns True.
; On Failure - Returns False.
; Author ........: seangriffin
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: Yes
;
; ;==========================================================================================
Func _GUICtrlSAPIListBox_DeleteString($SAPIListBox, $index)
$SAPIListBox.RemoveItem ($index)
[/autoit] [autoit][/autoit] [autoit]Return True
EndFunc
; #FUNCTION# ;===============================================================================
;
; Name...........: _GUICtrlSAPIListBox_GetSel()
; Description ...: Returns the selection status of an item.
; Syntax.........: _GUICtrlSAPIListBox_GetSel($SAPIListBox, $index)
; Parameters ....: $SAPIListBox - The control identifier (controlID) as returned by _GUICtrlSAPIListBox_Create.
; $index - Zero-based index of the index to get the selection status for.
; Return values .: On Success - Returns the selection status of an item.
; On Failure - Returns False.
; Author ........: seangriffin
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: Yes
;
; ;==========================================================================================
Func _GUICtrlSAPIListBox_GetSel($SAPIListBox, $index)
Return $SAPIListBox.Selected ($index)
EndFunc
; #FUNCTION# ;===============================================================================
;
; Name...........: _GUICtrlSAPIListBox_InsertString()
; Description ...: Inserts a string into a SAPI ListBox control.
; Syntax.........: _GUICtrlSAPIListBox_InsertString($SAPIListBox, $text, $index)
; Parameters ....: $SAPIListBox - The control identifier (controlID) as returned by _GUICtrlSAPIListBox_Create.
; $text - String that is to be added.
; $index - Specifies the zero based index of the position at which to insert the string.
; Return values .: On Success - Returns True.
; On Failure - Returns False.
; Author ........: seangriffin
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: Yes
;
; ;==========================================================================================
Func _GUICtrlSAPIListBox_InsertString($SAPIListBox, $text, $index)
$SAPIListBox.AddItem ($text, $index)
[/autoit] [autoit][/autoit] [autoit]Return True
EndFunc
; #FUNCTION# ;===============================================================================
;
; Name...........: _GUICtrlSAPIListBox_SetToolTip()
; Description ...: Sets the tooltip for the SAPI ListBox control.
; Syntax.........: _GUICtrlSAPIListBox_SetToolTip($SAPIListBox, $text)
; Parameters ....: $SAPIListBox - The control identifier (controlID) as returned by _GUICtrlSAPIListBox_Create.
; $text - String that is to be added as a tooltip.
; Return values .: On Success - Returns True.
; On Failure - Returns False.
; Author ........: seangriffin
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: Yes
;
; ;==========================================================================================
Func _GUICtrlSAPIListBox_SetToolTip($SAPIListBox, $text)
$SAPIListBox.ToolTipText = $text
[/autoit] [autoit][/autoit] [autoit]Return True
EndFunc
; #FUNCTION# ;===============================================================================
;
; Name...........: _GUICtrlSAPIListBox_AddArray()
; Description ...: Adds an array of strings to the end of a SAPI ListBox control.
; Syntax.........: _GUICtrlSAPIListBox_AddString($SAPIListBox, $array)
; Parameters ....: $SAPIListBox - The control identifier (controlID) as returned by _GUICtrlSAPIListBox_Create.
; $array - A one-dimensional array containing a list of string to be added.
; Return values .: On Success - Returns True.
; On Failure - Returns False.
; Author ........: seangriffin
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: Yes
;
; ;==========================================================================================
Func _GUICtrlSAPIListBox_AddArray($SAPIListBox, $array)
for $each in $array
[/autoit] [autoit][/autoit] [autoit]$SAPIListBox.AddItem ($each)
Next
Return True
EndFunc
; #FUNCTION# ;===============================================================================
;
; Name...........: _GUICtrlSAPIListBox_GetCurSel()
; Description ...: Retrieve the index of the currently selected item.
; Syntax.........: _GUICtrlSAPIListBox_GetCurSel($SAPIListBox)
; Parameters ....: $SAPIListBox - The control identifier (controlID) as returned by _GUICtrlSAPIListBox_Create.
; Return values .: On Success - Returns a zero based index of the currently selected item.
; On Failure - Returns False.
; Author ........: seangriffin
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: Yes
;
; ;==========================================================================================
Func _GUICtrlSAPIListBox_GetCurSel($SAPIListBox)
Return $SAPIListBox.ListIndex
EndFunc
; #FUNCTION# ;===============================================================================
;
; Name...........: _GUICtrlSAPIListBox_GetCount()
; Description ...: Retrieves the number of items.
; Syntax.........: _GUICtrlSAPIListBox_GetCount($SAPIListBox)
; Parameters ....: $SAPIListBox - The control identifier (controlID) as returned by _GUICtrlSAPIListBox_Create.
; Return values .: On Success - Returns the number of items in the list box.
; On Failure - Returns False.
; Author ........: seangriffin
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: Yes
;
; ;==========================================================================================
Func _GUICtrlSAPIListBox_GetCount($SAPIListBox)
Return $SAPIListBox.ListCount
EndFunc
; #FUNCTION# ;===============================================================================
;
; Name...........: _GUICtrlSAPIListBox_GetText()
; Description ...: Returns the currently selected item (string), or the item (string) at the specified index
; Syntax.........: _GUICtrlSAPIListBox_GetText($SAPIListBox, $index = -1)
; Parameters ....: $SAPIListBox - The control identifier (controlID) as returned by _GUICtrlSAPIListBox_Create.
; $index - Specifies the zero-based index of the string to retrieve
; -1 (default) = return text for the currently selected item.
; Return values .: On Success - Returns the text of the index provided (current selection if -1).
; On Failure - Returns False.
; Author ........: seangriffin
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: Yes
;
; ;==========================================================================================
Func _GUICtrlSAPIListBox_GetText($SAPIListBox, $index = -1)
if $index = -1 Then
[/autoit] [autoit][/autoit] [autoit]Return $SAPIListBox.text
Else
Return $SAPIListBox.List($index)
EndIf
Return False
EndFunc
; #FUNCTION# ;===============================================================================
;
; Name...........: _GUICtrlSAPIListBox_GetNewIndex()
; Description ...: Returns the index of the most recently added item.
; Syntax.........: _GUICtrlSAPIListBox_GetNewIndex($SAPIListBox)
; Parameters ....: $SAPIListBox - The control identifier (controlID) as returned by _GUICtrlSAPIListBox_Create.
; Return values .: On Success - Returns the index of the most recently added item.
; On Failure - Returns False.
; Author ........: seangriffin
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: Yes
;
; ;==========================================================================================
Func _GUICtrlSAPIListBox_GetNewIndex($SAPIListBox)
Return $SAPIListBox.NewIndex
EndFunc
; #FUNCTION# ;===============================================================================
;
; Name...........: _GUICtrlSAPIListBox_Refresh()
; Description ...: Forces a repaint of the listbox.
; Syntax.........: _GUICtrlSAPIListBox_Refresh($SAPIListBox)
; Parameters ....: $SAPIListBox - The control identifier (controlID) as returned by _GUICtrlSAPIListBox_Create.
; Return values .: On Success - Returns True.
; On Failure - Returns False.
; Author ........: seangriffin
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: Yes
;
; ;==========================================================================================
Func _GUICtrlSAPIListBox_Refresh($SAPIListBox)
Return $SAPIListBox.Refresh()
EndFunc
; #FUNCTION# ;===============================================================================
;
; Name...........: _GUICtrlSAPIListBox_ResetContent()
; Description ...: Removes all items from the SAPI list box
; Syntax.........: _GUICtrlSAPIListBox_ResetContent($SAPIListBox)
; Parameters ....: $SAPIListBox - The control identifier (controlID) as returned by _GUICtrlSAPIListBox_Create.
; Return values .: On Success - Returns True.
; On Failure - Returns False.
; Author ........: seangriffin
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: Yes
;
; ;==========================================================================================
Func _GUICtrlSAPIListBox_ResetContent($SAPIListBox)
$SAPIListBox.Clear()
[/autoit] [autoit][/autoit] [autoit]Return False
EndFunc
; #FUNCTION# ;===============================================================================
;
; Name...........: _GUICtrlSAPIListBox_CurSelChanged()
; Description ...: Returns an indication as to whether the current selection in the listbox has changed (since the last time function was run).
; Syntax.........: _GUICtrlSAPIListBox_CurSelChanged($SAPIListBox)
; Parameters ....: $SAPIListBox - The control identifier (controlID) as returned by _GUICtrlSAPIListBox_Create.
; Return values .: On Success - Returns a zero based index of the currently selected item.
; On Failure - Returns False.
; Author ........: seangriffin
; Modified.......:
; Remarks .......: I didn't want to write this function, but I currently don't know of any other
; way in AutoIT to detect if a SAPIlistbox has changed. Traditional methods,
; such as using a "WM_COMMAND" function or a "if $msg = $SAPIListBox then"
; check in the main message loop of the GUI, don't get triggered.
; Related .......:
; Link ..........:
; Example .......: Yes
;
; ;==========================================================================================
Func _GUICtrlSAPIListBox_CurSelChanged($SAPIListBox)
if $curr_speech_list_index <> $SAPIListBox.ListIndex() Then
[/autoit] [autoit][/autoit] [autoit]$curr_speech_list_index = $SAPIListBox.ListIndex()
Return True
EndIf
Return False
EndFunc
; #FUNCTION# ;===============================================================================
;
; Name...........: _SAPI_SpeechProperties()
; Description ...: Opens the SAPI Speech Properties control panel applet.
; Syntax.........: SAPI_SpeechProperties()
; Parameters ....:
; Return values .: On Success - Returns True.
; On Failure - Returns False.
; Author ........: seangriffin
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: Yes
;
; ;==========================================================================================
Func _SAPI_SpeechProperties()
Run("cmd.exe /c control.exe """ & @CommonFilesDir & "\Microsoft Shared\Speech\sapi.cpl""", @SystemDir, @SW_HIDE)
[/autoit] [autoit][/autoit] [autoit]Return True
EndFunc
Ansonsten ist Microsoft Speech SDK minimum 5.1 nötig(das Activex-Objekt muss auf dem >Rechner registriert sein!)
Downloadlink: http://www.microsoft.com/downloads/info.aspx?na=46&SrcFamilyId=5E86EC97-40A7-453F-B0EE-6583171B4530&SrcDisplayLang=en&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2fB%2f4%2f3%2fB4314928-7B71-4336-9DE7-6FA4CF00B7B3%2fSpeechSDK51.exe