
iCode
Active Members-
Posts
194 -
Joined
-
Last visited
Content Type
Forums
Downloads
Forum Articles
Events
Everything posted by iCode
-
New SciTE4AutoIt3 available with updated SciTE v3.4.1
iCode replied to Jos's topic in AutoIt Technical Discussion
@guinness - delete your scite settings in %appdata%LocalAutoIt v3SciTE and reinstall the S4A package it may be the new .lua file that is causing the problem -
New SciTE4AutoIt3 available with updated SciTE v3.4.1
iCode replied to Jos's topic in AutoIt Technical Discussion
indent the "If" and try it - if the "If" is at column 0, then the "Else" has no choice but to align itself properly -
New SciTE4AutoIt3 available with updated SciTE v3.4.1
iCode replied to Jos's topic in AutoIt Technical Discussion
it's that same regardless of the code -
New SciTE4AutoIt3 available with updated SciTE v3.4.1
iCode replied to Jos's topic in AutoIt Technical Discussion
i uninstalled both autoit and the scite package, deleted all leftovers, and re-installed both packages (the release versions as on the downloads pages) the result is the same... If 'this' Then 'that' Else the 'Else' is not indented properly, regardless of whether i backspace before typing 'Else' or not - after typing Else and pressing Enter, Else is not properly indented -
New SciTE4AutoIt3 available with updated SciTE v3.4.1
iCode replied to Jos's topic in AutoIt Technical Discussion
i have the latest S4A package installed as provided here: http://www.autoitscript.com/site/autoit-script-editor/downloads/ or do you mean the whole AutoIt installer? -
New SciTE4AutoIt3 available with updated SciTE v3.4.1
iCode replied to Jos's topic in AutoIt Technical Discussion
I think that's the trouble though - 'Else' is not indented according to the parent [-] If 'this' Then 'that' [-]Else 'die' EndIf -
New SciTE4AutoIt3 available with updated SciTE v3.4.1
iCode replied to Jos's topic in AutoIt Technical Discussion
v3.4.1. and one previous version i believe (win 7 x64 sp1) if i enter... If Else ...and press Enter after i type 'Else', i end up with... If Else -
i would suggest checking the error/return values from each of the functions to see what is failing
-
Connect AutoIT Script with USB Device
iCode replied to Spikeedoodles's topic in AutoIt General Help and Support
not sure AutoIt is what you're looking for - it sounds to me like you want a chunk of software that will communicate directly with a chunk of hardware ... and that's called a device driver which, far as i'm aware, is beyond what AutoIt is capable of it might be a different story if you were open to grabbing data from the existing driver -
or take a look at GUIRegisterMsg and (possibly) WM_SETFOCUS
-
what's wrong with exactly what you have? assuming the text contains a line something like "notepad.exe" or"[path]program.exe", what you have should work
-
GUICtrlSetImage - need help with button icon
iCode posted a topic in AutoIt General Help and Support
the attached file is what is supposed to be a multi-res icon containing 2 images; 64x64 and 128x128, created with GIMP and exported as an ico file i'm having trouble trying to get GUICtrlSetImage to apply the correct icon for the buttons - in my case, the 128 icon is never displayed and i don't know why #include <ButtonConstants.au3> Global $Form1 = GUICreate("Form1", 900, 300, -1, -1) Global $Button1 = GUICtrlCreateButton("", 0, 28, 128, 128, $BS_ICON) GUICtrlSetImage(-1, @ScriptDir & "\icon.ico", "ico128") Global $Button1 = GUICtrlCreateButton("", 125, 28, 128, 128, $BS_ICON) GUICtrlSetImage(-1, @ScriptDir & "\icon.ico", -1) Global $Button1 = GUICtrlCreateButton("", 250, 28, 128, 128, $BS_ICON) GUICtrlSetImage(-1, @ScriptDir & "\icon.ico", -2) Global $Button1 = GUICtrlCreateButton("", 375, 28, 128, 128, $BS_ICON) GUICtrlSetImage(-1, @ScriptDir & "\icon.ico") Global $Button1 = GUICtrlCreateButton("", 500, 28, 128, 128, $BS_ICON) GUICtrlSetImage(-1, @ScriptDir & "\icon.ico", -1, 0) Global $Button1 = GUICtrlCreateButton("", 625, 28, 128, 128, $BS_ICON) GUICtrlSetImage(-1, @ScriptDir & "\icon.ico", -1, 1) Global $Button1 = GUICtrlCreateButton("", 750, 28, 128, 128, $BS_ICON) GUICtrlSetImage(-1, @ScriptDir & "\icon.ico", -1, 2) Global $Button2 = GUICtrlCreateButton("", 0, 200, 64, 64, $BS_ICON) GUICtrlSetImage(-1, @ScriptDir & "\icon.ico", "ico64") Global $Button2 = GUICtrlCreateButton("", 100, 200, 64, 64, $BS_ICON) GUICtrlSetImage(-1, @ScriptDir & "\icon.ico", -1) Global $Button2 = GUICtrlCreateButton("", 200, 200, 64, 64, $BS_ICON) GUICtrlSetImage(-1, @ScriptDir & "\icon.ico", -2) Global $Button2 = GUICtrlCreateButton("", 300, 200, 64, 64, $BS_ICON) GUICtrlSetImage(-1, @ScriptDir & "\icon.ico") GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case -3 Exit EndSwitch WEnd icon.ico -
This UDF was originally written by ProgAndy, who gave up Windows, and thus AutoIt, in favor of Linux. Apparently he was well liked and respected for his capabilities, and will be missed. I have been playing with this UDF and modifying it a bit for my own use and i wanted to post the code (permission was granted from ProgAndy after i finally managed to reach him). The original code is still available at progandy.de and is also added here as an attachment. My modified version is attached. You will need the ProgAndy version for the dll code and examples. I think this is a really cool project that could be useful to many, so it would be nice if we could work on it and improve it. I'm not very knowledgeable regarding the depths of AutoIt capabilities, and am especially weak in anything having to do with DLL's. I will post a complete example with a GUI in the near future, but for now, here is my modified UDF... #include-once ; #INDEX# ======================================================================================================================= ; Title .........: Hunspell Hypenate MyThes ; Description ...: This module contains various functions to call Hunspell, Hyphenate and MyThes ; Author ........: Prog@ndy http://progandy.co.cc/downloads/view.download/12 ; Licence .......: The DLLs are open source, taken from the NHunspell project (http://nhunspell.sf.net) ; NHunspell is licenced under: GPL/LGPL/MPL. ; Free use in commercial applications is permittet according to the LGPL and MPL licenses. ; Your commercial application can link against the NHunspell DLLs. ; =============================================================================================================================== OnAutoItExitRegister("__Spell_Shutdown") ; =============================================================================================================================== ; GLOBAL VARIABLES ; =============================================================================================================================== Global $hHunspellDll = -1, $hHunspell = -1 ; =============================================================================================================================== ; #CURRENT# ===================================================================================================================== ;_Spell_HunspellAdd ;_Spell_HunspellAddWithAffix ;_Spell_HunspellAnalyze ;_Spell_HunspellFree ;_Spell_HunspellGenerate ;_Spell_HunspellInit ;_Spell_HunspellSpell ;_Spell_HunspellStem ;_Spell_HunspellSuggest ;_Spell_HyphenFree ;_Spell_HyphenHyphenate ;_Spell_HyphenInit ;_Spell_MyThesFree ;_Spell_MyThesInit ;_Spell_MyThesLookup ;_Spell_Startup ; =============================================================================================================================== ; #INTERNAL_USE_ONLY#============================================================================================================ ;__Spell_PtrStringReadW ;__Spell_HunspellReadStringArray ;__Spell_MyThesReadMarshalBuffer ;__Spell_MyThesReadMeaningBuffer ;__Spell_Shutdown ; =============================================================================================================================== ; #ORIGINAL_CALLCONV#============================================================================================================ ; definitions taken from sourcefile: /trunk/Hunspell/HunspellExportFunctions.cpp ; Link: http://nhunspell.svn.sourceforge.net/viewvc/nhunspell/trunk/Hunspell/ ; ; #define DLLEXPORT extern "C" _declspec( dllexport ) ==> CDECL ! ; ; DLLEXPORT NHunspell * HunspellInit(wchar_t * aff_file, wchar_t *dict_file, wchar_t * key) ; DLLEXPORT void HunspellFree(NHunspell * handle ) ; DLLEXPORT bool HunspellAdd(NHunspell * handle, wchar_t * word ) ; DLLEXPORT bool HunspellAddWithAffix(NHunspell * handle, wchar_t * word, wchar_t * affix ) ; DLLEXPORT bool HunspellSpell(NHunspell * handle, wchar_t * word ) ; DLLEXPORT void * HunspellSuggest(NHunspell * handle, wchar_t * word ) ; DLLEXPORT void * HunspellAnalyze(NHunspell * handle, wchar_t * word ) ; DLLEXPORT void * HunspellStem(NHunspell * handle, wchar_t * word ) ; DLLEXPORT void * HunspellGenerate(NHunspell * handle, wchar_t * word, wchar_t * word2 ) ; ; DLLEXPORT void * HyphenInit(wchar_t * dict_file) ; DLLEXPORT void HyphenFree(NHyphen * handle ) ; DLLEXPORT void * HyphenHyphenate(NHyphen * handle, wchar_t * word ) ; ; DLLEXPORT void * MyThesInit(wchar_t * idx_file, wchar_t * dat_file) ; DLLEXPORT void MyThesFree(NMyThes * handle ) ; DLLEXPORT void * MyThesLookup(NMyThes * handle, wchar_t * word ) ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name...........: _Spell_HunspellAdd ; Description ...: add word to the run-time dictionary ; Syntax.........: _Spell_HunspellAdd($hHunspell, $sWord) ; Parameters ....: $hHunspell - Hunspell handle returned from _Spell_HunspellInit ; $sWord - the word to add ; Return values .: Success - 1 ; Failure - 0 ; Author ........: Prog@ndy ; Modified.......: ; Remarks .......: ; Related .......: _Spell_HunspellAddWithAffix ; Link ..........; ; Example .......; ; =============================================================================================================================== Func _Spell_HunspellAdd($hHunspell, $sWord) Local $aResult = DllCall($hHunspellDll, "int:cdecl", "HunspellAdd", "ptr", $hHunspell, "wstr", $sWord) If @error Then Return SetError(1, 0, 0) Return $aResult[0] EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _Spell_HunspellAddWithAffix ; Description ...: add word to the run-time dictionary with affix flags of the example (a dictionary word) ; Syntax.........: _Spell_HunspellAddWithAffix($hHunspell, $sWord, $sAffix) ; Parameters ....: $hHunspell - Hunspell handle returned from _Spell_HunspellInit ; $sWord - the word to add ; $sAffix - Affix ; Return values .: Success - 1 ; Failure - 0 ; Author ........: Prog@ndy ; Modified.......: ; Remarks .......: Hunspell will recognize affixed forms of the new word, too. ; Related .......: _Spell_HunspellAdd ; Link ..........; ; Example .......; ; =============================================================================================================================== Func _Spell_HunspellAddWithAffix($hHunspell, $sWord, $sAffix) Local $aResult = DllCall($hHunspellDll, "int:cdecl", "HunspellAddWithAffix", "ptr", $hHunspell, "wstr", $sWord, "wstr", $sAffix) If @error Then Return SetError(1, 0, 0) Return $aResult[0] EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _Spell_HunspellAnalyze ; Description ...: morphological analysis of the word ; Syntax.........: _Spell_HunspellAnalyze($hHunspell, $sWord) ; Parameters ....: $hHunspell - Hunspell handle returned from _Spell_HunspellInit ; $sWord - the word to analyze ; Return values .: Success - array with analyzation result ; Failure - 0 ; Author ........: Prog@ndy ; Modified.......: ; Remarks .......: ; Related .......: _Spell_HunspellGenerate ; Link ..........; ; Example .......; ; =============================================================================================================================== Func _Spell_HunspellAnalyze($hHunspell, $sWord) Local $aResult = DllCall($hHunspellDll, "ptr:cdecl", "HunspellAnalyze", "ptr", $hHunspell, "wstr", $sWord) If @error Then Return SetError(1, 0, 0) If $aResult[0] = 0 Then Return SetError(2, 0, 0) Local $aTemp = __Spell_HunspellReadStringArray($aResult[0]) If @error Then Return SetError(3, 0, 0) Return $aTemp EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _Spell_HunspellFree ; Description ...: Frees memory associated with a Hunspell handle ; Syntax.........: _Spell_HunspellFree($hHunspell) ; Parameters ....: $hHunspell - Hunspell handle returned from _Spell_HunspellInit ; Return values .: Failure - Sets @error = 1 ; Author ........: Prog@ndy, iCode ; Modified.......: 13-Jun-2014 ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; Yes ; =============================================================================================================================== Func _Spell_HunspellFree($hHunspell) DllCall($hHunspellDll, "none:cdecl", "HunspellFree", "ptr", $hHunspell) If @error Then Return SetError(1) EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _Spell_HunspellGenerate ; Description ...: morphological generation by example(s) ; Syntax.........: _Spell_HunspellGenerate($hHunspell, $sWord, $sWord2) ; Parameters ....: $hHunspell - Hunspell handle returned from _Spell_HunspellInit ; $sWord - first word ; $sWord2 - second word ; Return values .: Success - array with result ; Failure - 0 ; Author ........: Prog@ndy ; Modified.......: ; Remarks .......: ; Related .......: _Spell_HunspellAnalyze ; Link ..........; ; Example .......; ; =============================================================================================================================== Func _Spell_HunspellGenerate($hHunspell, $sWord, $sWord2) Local $aResult = DllCall($hHunspellDll, "ptr:cdecl", "HunspellGenerate", "ptr", $hHunspell, "wstr", $sWord, "wstr", $sWord2) If @error Then Return SetError(1, 0, 0) If $aResult[0] = 0 Then Return SetError(2,0,0) Local $aTemp = __Spell_HunspellReadStringArray($aResult[0]) If @error Then Return SetError(3, 0, 0) Return $aTemp EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _Spell_HunspellInit ; Description ...: Initializes Hunspell ; Syntax.........: _Spell_HunspellInit($sAff_file, $sDict_file, $sKey=0) ; Parameters ....: $sAff_file - Hunspell .aff-file ; $sDict_file - Hunspell .dict-file ; $sKey - [optional] a Key String ; Return values .: Success - 1 ; Failure - 0 ; Author ........: Prog@ndy, iCode ; Modified.......: 13-Jun-2014 ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; Yes ; =============================================================================================================================== Func _Spell_HunspellInit($sAff_file, $sDict_file, $sKey=0) Local $tpKey='ptr' If IsString($sKey) Then $tpKey='wstr' Local $aResult = DllCall($hHunspellDll, 'ptr:cdecl', 'HunspellInit', 'wstr', $sAff_file, 'wstr', $sDict_file, $tpKey, $sKey) If @error Then Return SetError(1, 0, 0) Return $aResult[0] EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _Spell_HunspellSpell ; Description ...: Checks the spelling of the given word ; Syntax.........: _Spell_HunspellSpell($hHunspell, $sWord) ; Parameters ....: $hHunspell - Hunspell handle returned from _Spell_HunspellInit ; $sWord - the Word to check ; Return values .: Success - 1 ; Failure - 0 ; Author ........: Prog@ndy ; Modified.......: ; Remarks .......: ; Related .......: _Spell_HunspellSuggest ; Link ..........; ; Example .......; Yes ; =============================================================================================================================== Func _Spell_HunspellSpell($hHunspell, $sWord) Local $aResult = DllCall($hHunspellDll, "int:cdecl", "HunspellSpell", "ptr", $hHunspell, "wstr", $sWord) If @error Then Return SetError(1, 0, 0) Return $aResult[0] EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _Spell_HunspellStem ; Description ...: stemmer function ; Syntax.........: _Spell_HunspellStem($hHunspell, $sWord) ; Parameters ....: $hHunspell - Hunspell handle returned from _Spell_HunspellInit ; $sWord - the word to stem ; Return values .: Success - array with result ; Failure - 0 ; Author ........: Prog@ndy ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; ; =============================================================================================================================== Func _Spell_HunspellStem($hHunspell, $sWord) Local $aResult = DllCall($hHunspellDll, "ptr:cdecl", "HunspellStem", "ptr", $hHunspell, "wstr", $sWord) If @error Then Return SetError(1, 0, 0) If $aResult[0] = 0 Then Return SetError(2, 0, 0) Local $aTemp = __Spell_HunspellReadStringArray($aResult[0]) If @error Then Return SetError(3, 0, 0) Return $aTemp EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _Spell_HunspellSuggest ; Description ...: Suggests alternatives for a misspelled word ; Syntax.........: _Spell_HunspellSuggest($hHunspell, $sWord) ; Parameters ....: $hHunspell - Hunspell handle returned from _Spell_HunspellInit ; $sWord - The word you want alternatives for ; Return values .: Success - Array with suggestions (0 based) ; Failure - 0 ; Author ........: Prog@ndy ; Modified.......: ; Remarks .......: ; Related .......: _Spell_HunspellSpell ; Link ..........; ; Example .......; Yes ; =============================================================================================================================== Func _Spell_HunspellSuggest($hHunspell, $sWord) Local $aResult = DllCall($hHunspellDll, "ptr:cdecl", "HunspellSuggest", "ptr", $hHunspell, "wstr", $sWord) If @error Then Return SetError(1, 0, 0) If $aResult[0] = 0 Then Return SetError(2, 0, 0) Local $aTemp = __Spell_HunspellReadStringArray($aResult[0]) If @error Then Return SetError(3, 0, 0) Return $aTemp EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _Spell_HyphenFree ; Description ...: Frees memory associated with a Hyphen-handle ; Syntax.........: _Spell_HyphenFree($hHyphen) ; Parameters ....: $hHyphen - Hyphen-handle returned from _Spell_HyphenInit ; Return values .: Failure - Sets @error = 1 ; Author ........: Prog@ndy, iCode ; Modified.......: 13-Jun-2014 ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; Yes ; =============================================================================================================================== Func _Spell_HyphenFree($hHyphen) DllCall($hHunspellDll, "none:cdecl", "HyphenFree", "ptr", $hHyphen) If @error Then Return SetError(1) EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _Spell_HyphenHyphenate ; Description ...: Analyze a word for possible hyphenation ; Syntax.........: _Spell_HyphenHyphenate($hHyphen, $sWord) ; Parameters ....: $hHyphen - Hyphen-handle returned from _Spell_HyphenInit ; $sWord - Word to be analyzed ; Return values .: Success - Array with hyphenation result ; |$array[0] contains the siblings separated with = ; |$array[$i] is 0 if you can"t split the word after letter $i ; |$array[$i] is 1 if it is possible to split the word after letter $i ; Failure - 0 ; Author ........: Prog@ndy, iCode ; Modified.......: 13-Jun-2014 ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; Yes ; =============================================================================================================================== Func _Spell_HyphenHyphenate($hHyphen, $sWord) Local $aResult = DllCall($hHunspellDll, "ptr:cdecl", "HyphenHyphenate", "ptr", $hHyphen, "wstr", $sWord) If @error Then Return SetError(1, 0, 0) If $aResult[0] = 0 Then Return SetError(2, 0, 0) Local $stHyphen = DllStructCreate("ptr;ptr;",$aResult[0]) Local $sTemp = __Spell_PtrStringReadW(DllStructGetData($stHyphen,1)) Local $iMax = StringLen($sWord), $iIndex Local $aTemp[$iMax+1] = [$sTemp] $stHyphen = DllStructCreate("byte[" & $iMax & "]",DllStructGetData($stHyphen,2)) If @error Then Return SetError(3, 0, 0) For $iIndex = 1 To $iMax $aTemp[$iIndex] = Mod(DllStructGetData($stHyphen,1,$iIndex),2) Next Return $aTemp EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _Spell_HyphenInit ; Description ...: Initializes a Hyphen-handle ; Syntax.........: _Spell_HyphenInit($sDict_file) ; Parameters ....: $sDict_file - Dictionary for hyphenation ; Return values .: Success - 1 ; Failure - 0 ; Author ........: Prog@ndy, iCode ; Modified.......: 13-Jun-2014 ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; Yes ; =============================================================================================================================== Func _Spell_HyphenInit($sDict_file) Local $aResult = DllCall($hHunspellDll, "ptr:cdecl", "HyphenInit", "wstr", $sDict_file) If @error Then Return SetError(1, 0, 0) Return $aResult[0] EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _Spell_MyThesFree ; Description ...: Frees memory associated with a MyThes handle ; Syntax.........: _Spell_MyThesFree($hMyThes) ; Parameters ....: $hMyThes - MyThes-handle returned from _Spell_MyThesInit ; Return values .: Failure - Sets @error = 1 ; Author ........: Prog@ndy, iCode ; Modified.......: 13-Jun-2014 ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; Yes ; =============================================================================================================================== Func _Spell_MyThesFree($hMyThes) DllCall($hHunspellDll, "none:cdecl", "MyThesFree", "ptr", $hMyThes) If @error Then Return SetError(1) EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _Spell_MyThesInit ; Description ...: Initializes a Thesaurus ; Syntax.........: _Spell_MyThesInit($sIdx_file, $sDat_file) ; Parameters ....: $sIdx_file - MyThes .idx-file ; $sDat_file - MyThes .dat-file ; Return values .: Success - 1 ; Failure - 0 ; Author ........: Prog@ndy, iCode ; Modified.......: 13-Jun-2014 ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; Yes ; =============================================================================================================================== Func _Spell_MyThesInit($sIdx_file, $sDat_file) Local $aResult = DllCall($hHunspellDll, "ptr:cdecl", "MyThesInit", "wstr", $sIdx_file, "wstr", $sDat_file) If @error Then Return SetError(1, 0, 0) Return $aResult[0] EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _Spell_MyThesLookup ; Description ...: Looks up the meanings and synonyms of a word ; Syntax.........: _Spell_MyThesLookup($hMyThes, $sWord) ; Parameters ....: $hMyThes - MyThes-handle returned from _Spell_MyThesInit ; $sWord - The word o analyze ; Return values .: Success - Array of Arrays: ; |$array[$i] - the entries for one meaning of the word ; |--> $subarray[0] - the description of the meaning ; |--> $subarray[$j] - synonyms for this meaning ; Failure - 0 ; Author ........: Prog@ndy ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; Yes ; =============================================================================================================================== Func _Spell_MyThesLookup($hMyThes, $sWord) Local $aResult = DllCall($hHunspellDll, "ptr:cdecl", "MyThesLookup", "ptr", $hMyThes, "wstr", $sWord) If @error Then Return SetError(1, 0, 0) $aResult = __Spell_MyThesReadMarshalBuffer($aResult[0]) If @error Then Return SetError(2, 0, 0) Return $aResult EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _Spell_Startup ; Description ...: Loads the DLL containing Hunspell, Hyphen and Thesaurus (selects 32 or 64 bit automatically) ; Syntax.........: _Spell_Startup(directory path where dll can be found) ; Parameters ....: $sDLL - Hunspell.dll for 32 bit ; $sDLLx64 - Hunspell.dll for 64 bit ; Return values .: Success - 1 ; Failure - 0 and sets @error = 1 ; Author ........: Prog@ndy, iCode ; Modified.......: 13-Jun-2014 ; Remarks .......: No Unload function included, AutoIt does it automatically on termination ; Related .......: ; Link ..........; ; Example .......; Yes ; =============================================================================================================================== Func _Spell_Startup($sDir) If $hHunspellDll <> -1 Then Return 1 Local $sDLL = $sDir & "\Hunspell_x86.dll" If @AutoItX64 Then $sDLL = $sDir & "\Hunspell_x64.dll" $hHunspellDll = DllOpen($sDLL) If $hHunspellDll = -1 Then Return SetError(1, 0, 0) Return 1 EndFunc ; #INTERNAL_USE_ONLY#============================================================================================================ ; Name...........: __Spell_HunspellReadStringArray ; Description ...: Reads a zero-terminated array of pointers to wstrings (zero-terminated) ; Syntax.........: __Spell_HunspellReadStringArray($ptr) ; Parameters ....: $ptr - Pointer to array ; Return values .: Success - Array with read strings ; Failure - 0 ; Author ........: Prog@ndy, iCode ; Modified.......: 13-Jun-2014 ; Remarks .......: This function is used internally by _Spell_HunspellSuggest, _Spell_HunspellAnalyze, _Spell_HunspellStem, and _Spell_HunspellGenerate ; Related .......: ; Link ..........; ; Example .......; ; =============================================================================================================================== Func __Spell_HunspellReadStringArray($ptr) If $ptr = 0 Then Return SetError(1, 0, 0) Local $stPtr = DllStructCreate("ptr", $ptr) Local $asStrings[50], $iIndex = 0, $iMax = 49 While 1 $asStrings[$iIndex] = __Spell_PtrStringReadW(DllStructGetData($stPtr,1)) If @error = 1 Then ExitLoop $iIndex += 1 If $iIndex > $iMax Then $iMax += 50 ReDim $asStrings[$iMax+1] EndIf $stPtr = DllStructCreate("ptr", $ptr + DllStructGetSize($stPtr)*$iIndex) WEnd If $iIndex = 0 Then Return SetError(2, 0, 0) ReDim $asStrings[$iIndex] Return $asStrings EndFunc ; #INTERNAL_USE_ONLY#============================================================================================================ ; Name...........: __Spell_PtrStringReadW ; Description ...: Reads a zero-terminated wstrings from a pointer ; Syntax.........: __Spell_HunspellReadStringArray($ptr) ; Parameters ....: $ptr - Pointer to wstring ; Return values .: Success - read string ; Failure - empty string ("") ; Author ........: Prog@ndy ; Modified.......: ; Remarks .......: This function is used internally by __Spell_HunspellReadStringArray, and __Spell_MyThesReadMeaningBuffer ; Related .......: ; Link ..........; ; Example .......; ; =============================================================================================================================== Func __Spell_PtrStringReadW($ptr) If $ptr = 0 Then Return SetError(1, 0 ,"") Local $aLen = DllCall("kernel32.dll", "int", "lstrlenW", "ptr", $ptr) If @error Or $aLen[0]=0 Then Return SetError(2, 0, "") Local $struct = DllStructCreate("wchar[" & ($aLen[0] + 1) & "]", $ptr) Return DllStructGetData($struct, 1) EndFunc ;==>__Spell_PtrStringReadW ; #INTERNAL_USE_ONLY# ==================================================================================================================== ; Name ..........: __Spell_Shutdown ; Description ...: close hunspell DLL ; Syntax ........: __Spell_Shutdown() ; Parameters ....: ; Return values .: None ; Author ........: iCode ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func __Spell_Shutdown() If $hHunspellDll <> -1 Then DllClose($hHunspellDll) EndFunc ; #INTERNAL_USE_ONLY#============================================================================================================ ; Name...........: __Spell_MyThesReadMarshalBuffer ; Description ...: Reads the Marhal-Buffer for _Spell_MyThesLookup ; Syntax.........: __Spell_MyThesReadMarshalBuffer($pBuffer) ; Parameters ....: $pBuffer - Pointer to Marshal buffer ; Return values .: Success - Array of Arrays ; Failure - 0 ; Author ........: Prog@ndy ; Modified.......: ; Remarks .......: This function is used internally by _Spell_MyThesLookup ; Related .......: ; Link ..........; ; Example .......; ; =============================================================================================================================== Func __Spell_MyThesReadMarshalBuffer($pBuffer) Local $stPtr = DllStructCreate("int_ptr", $pBuffer) If @error Then Return SetError(1, 0, 0) Local $iCount = DllStructGetData($stPtr, 1) $stPtr = DllStructCreate("int_ptr;ptr[" & $iCount & "]", $pBuffer) Local $aMeanings[$iCount], $i For $i = 1 To $iCount $aMeanings[$i-1] = __Spell_MyThesReadMeaningBuffer(DllStructGetData($stPtr, 2, $i)) Next Return $aMeanings EndFunc ; #INTERNAL_USE_ONLY#============================================================================================================ ; Name...........: __Spell_MyThesReadMeaningBuffer ; Description ...: Helper to read the Marhal-Buffer for _Spell_MyThesLookup ; Syntax.........: __Spell_MyThesReadMeaningBuffer($pBuffer) ; Parameters ....: $pBuffer - Pointer to meaning-section in Marshal buffer ; Return values .: Success - Array of Strings ; Failure - 0 ; Author ........: Prog@ndy ; Modified.......: ; Remarks .......: This function is used internally by __Spell_MyThesReadMarshalBuffer ; Related .......: ; Link ..........; ; Example .......; ; =============================================================================================================================== Func __Spell_MyThesReadMeaningBuffer($pBuffer) Local $stPtr = DllStructCreate("int_ptr", $pBuffer) Local $iCount = DllStructGetData($stPtr,1) $stPtr = DllStructCreate("int_ptr;ptr;ptr[" & $iCount & "]", $pBuffer) Local $aSynonyms[$iCount+1], $i $aSynonyms[0] = __Spell_PtrStringReadW(DllStructGetData($stPtr, 2)) For $i = 1 To $iCount $aSynonyms[$i] = __Spell_PtrStringReadW(DllStructGetData($stPtr, 3, $i)) Next Return $aSynonyms EndFunc hunspell-0.9.2-ProgAndy.zip Hunspell_iCode_13_JUN_2014.zip
-
Help File/Documentation Issues. (Discussion Only)
iCode replied to guinness's topic in AutoIt Technical Discussion
bitten by the boolean for the last time from the help file... this lead not only myself, but i'm sure many others, to ass-u-me that the "0" in "$bOff = 0 " will always be interpreted as False when it's compared to a boolean, which is of course false - pun intended >this post was most helpful to me, particularly example #3 -
quite the comprehensive screen-cap utility for me, on win 7 with v1.0.5, the option to place the image on the clipboard does not work, which is interesting because i can't get it to work in a similar utility that i'm working on either i also happened to notice this - maybe you intended to use _ClipBoard_SetDataEx? ... UPDATE: i think you have to use _ClipBoard_SetDataEx - i just switched it out in my script and now it works _ClipBoard_Open(0) _ClipBoard_SetData($hBitmap, $CF_BITMAP) _ClipBoard_Close() for my screen region capture, i prefer a simple click and drag method to select the region rather than having to move/resize a box - if you are interested in this, let me know an i'll post a code sample if you want
-
@Yashied i posted this before, but in case you missed it - line 211 in 2.1b... If $HK_RID Then GUIRegisterMsg($HK_WM_INPUT, 'HK_WM_INPUT') If Not __HK_Raw() Then EndIf EndIf
-
As many are aware, the standard AutoIt Send() function can leave modifier keys (usually Shift, Alt, Ctrl) in a pressed-like state. While there are at least a few alternatives that can be found on this forum, as well as one in the Wiki (which i can't find at the moment), they have all failed me at some point, leaving a modifier key "stuck". So far i have had no issues with this function however. LAST UPDATED: 21-SEP-2014 #include-once ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SendEx ; Description ...: alternative to built-in Send() function which prevents modifier keys from being left in a pressed state ; Syntax ........: _SendEx($sSendKeys[, $iTimeout[, $sReleaseKeys[, $hUser32Dll]]]) ; Parameters ....: $sSendKeys - string of keys to send in Send() format ; $hUser32Dll - [optional] handle to user32.dll ; $iTimeout - [optional] maximum time in ms to attempt to release pressed keys (minimum = 250) ; $sReleaseKeys - [optional] comma seperated string of keys to release before issuing Send() (no spaces). ; defaults to: Shift, Ctrl, Alt, L Win, R Win ; Return values .: Success returns 1, else sets @error to 1 and returns an error message string ; Release date ..: 25-May-2014 ; Modify date ...: 21-Sep-2014 ; Author ........: iCode ; Modified by ...: ; Remarks .......: ; Related .......: Send() ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _SendEx($sSendKeys, $hUser32Dll = "", $iTimeout = 2000, $sReleaseKeys = "0x10,0x11,0x12,0x5B,0x5C") Local $bCloseDll, $sRet Local $iDelay = Opt("SendKeyDelay") + Opt("SendKeyDownDelay") If $iDelay < 50 Then $iDelay = 50 Local $aReleaseKeys = StringSplit($sReleaseKeys, ",") If @error Then Return SetError(1, 0, "Failed to create release key array") If $hUser32Dll <> "user32.dll" Then $hUser32Dll = DllOpen("user32.dll") If @error Then Return SetError(1, 0, "Failed to open handle to user32.dll") $bCloseDll = True EndIf $sRet = __ReleaseKeys($aReleaseKeys, $iTimeout, $hUser32Dll) If Not @error Then Send($sSendKeys) Sleep($iDelay) $sRet = __ReleaseKeys($aReleaseKeys, $iTimeout, $hUser32Dll) EndIf If $bCloseDll Then DllClose("user32.dll") If $sRet Then Return SetError(1, 0, $sRet) Return 1 EndFunc ; #INTERNAL_USE_ONLY# =========================================================================================================== ; Name ..........: __ReleaseKeys ; Description ...: release pressed keys ; Syntax ........: __ReleaseKeys(Byref $aReleaseKeys, $iTimeout, $hUser32Dll) ; Parameters ....: $aReleaseKeys - [in/out] An array of unknowns. ; $iTimeout - An integer value. ; $hUser32Dll - A handle value. ; Return values .: None ; Author ........: iCode ; Modified ......: 25-May-2014 ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func __ReleaseKeys(ByRef $aReleaseKeys, $iTimeout, $hUser32Dll) If $iTimeout < 50 Then $iTimeout = 250 Local $aRet, $hTimer = TimerInit() For $i = 0 To UBound($aReleaseKeys) - 1 $aRet = DllCall($hUser32Dll, "short", "GetAsyncKeyState", "int", $aReleaseKeys[$i]) If @error Then Return SetError(1, 0, "Dll call GetAsyncKeyState failed with key: " & $aReleaseKeys[$i]) If BitAND($aRet[0], 0x8000) <> 0 Then Do Sleep(100) DllCall($hUser32Dll, "int", "keybd_event", "int", $aReleaseKeys[$i], "int", 0, "long", 2, "long", 0) If @error Then Return SetError(1, 0, "Dll call keybd_event failed with key: " & $aReleaseKeys[$i]) $aRet = DllCall($hUser32Dll, "short", "GetAsyncKeyState", "int", $aReleaseKeys[$i]) If TimerDiff($hTimer) >= $iTimeout Then Return SetError(1, 0, "Time out limit reached") Until BitAND($aRet[0], 0x8000) = 0 EndIf Next EndFunc Change log... 29-JUN-2014 - changed the order of the parameters for _SendEx, moving $sReleaseKeys to the last position 21-SEP-2014 - in the interest of efficiency, i removed the StringStripWS() function - $sReleaseKeys can no longer have spaces in the string
-
works fine after i changed a couple things - you used '$WS_SYSMENU' twice and other styles you chose are breaking it - see the help file for gui control styles #include <GUIConstantsEx.au3> #include "F:\AutoIt\Resources\Funcs\_other\HotKey_Yashid\HotKey_2.1b.au3" #include "F:\AutoIt\Resources\Funcs\_other\HotKey_Yashid\HotKey_vkConstants.au3" Global $hWnd $hWnd = GUICreate("HotKeys", 800, 600) ;, -1, -1, BitOR($WS_CAPTION, $WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_SYSMENU, $DS_CONTEXTHELP, $WS_SYSMENU, $WS_VISIBLE, $WS_CLIPCHILDREN, $WS_THICKFRAME)) GUISetState(@SW_SHOW, $hWnd) _HotKey_Assign($VK_RETURN, "PressedEnter", $HK_FLAG_NOBLOCKHOTKEY, $hWnd) ConsoleWrite("error=" & @error & @LF) While GUIGetMsg() <> $GUI_EVENT_CLOSE Sleep(10) WEnd GUIDelete($hWnd) Exit Func PressedEnter() ConsoleWrite("Pressed enter") EndFunc ...
-
just spotted this... If $HK_RID Then GUIRegisterMsg($HK_WM_INPUT, 'HK_WM_INPUT') If Not __HK_Raw() Then EndIf EndIf
-
SendKeyDelay interaction with AHK script?
iCode replied to iCode's topic in AutoIt General Help and Support
a handle to the dll is open - i ommited that part i'll post the rest of the while loop code as soon as i make a sample... -
SendKeyDelay interaction with AHK script?
iCode replied to iCode's topic in AutoIt General Help and Support
hi BrewManNH i started to wonder exactly the same thing as i was thinking about this - here is the basic mechanics of it... While 1 Sleep(20) If $Enable = 0 Then ContinueLoop ElseIf _IsPressedEx("0x01") And Not _IsPressedEx("0x11") And Not _IsPressedEx("0x12") Then ; mouse 1 ; then do stuff ElseIf _IsPressedEx("0x04") And Not _IsPressedEx("0x10") And Not _IsPressedEx("0x11") And Not _IsPressedEx("0x12") Then ; mouse 3 ; then do stuff EndIf WEnd Func _IsPressedEx($sVKey) Local $aRet = DllCall($hUser32Dll, "short", "GetAsyncKeyState", "int", $sVKey) If @error Then Return SetError(@error, @extended, False) Return BitAND($aRet[0], 0x8000) <> 0 EndFunc there's allot of code removed where i stuck "then do stuff", but basically i want to know when the left or middle mouse button is pressed $Enable is usually 1, so i'm running through the full loop the vast majority of the time, which means every time the left mouse button is clicked, i'm checking that other keys are not (Ctrl, Alt) and then then running the rest of the code, which i can post if need be - i just have to format it so it's understandable -
SendKeyDelay interaction with AHK script?
iCode replied to iCode's topic in AutoIt General Help and Support
What would i post? I'm not using Opt("SendKeyDelay", n) in my script - i just wanted to know if anybody is aware of the default AutoIt SendKeyDelay (5ms) affecting the Send() function in AHK where there is a delay between sent keystrokes. If you're thinking of something specific, let me know, otherwise i doubt anyone would be interested in sifting through 5000+ lines of code. -
A person using my script is running some AHK scripts that apparently use AHK's Send function to send a string of keys to an edit control (non-AHK i believe) My script does not set the SendKey[Down]Delay times, so they should default to 5 ms He is setting SendKeyDelay = 0 in his scripts He has reported that his AHK scripts send keystrokes slower while my AutoIt script is running Could there be some interaction there?
-
you should post your code - it's a bit hard to debug something we can't see
-
_Clipboard_GetAll / _Clipboard_PutAll / _Clipboard_Wait
iCode replied to wraithdu's topic in AutoIt Example Scripts
update - 30-Jun-2014: my version of this function is buggy and i have not investigated the problem yet 6 years later iCode says... I have an interest in seeing this included as an official UDF, though judging by the lack of replies here, i'm not so sure how popular it is. As wraithdu says though, AHK has it I hacked it a bit so the script writer need not call _Clipboard_MemFree, which is now handled internally, and changed a few other things. Also added an alternative to _Clipboard_Wait when _ClipBoard_PutAll is called (code is commented out). One thing i am not sure of is why _ClipBoard_GetDataEx returns '0' for some formats. The formats in one test were 49577 and 49756, which are in clipboard memory (if that's the right term) after copying an image in Firefox. The dll call for _ClipBoard_GetDataEx is: DllCall("user32.dll", "handle", "GetClipboardData", "uint", $iFormat) According to MSDN, i'm not seeing anything wrong with the dll call, so i don't why _ClipBoard_GetDataEx fails - is this normal for image/binary data perhaps ??? EDIT: functions updated 29-Apr-2014 #include-once #include <Clipboard.au3> OnAutoItExitRegister("__AutoItExit_ClipAll") Global $__bMemFree = False ; #FUNCTION# ==================================================================================================================== ; Name ..........: _ClipBoard_GetAll ; Description ...: Backup clipboard content ; Syntax ........: _ClipBoard_GetAll(Byref $avClip) ; Parameters ....: $avClip - [in/out] An array of variants. ; Return values .: Returns 1 if no error, else 0 and sets @error: ; 1 = failed to open clipboard ; 2 = _ClipBoard_GetDataEx failed ; 3 = _MemGlobalAlloc failed ; 4 = DllCall failed ; 5 = _ClipBoard_Close failed ; @extended = total number of errors ; Author ........: wraithdu (modified by iCode) ; Modified ......: 29-Apr-2014 ; Remarks .......: ; Related .......: ; Link ..........: http://www.autoitscript.com/forum/topic/81267-clipboard-getall-clipboard-putall-clipboard-wait/ ; Example .......: No ; =============================================================================================================================== Func _ClipBoard_GetAll(ByRef $avClip) Local $i = 0, $iFormat = 0, $hMem, $hMemNew, $pSource, $pDest, $iSize, $iErr = 0, $iErrEx = 0 If $__bMemFree = True Then __MemFree($avClip) Else Dim $avClip[1][2] EndIf If Not _ClipBoard_Open(0) Then Return SetError(1, 1, 0) Do $iFormat = _ClipBoard_EnumFormats($iFormat) If $iFormat = 0 Then ExitLoop $hMem = _ClipBoard_GetDataEx($iFormat) ; this can/will fail for some formats - don't know why yet, so let's continue without retutning an error If $hMem = 0 Then ContinueLoop ; copy the memory $pSource = _MemGlobalLock($hMem) If $pSource = 0 Then $iErr = 3 $iErrEx += 1 ExitLoop EndIf $iSize = _MemGlobalSize($hMem) $hMemNew = _MemGlobalAlloc($iSize, $GHND) If $hMemNew = 0 Then _MemGlobalUnlock($hMemNew) $iErr = 4 $iErrEx += 1 ExitLoop EndIf $pDest = _MemGlobalLock($hMemNew) If $pDest = 0 Then _MemGlobalFree($hMemNew) $iErr = 5 $iErrEx += 1 ExitLoop EndIf DllCall("msvcrt.dll", "int:cdecl", "memcpy_s", "ptr", $pDest, "ulong_ptr", $iSize, "ptr", $pSource, "ulong_ptr", $iSize) If @error Then $iErr = 6 $iErrEx += 1 EndIf _MemGlobalUnlock($hMem) _MemGlobalUnlock($hMemNew) $__bMemFree = True If $iErr = 6 Then __MemFree($avClip) ExitLoop EndIf ; add handle and format to array $i += 1 ReDim $avClip[$i + 1][2] $avClip[0][0] = $i $avClip[$i][0] = $hMemNew $avClip[$i][1] = $iFormat Until $iFormat = 0 If Not _ClipBoard_Close() Then $iErr = 5 If $iErr Then Return SetError($iErr, $iErrEx, 0) Return 1 EndFunc ; #FUNCTION# ==================================================================================================================== ; Name ..........: _ClipBoard_PutAll ; Description ...: Restore clipboard content ; Syntax ........: _ClipBoard_PutAll(Byref $avClip) ; Parameters ....: $avClip - [in/out] An array of variants. ; Return values .: Returns 1 if no error, else 0 and sets @error: ; 1 = invalid array ; 2 = _ClipBoard_Open failed ; 3 = _ClipBoard_Empty failed ; 4 = _ClipBoard_Close failed ; 5 = _ClipBoard_Open failed ; 6 = _ClipBoard_SetDataEx failed ; 7 = _ClipBoard_Close failed ; @extended = total number of errors ; Author ........: wraithdu (modified by iCode) ; Modified ......: iCode 29-Apr-2014 ; Remarks .......: ; Related .......: ; Link ..........: http://www.autoitscript.com/forum/topic/81267-clipboard-getall-clipboard-putall-clipboard-wait/ ; Example .......: No ; =============================================================================================================================== Func _ClipBoard_PutAll(ByRef $avClip) ; DO NOT free the memory handles after a call to this function - the system now owns the memory Local $iErr = 0, $iErrEx = 0 ; , $bOpen, $iTime $__bMemFree = False If Not IsArray($avClip) Or UBound($avClip, 0) <> 2 Or $avClip[0][0] < 1 Then Dim $avClip[1][2] Return SetError(1, 1, 0) EndIf ; test if clipboard can be opened ; if _ClipBoard_Open failes, the clipboard is likely still being updated, so we keep trying until it succeeds ;Local $hTimer = TimerInit() ;Do ; $bOpen = _ClipBoard_Open(0) ; Sleep(50) ; $iTime = TimerDiff($hTimer) ;Until $bOpen = 1 Or $iTime >= 2000 ;If $bOpen = 0 Then ; Return SetError(2, 1, 0) ;EndIf ; empty clipboard If Not _ClipBoard_Open(0) Then Return SetError(2, 1, 0) ; comment out if using the code above If Not _ClipBoard_Empty() Then _ClipBoard_Close() Return SetError(3, 1, 0) EndIf If Not _ClipBoard_Close() Then Return SetError(4, 1, 0) ; re-open clipboard and put data If Not _ClipBoard_Open(0) Then Return SetError(5, 1, 0) For $i = 1 To $avClip[0][0] If Not _ClipBoard_SetDataEx($avClip[$i][0], $avClip[$i][1]) Then $iErr = 6 $iErrEx += 1 EndIf Next If Not _ClipBoard_Close() Then $iErr = 7 $iErrEx += 1 EndIf If $iErr Then Return SetError($iErr, $iErrEx, 0) Return 1 EndFunc ; #INTERNAL_USE_ONLY# =========================================================================================================== ; Name ..........: __MemFree ; Description ...: Free clipboard memory ; Syntax ........: __MemFree(Byref $avClip) ; Parameters ....: $avClip - [in/out] An array of variants. ; Return values .: Returns 1 if no error, else 0 and sets @error: ; 1 = array is invalid ; 2 = _MemGlobalFree failed ; @extended = total number of errors ; Author ........: wraithdu (modified by iCode) ; Modified ......: 29-Apr-2014 ; Remarks .......: ; Related .......: ; Link ..........: http://www.autoitscript.com/forum/topic/81267-clipboard-getall-clipboard-putall-clipboard-wait/ ; Example .......: No ; =============================================================================================================================== Func __MemFree(ByRef $avClip) Local $iErr = 0, $iErrEx = 0 If $__bMemFree = False Then Return ElseIf Not IsArray($avClip) Or UBound($avClip, 0) <> 2 Or $avClip[0][0] < 1 Then Dim $avClip[1][2] $__bMemFree = False Return SetError(1, 1, 0) EndIf For $i = 1 To $avClip[0][0] If Not _MemGlobalFree($avClip[$i][1]) Then $iErr = 2 $iErrEx += 1 EndIf Next $__bMemFree = False Dim $avClip[1][2] If $iErr Then Return SetError($iErr, $iErrEx, 0) Return 1 EndFunc ; #INTERNAL_USE_ONLY# =========================================================================================================== ; Name ..........: __AutoItExit_ClipAll ; Description ...: Free clipboard memory on AutoIt exit ; Syntax ........: __AutoItExit_ClipAll() ; Parameters ....: ; Return values .: None ; Author ........: iCode ; Modified ......: 29-Apr-2014 ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func __AutoItExit_ClipAll() #forcedef $avClip __MemFree($avClip) EndFunc