-
Posts
3,688 -
Joined
-
Last visited
-
Days Won
14
jaberwacky last won the day on March 6
jaberwacky had the most liked content!
About jaberwacky
- Birthday 09/12/1980
Profile Information
-
Member Title
jaberwacky
Recent Profile Visitors
4,160 profile views
jaberwacky's Achievements
-
donnyh13 reacted to a post in a topic: function tooltip
-
taurus905 reacted to a post in a topic: Create an AI AutoIt Engineer to debug
-
jaberwacky reacted to a post in a topic: Beep Player
-
argumentum reacted to a post in a topic: Create an AI AutoIt Engineer to debug
-
jaberwacky reacted to a post in a topic: The strange font Color of SciTE4
-
Create an AI AutoIt Engineer to debug
jaberwacky replied to DavidBoughan's topic in AutoIt General Help and Support
I have given code to ChatGPT and asked it to look for issues. You pretty much have do one thing at a time, ask it if it can be improved, etc. I no longer have any examples but I've had ChatGPT do modifications I wouldn't have thought of by myself. Also I have it write code for me that I can't be bothered with because it gets in the way of my birds eye view of the program. -
jaberwacky reacted to a post in a topic: Replace a line in an edit box
-
Yeah, the calltip stuff I made has really been hit hard by bit rot. I need to get around to updating all of that.
-
jaberwacky reacted to a post in a topic: Very Simple Inter-Process Communication (using AutoItObject_Internal)
-
I have noticed that when I run these multithreading -- I'll call them emulations in an attempt to not rile feathers and which seem to work well for everyone else they however always result in a "AutoIt3.exe ended.rc:-1073741819" for me. I hope that sentence wasn't too oddly structured for non native speakers. I feel that it might be.
-
jaberwacky reacted to a post in a topic: LAteNightSpecial banned indefinitely
-
jaberwacky reacted to a post in a topic: True AutoIt multi-threading! Split off
-
jaberwacky reacted to a post in a topic: True AutoIt multi-threading!
-
True AutoIt multi-threading! Split off
jaberwacky replied to LAteNightSpecial's topic in AutoIt General Help and Support
Wheeeewwww, I've been thinking about multiple threads trying to modify the same data structure. I think I'm going to leave that alone for now. Thank you two for responding to my post. I'll definitely revisit this if I need to. -
This is great! I love it! I hope that I'm not asking a newb question ... is there a way to exit a thread? For instance: 1st thread: I start a thread with a GUI. Then I spawn a 2nd thread from here ... 2nd thread: This thread has a TCPRecv in a loop which is always listening to a networked device. The messages received from this device then go into a shared global queue. The GUI then updates itself based on the messages found in the queue. 3rd thread: Then I want to start a thread from the 2nd thread that will process the messages received from the network (shortens them and converts them from binary). I want to be able to exit that third thread. Or does it happen that way and I'm just looking at this all wrong? The following code does not demonstrate my intentions. Just sharing it for completeness. (Also, it doesn't actually implement a real queue data structure at the moment.) #AutoIt3Wrapper_Version=B #Autoit3Wrapper_Testing=y #autoit3Wrapper_jump_to_first_error=y #AutoIt3Wrapper_Run_AU3Check=n #AutoIt3Wrapper_AU3Check_Parameters=-w 1 -w 2 -w 4 -w 5 -w 6 -w 7 -d #NoTrayIcon #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include "N.au3" OnAutoItExitRegister(OnAutoItExit) Global $queue = NGlobal() NMain("Main") Func Main() GUICreate("EISCP", 520, 350) Local Const $edit = GUICtrlCreateEdit('', 10, 10, 500, 330, $ES_AUTOVSCROLL + $WS_VSCROLL) GUISetState(@SW_SHOWNORMAL) NRun("Recv") Do Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch GUICtrlSetData($edit, $queue.Command, 1) Sleep(100) Until False EndFunc Func Recv() TCPStartup() Local Const $sIPAddress = "192.168.0.209" Local Const $iPort = 60128 Local Const $ConnectedSocket = TCPConnect($sIPAddress, $iPort) Local $command Do $command = TCPRecv($ConnectedSocket, 2048) If $command Then $queue.Command = ExtractCommand($command) EndIf Sleep(50) Until False EndFunc Func ExtractCommand($command) $command = BinaryMid($command, 5) ; lop off "ISCP" $command = BinaryMid($command, 15) $command = BinaryMid($command, 1, BinaryLen($command) - 3) Return String(BinaryToString($command)) EndFunc Func OnAutoItExit() TCPShutdown() EndFunc
-
jaberwacky reacted to a post in a topic: True AutoIt multi-threading!
-
Hello! I have used the helpfile, the posts of excellent coders on this forum, and ChatGPT to cobble together (copy and pasted essentially) a script that will enable remote control of an Onkyo or Integra audio video receiver over the network! I'm just so excited that I had to post what I have put together so far! Please tell me if this could be useful to you. Also, please do tell me if I'm going about this all wrong! I'll take any and all comments, suggestions, etc. ; By myself, I am not a good programmer. It's with the help of people such as ; SoulA that I can even dress myself in the morning! ; Credit to ChatGPT too! ; https://www.autoitscript.com/forum/topic/84095-receiving-data-from-a-connected-tcp-device/ ; PsaltyDS is the penguin! ; Please send much love!: https://www.autoitscript.com/forum/profile/9334-psaltyds/ ; https://www.autoitscript.com/forum/topic/117300-help-please-with-tcpip-script-to-control-onkyo-receiver/ #include-once #include <AutoItConstants.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIError.au3> Global Const $sIPAddress = "192.168.0.209" Global Const $iPort = 60128 TCPStartup() tcp_receive() TCPShutdown() Func tcp_receive() Do $socket = TCPConnect($sIPAddress, $iPort) Until $socket <> -1 sleep(100) _TCPSend($socket, "PWRQSTN") $Recv = _TCPRecv($Socket) $Recv = Model_ExtractCommand($Recv) ConsoleWrite($Recv & @CRLF) EndFunc Func _TCPSend($socket, $cmd) Local Const $ConnectedSocket = TCPConnect($sIPAddress, $iPort) Local Const $binISCP_Header = StringToBinary("ISCP") Local Const $binISCP_HeaderSize = Binary("0x00000010") ; Header size = 16 Local Const $binISCP_DataSize = Binary("0x00000007") ; Data size (command length) = 7 chars Local Const $binISCP_Version = Binary("0x01000000") ; Version 1.0.0.0 Local Const $binISCP_Data = StringToBinary("!1" & $cmd) ; Command = !1PWR01 Local Const $binISCP_End = Binary("0x0D") ; @CR Local Const $binISCP_Message = $binISCP_Header & _ $binISCP_HeaderSize & _ $binISCP_DataSize & _ $binISCP_Version & _ $binISCP_Data & _ $binISCP_End ; Send message over connected socket TCPSend($ConnectedSocket, $binISCP_Message) EndFunc Func _TCPRecv($socket) Local $timeout = TimerInit() Local $Recv Do $Recv = TCPRecv($socket, 2048) If TimerDiff($timeout) > 1000 Then ConsoleWrite("Timeout" & @CRLF) Exit EndIf Until $Recv <> "" Return $Recv EndFunc ; ChatGPT! Func Model_ExtractCommand($data) $data = BinaryMid($data, 3) ; chop off the 0x ; Extract the data portion from the binary string Local $dataBinary = BinaryMid($data, 17, 5) ; Convert the binary data to a string Return BinaryToString($dataBinary) EndFunc
-
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) EndFunc
-
MouseHoverCallTips [11/24/2023]
jaberwacky replied to jaberwacky's topic in AutoIt Technical Discussion
Yes! Now! Finally I have gotten around to simplifying the code and making it more robust ... hope it stays working for a good long time ... -
MouseHoverCallTips [11/24/2023]
jaberwacky replied to jaberwacky's topic in AutoIt Technical Discussion
Turns out there were several small bugs that I missed ... now it should actually work again ... NO NEVERMIND! It stopped working again for some reason ... stay tuned ... -
MouseHoverCallTips [11/24/2023]
jaberwacky replied to jaberwacky's topic in AutoIt Technical Discussion
Latest version ... feels like a couple of months ago when I started this script... -
See if this is what you were wanting ...
-
GuiBuilderPlus [updated March 24, 2024]
jaberwacky replied to kurtykurtyboy's topic in AutoIt Example Scripts
This is beautiful! Thank you.