Leaderboard
Popular Content
Showing content with the highest reputation on 12/01/2023 in all areas
-
Changed the logic to a similar logic for the Var&Func AutoComplete, which should fix this. new zip available.2 points
-
I have uploaded an new beta for Autoit3Wrapper.au3 which has the rewrite of mailslot to IPC and also include a extra test for this.1 point
-
As @TheDcoder said, I completely forgot about those functions! I'll implement this and see what comes of it. Thanks! I wonder this too. Python is similar and needs UTF-8 encoding (at least for IRC stuff send thru sockets). I think (but could be wrong) that its because some things need to be ANSI to work properly.1 point
-
RegisterActiveObject
argumentum reacted to jugador for a topic
Not able to understand AutoHotkey class Object concept but assumption is it's IDispatch Object and can be created using @trancexx __ObjectFromTag . I will open new thread about AutoHotkey class Object concept for help. So not able convert the AutoHotkey LresultFromObject code due to this class Object logic. But succeed using LresultFromObject and ObjectFromLresult on Scripting.Dictionary Object1 point -
The BUG is mine it's an inability to be able to update the array Edit: I reworded it1 point
-
I totally forgot about those functions, very handy indeed! But why doesn't TCPSend automatically handle that though? Is it just hardcoded to convert everything to ANSI?1 point
-
As per help file of TCPSend : Remarks If Unicode strings need to be transmitted they must be encoded/decoded with StringToBinary()/BinaryToString().1 point
-
Me vs. ChatGPT
TheSaint reacted to jaberwacky for a topic
At my work I use a program which requires all caps. My work is high paced and so switching back and forth all day between all caps is a pain. So I wrote a script that toggles caps lock on and off accordingly. What follows is my version (which may not work at that point) and then followed by ChatGPTs version. I have since modified ChatGPTs version to suit my particular quirky coding style. The biggest changes that ChatGPT made are to the MousePosition, WindowUnderMouse (originally written by Ascendant), and IsCDKActive functions. Sorry. Something funky is going on. I must not have access to the very original code I fed to ChatGPT ... Puny human version (but still pretty good if I do say so myself.): #include <APISysConstants.au3> #include <WinAPISysWin.au3> #include <WinAPI.au3> #include <Misc.au3> #include <GUIConstants.au3> Opt("SendCapslockMode", 0) Opt("WinTitleMatchMode", 2) Global Const $mouse_proc_callback = DllCallbackRegister(CapslockSentinel, "long", "int;wparam;lparam") Global Const $hook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL, DllCallbackGetPtr($mouse_proc_callback), _WinAPI_GetModuleHandle(0)) OnAutoItExitRegister(OnAutoItExit) While True Sleep(1000) WEnd Func CapslockSentinel($code, $w_param, $l_param) Switch $code >= 0 Case True Switch $w_param Case $wm_mousemove Local Static $hWinPrev = ' ' Local Static $cdk_active = False Local Const $hWin = WindowUnderMouse($l_param) If $hWin <> $hWinPrev Then $hWinPrev = $hWin Local Const $title = WinGetTitle($hWin) Select Case IsCDKActive($title) And Not $cdk_active ConsoleWrite("CDK: Active -- Capslock: On" & @CRLF) If Not IsCapsLockOn() Then ToggleCapslock("On") EndIf $cdk_active = True Case Not IsCDKActive($title) And $cdk_active ConsoleWrite("CDK: Inactive -- Capslock: Off" & @CRLF) If IsCapsLockOn() Then ToggleCapslock("Off") EndIf $cdk_active = False EndSelect EndIf EndSwitch EndSwitch Return _WinAPI_CallNextHookEx($hook, $code, $w_param, $l_param) EndFunc Func MousePos(Const ByRef $l_Param) Local Const $MSLLHOOKSTRUCT = $tagPOINT & ";dword mouseData;dword flags;dword time;ulong_ptr dwExtraInfo" Local Const $info = DllStructCreate($MSLLHOOKSTRUCT, $l_Param) Local Const $mousePos[2] = [DllStructGetData($info, 1), DllStructGetData($info, 2)] Return $mousePos EndFunc Func WindowUnderMouse(Const ByRef $l_param) ; Ascendant Local Const $stPoint = DllStructCreate("long; long") Local Const $mousePos = MousePos($l_param) DllStructSetData($stPoint, 1, $mousePos[0]) DllStructSetData($stPoint, 2, $mousePos[1]) Local Const $stInt64 = DllStructCreate("int64", DllStructGetPtr($stPoint)) Local Const $aRet = DllCall("user32.dll", "hwnd", "WindowFromPoint", "int64", DllStructGetData($stInt64, 1))[0] ; Because _WindowFromPoint() can return 'sub' windows, or control handles, we should seek the owner window Return $aRet ? _WinAPI_GetAncestor($aRet, 2) : SetError(1, @error, 0) EndFunc Func IsCDKActive(Const ByRef $title) If StringInStr($title, "CDK Drive") Or _ StringInStr($title, "Tab Name") Or _ StringInStr($title, "Tab Color") Or _ StringInStr($title, "Create Order") Or _ StringInStr($title, "Cashiering") Or _ StringInStr($title, "Enter Change Reason") Then Return True EndIf Return False EndFunc Func IsCapsLockOn() Return BitAND(_WinAPI_GetKeyState(0x14), 0x01) = 1 EndFunc Func ToggleCapslock(Const ByRef $state) Send("{CAPSLOCK " & $state & '}') EndFunc Func OnAutoItExit() _WinAPI_UnhookWindowsHookEx($hook) DllCallbackFree($mouse_proc_callback) EndFunc ChatGPT: #include <APISysConstants.au3> #include <WinAPISysWin.au3> #include <WinAPI.au3> #include <Misc.au3> #include <GUIConstants.au3> Opt("SendCapslockMode", 0) Opt("WinTitleMatchMode", 2) Global Const $MOUSE_PROC_CALLBACK = DllCallbackRegister("CapslockSentinel", "long", "int;wparam;lparam") Global Const $HOOK = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL, DllCallbackGetPtr($MOUSE_PROC_CALLBACK), _WinAPI_GetModuleHandle(0)) OnAutoItExitRegister("OnAutoItExit") While True Sleep(1000) WEnd Func CapslockSentinel($nCode, $wParam, $lParam) Switch $nCode >= 0 Case True Switch $wParam Case $WM_MOUSEMOVE Local Static $hPrevWin = ' ' Local Static $bCDKActive = False Local Const $hWin = GetWindowUnderMouse($lParam) If $hWin <> $hPrevWin Then $hPrevWin = $hWin Local Const $sTitle = WinGetTitle($hWin) If IsCDKActive($sTitle) And Not $bCDKActive Then ConsoleWrite("CDK: Active -- Capslock: On" & @CRLF) If Not IsCapsLockOn() Then ToggleCapsLock("On") $bCDKActive = True ElseIf Not IsCDKActive($sTitle) And $bCDKActive Then ConsoleWrite("CDK: Inactive -- Capslock: Off" & @CRLF) If IsCapsLockOn() Then ToggleCapsLock("Off") $bCDKActive = False EndIf EndIf EndSwitch EndSwitch Return _WinAPI_CallNextHookEx($HOOK, $nCode, $wParam, $lParam) EndFunc Func GetMousePos(Const ByRef $lParam) Local Const $MSLLHOOKSTRUCT = $tagPOINT & ";dword mouseData;dword flags;dword time;ulong_ptr dwExtraInfo" Local Const $info = DllStructCreate($MSLLHOOKSTRUCT, $lParam) Return DllStructCreate("int[2]", DllStructGetPtr($info)) EndFunc Func GetWindowUnderMouse(Const ByRef $lParam) Local Const $stPoint = GetMousePos($lParam) Local Const $stInt64 = DllStructCreate("int64", DllStructGetPtr($stPoint)) Local Const $hWnd = DllCall("user32.dll", "hwnd", "WindowFromPoint", "int64", DllStructGetData($stInt64, 1))[0] Return $hWnd ? _WinAPI_GetAncestor($hWnd, 2) : SetError(1, @error, 0) EndFunc Func IsCDKActive(Const ByRef $sTitle) Local Const $aKeywords = ["CDK Drive", "Tab Name", "Tab Color", "Create Order", "Cashiering", "Enter Change Reason"] For $i = 0 To UBound($aKeywords) - 1 If StringInStr($sTitle, $aKeywords[$i]) Then Return True Next Return False EndFunc Func IsCapsLockOn() Return BitAND(_WinAPI_GetKeyState(0x14), 0x01) = 1 EndFunc Func ToggleCapsLock(Const ByRef $sState) Send("{CAPSLOCK " & $sState & '}') EndFunc Func OnAutoItExit() _WinAPI_UnhookWindowsHookEx($HOOK) DllCallbackFree($MOUSE_PROC_CALLBACK) EndFunc1 point -
Thanks to @GMK we have universall, mulitlingual, free spell checker: I was wondering if here on the forum is any Au3Script Parser to get all Strings content from au3 file. In combination with @GMK function this should be very handy to check each script in case any spelling mistakes. Regards, mLipok1 point