Leaderboard
Popular Content
Showing content with the highest reputation on 02/15/2024 in all areas
-
DarkMode UDF for AutoIt's Win32GUIs
UEZ and one other reacted to NoNameCode for a topic
Hello everyone, today I would like to show you how far I have come with the implementation of DarkMode for AutoIT GUIs. Source: https://github.com/ysc3839/win32-darkmode About Win32 Darkmode: Since about 2020 there is a "hidden" / "undocumented" API for Win32 DarkMode. There is also already a program that has implemented this quite well. (Notepad++) Difficulties Unfortunately, the Windows devs are either too lazy or have been stupid with the implementation. So we have to apply all kinds of fixes (as we are already used to) to get the GUIs to actually run completely. Also there are some difficulties as all existing code that could be used is written in c++. I understand that, but only rudimentarily. So if there is someone here who can / would like to help me translate / implement some existing solutions. There are for example: The 'FixDarkScrollBar()' function which I would like to implement, but where I just can't get any further. Also with ChatGPT the code is difficult to 'override' and it doesn't work at all. GPT tells me that the implementation in AutoIT is quite impossible. And the full IatHook.h (https://github.com/ysc3839/win32-darkmode/blob/master/win32-darkmode/IatHook.h) Edit: Sloved witth v0.0.3 Todos / Challenges: * Redrawing of the Menu to Black * Getting the other controls into the right Theme for DarkMode * Setting Text Theme Colder of e.g. Checkboxes, ListViewHeader or Group Text * Getting Darkmode for Date Let me know what you think and where you might have suggestions for improvement or ideas. (Especially if you can help translate c++ into autoit :3) Kind Regards NoNameCode GUIDarkMode_V0.03 - OpenNcThemeData Hook.zip Changelog V.03 * Added HookOpenNcThemeData.dll => Coded by NoNameCode in C++ if someone want the Source pls DM * Added HookOpenNcThemeData_Debug.dll => Same as HookOpenNcThemeData.dll but Creates a OpenNcThemeData.txt with the opened Classes and if the Class got Replaced by Hook * Changed Darkmode_GUISample.au3 > More Data for GUICtrlCreateList and GUICtrlCreateEdit + #include <String.au3> > Added Routine to get AutoIt Install Path by Reg; or if not by @AutoItExe for PIC (logo4.gif) or AVI (SampleAVI.avi) * Changed GUIDarkMode.au3 > Added DllOpen for HookOpenNcThemeData.dll and Added OnAutoItExitRegister for DllClose function > Changed _GUICtrlSetDarkTheme -> Cleand Up Switch by CTRL Class bec. moste of them are not needed anymore through ScrollbarFix via HookOpenNcThemeData.dll Old Stuff:2 points -
Create a MsgBox with buttons disabled for specific amount of time
simplercoder000 and one other reacted to SmOke_N for a topic
My goodness, ya'll are murderfying my script lol.2 points -
Create a MsgBox with buttons disabled for specific amount of time
Musashi and one other reacted to argumentum for a topic
ok, thanks to @Nine, now you have a UDF file. And call it kind of like MsgBox() Your script: #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <MsgBox_Extn.au3> ; the magic ; https://www.autoitscript.com/forum/index.php?showtopic=211499&view=findpost&p=1530323 $MsgText = 'Continue using this software at your own risk !' & @CRLF $MsgText &= 'By clicking on OK button you are agree in the software agreement !' #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 339, 131, -1, -1) $Label1 = GUICtrlCreateLabel("Welcome to the empty frame software :)", 72, 32, 191, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ;~ $returned = MsgBox(BitOR($MB_TOPMOST, $MB_ICONINFORMATION, $MB_OKCANCEL), 'Info', $MsgText) ; This is replcaced by either ; set any of the 3 possible buttons, from left to right, with an alternate text. ;~ _MsgBox_Extn_SetButtonText(Default, "Run away") ; Each setting applies to a next call only. ; pass 1 value, as the delay countdown: $returned = _MsgBox_Extn(5, BitOR($MB_TOPMOST, $MB_ICONINFORMATION, $MB_OKCANCEL), 'Info', $MsgText, 0, $Form1) ; or pass 3 comma delimited parameters been: "delay, X pos, Y pos" ; also, the buttom number to delay, can be chosen by "/2" for the 2nd button for example. Default is Button1. ;~ $returned = _MsgBox_Extn("5/1, 20, 100", BitOR($MB_TOPMOST, $MB_ICONINFORMATION, $MB_OKCANCEL), 'Info', $MsgText, 10, $Form1) ; or pass 3 comma delimited parameters been: "0 delay, X pos, Y pos" to just move the MsgBox ;~ $returned = _MsgBox_Extn("0, 20, 100", BitOR($MB_TOPMOST, $MB_ICONINFORMATION, $MB_OKCANCEL), 'Info', $MsgText, 10, $Form1) ; or pass 5 comma delimited parameters been: "delay, X pos, Y pos, Width, Height" but is in my view, nonsense. ;~ $returned = _MsgBox_Extn("5/-2, 20, 100, 600, 300", BitOR($MB_TOPMOST, $MB_ICONINFORMATION, $MB_OKCANCEL), 'Info', $MsgText, 10, $Form1) If $returned = $IDCANCEL Then GUIDelete() Exit 5 ; it exited with an errorlevel of, 5 in this case. EndIf While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete() ExitLoop EndSwitch WEnd The UDF file: MsgBox_Extn.au3 There you go. Edit: Fixed "Run Once", never running again. Edit2: Fixed button, not restoring the original text. Edit3: Added X,Y "WinMove()". Edit4: Fixed when delay is zero because the user just wants to move the MsgBox(). Edit5: Changed the name to a more fitting one. Edit6: Added to optionally choose the button to disable. Edit7: Added to optionally change a default button text. Edit8: Fixed stuff and added stuff. ( Example for some of new stuff provided ) Edit9: Added _MsgBox_Extn_SetMessageText() Edit10: Added "disable all buttons", if the 2nd number is a negative (" 5 sec. / -1 ButtonNumber ", . Edit11: Removed callback parameters in function. This is simpler.2 points -
Another way : #include <WinAPI.au3> Global $bEnable, $hHook Example() Func Example() Local $hProc = DllCallbackRegister(CbtHookProc, "int", "int;int;int") $hHook = _WinAPI_SetWindowsHookEx($WH_CBT, DllCallbackGetPtr($hProc), 0, _WinAPI_GetCurrentThreadId()) $bEnable = False MsgBox(0, "test", "test",5) $bEnable = True Local $iRet = MsgBox(0, "test", "test") _WinAPI_UnhookWindowsHookEx($hHook) DllCallbackFree($hProc) EndFunc ;==>Example2 Func CbtHookProc($nCode, $wParam, $lParam) If $nCode = 5 Then ; 5=HCBT_ACTIVATE $hWnd = HWnd($wParam) If Not $bEnable Then ControlDisable($hWnd, "", "Button1") EndIf Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam) EndFunc ;==>CbtHookProc2 points
-
run a script with advanced permissions
Andreik and one other reacted to argumentum for a topic
Congratulations in you 35th post since 2021 ! Is good to see that you learned about font size and code posting.2 points -
After answering some clipboard questions in the help forum, I found myself writing a couple of helper funcs so I thought I'd share. I don't think I added any headers, I'm probably assuming (maybe to much?) that most will get it (yep, to lazy). Example code: #include "ClipBoardMisc.au3" #include <Array.au3> #cs Example 1 collect all the text/unicode/binary data in an array from clip #ce Global $gaArgs = _cbTest_GetAllData() _ArrayDisplay($gaArgs, Default, Default, Default, Default, _ "Format Type|Data TEXT|Data Unicode|Data Byte|Data ByteStr") Func _cbTest_GetAllData() Local $aClipFormats = _ClipBoard_GetCurrentFormatArray() If @error Then Return SetError(1, 0, Null) Local $aRet[UBound($aClipFormats)][5] ; [n][3] is memory address For $i = 0 To UBound($aClipFormats) - 1 ; Using all CBRT_ globals because I'm to lazy to go through all the CFSTR and do ; exhausting test functions to test what type of strings they are ; See: https://geekdude.io/static/ahk/Constants.W32.ini if you want to get a long list of CFSTR_ options $aRet[$i][0] = $aClipFormats[$i][2] $aRet[$i][1] = _ClipBoard_GetMemoryData($aClipFormats[$i][3], $CBRT_TEXT) $aRet[$i][2] = _ClipBoard_GetMemoryData($aClipFormats[$i][3], $CBRT_UNICODE) $aRet[$i][3] = _ClipBoard_GetMemoryData($aClipFormats[$i][3], $CBRT_BYTE) $aRet[$i][4] = _ClipBoard_GetMemoryData($aClipFormats[$i][3], $CBRT_BYTESTR) Next Return $aRet EndFunc Example 2: Get specific format id types array #include "ClipBoardMisc.au3" #include <Array.au3> ;~ #cs Example 2 ; Make sure you use "copy" on a file to test this ; Func: _ClipBoard_GetTypeArray($sType, $hOwner = 0) ; ; $sType: 1. String to be split by "|" separator char ; 2. Return type to be added similar as a struct ; example: $sType = "Text;str|FileNameW;wstr" ; Separates 2 types of arrays internally ; 1. Type array: [n] = "Text" ; [n] = "FileNameW" ; 2. Return type: [n] = "str" ; [n] = "wstr" ; Valid Format Return Strying types: ; "str" or "chr" ; "wstr" or "wchr" or "unicode" ; "byte" ; "bytestr" ; Return: Success: 2D array ; [n][0] = Found Type ; [n][1] = Found Value ; ; Note: It will not validate if the memory address is valid for your return type Global $ga_Test = _ClipBoard_GetTypeArray("filename;str|filenameW;wstr") If @error Then MsgBox(16, "Error", "Error: " & @error & " :: Extended: " & @extended) Else _ArrayDisplay($ga_Test) EndIf ;~ #ce ; updated zip ClipBoardMisc.zip2 points
-
MsgBox/MessageBox - Move and change button text
simplercoder000 reacted to SmOke_N for a topic
A while back, a few of us came up with a method to move the MsgBox window and to change button text. It was rather clumsy. I wrote a dll solution for moving the MsgBox to the center of the parent GUI window that owned it for most of my personal work. I decided to port it over to AutoIt rather continue to port the dll with all my AutoIt work, in addition I added the button text changing to the solution as well. The examples should be self explanatory on how to use the functions provided. * Note - I did not take the time to a $MB_OK type of Constant variable, they are there ( eg. $__iMsgBox_IDOK ), but they are designed for internal use only.Example: #include <MsgBoxUDF.au3> #region 3 piece function call ; Regardless of Coords, if a handle is passed, it will center messagebox to window of handle _MsgBox_SetWindowPos(200, 100) ; The same flag passed for buttons 0-6 should be set for both messagebox and setbuttontext _MsgBox_SetButtonText(4, "Button1", "Button2") _MsgBox(4 + 262144, "Title", "Hello World One") Sleep(250) ; See now that it reset back to default _MsgBox(4 + 262144, "Title", "Hello World Two") #endregion 3 piece function call #region stand alone all in one call Sleep(250) ; Change buton 1 to Button1; Move to top left corner of desktop _MsgBoxEx(4 + 262144, "Title", "Hello World Three", -1, -1, "Button1", -1, -1, 0, 0) Sleep(250) ; Center to active window _MsgBoxEx(4 + 262144, "Title", "Hello World Four", -1, WinGetHandle(""), -1, "Button2", -1, 0, 0) #endregion stand alone all in one call MsgBoxUDF.au31 point -
Extended Message Box - New Version: 16 Feb 24
hudsonhock reacted to Melba23 for a topic
Are you annoyed by the limitations of the standard Windows message dialog created by MsgBox? Would you like to have coloured backgrounds and text? To choose the justification and font? Do you want to be able to place the message box other than in the centre of the screen? Centred on your GUI, for example, or at a particular location on screen? What about having user-defined text on as many buttons as you need? And user-defined icons? Or a visible countdown of the timeout? Finally, would you like to choose whether the message box has a button on your already too-crowded taskbar? If the answer to any of these questions is "YES" then the ExtMsgBox UDF is for you! [NEW VERSION] 16 Feb 24 Changed: Some additional functionality added to the "TimeOut" parameter of _ExtMsgBox: - A positive integer sets the EMB timeout as before. - A negative integer will double the size of the countdown timer if it is used. - A colon-delimited string (eg: "10:5") will set the normal EMB timeout (first integer) and will also initially disable the EMB buttons for the required period (second integer). New UDF and examples in the zip. Older version changes: ChangeLog.txt As always, I realise nearly all of the DLL calls in these UDFs could be made by using commands in other UDFs like WinAPI.au3 - but as with all my UDFs (which you can find in my sig below) I am trying to prevent the need for any other include files. The UDF and examples (plus StringSize) in zip format: ExtMsgBox.zip Courteous comments and constructive criticisms welcome - guess which I prefer! M231 point -
Writing code: use of LLM AI or not
argumentum reacted to jchd for a topic
Interesting study! https://arxiv.org/pdf/2211.03622.pdf1 point -
Capturing screenshots while computer is locked
argumentum reacted to junkew for a topic
Put the computer in a lockable cabinet. Much cheaper then finding a technical solution. Remote control that computer if you sometimes need access.1 point -
Create a MsgBox with buttons disabled for specific amount of time
argumentum reacted to SmOke_N for a topic
I'm no spring chicken, self taught starting with AutoIt and branched from there, if I can get things, I'm quite positive you can too. I believe in you1 point -
Create a MsgBox with buttons disabled for specific amount of time
argumentum reacted to SmOke_N for a topic
I would have1 point -
Create a MsgBox with buttons disabled for specific amount of time
simplercoder000 reacted to argumentum for a topic
..you know, going down the rabbits hole, at trying to add "SetDlgItemText" to rename the buttons, might as well just have added the timer thing to your script. 😅 Edit: ..the idea started after reading https://uxmovement.com/buttons/why-the-ok-button-is-no-longer-okay/ and I'm like, meh, I'll add that too. Wrong.1 point -
run a script with advanced permissions
argumentum reacted to stiv for a topic
@argumentum thanks for the corrections to my syntax1 point -
Writing code: use of LLM AI or not
argumentum reacted to jchd for a topic
Unless big names in the LLM area invest real money to improve the state of art (and I hardly see a strong motivation for doing so) I fear that we'll have to face a tsunami of serious bugs in a large number of applications.1 point -
Create a MsgBox with buttons disabled for specific amount of time
simplercoder000 reacted to argumentum for a topic
...what do people with insomnia do ?. Code 🤪 Added WinMove the MsgBox() to, anywhere. Center it on you GUI if the GUI is not centered ? And renamed the UDF and function. It does more and quite likely, will have more use as a box mover, than the original timer delay aspect of it.1 point -
1 point
-
Create a MsgBox with buttons disabled for specific amount of time
argumentum reacted to simplercoder000 for a topic
1 point -
Create a MsgBox with buttons disabled for specific amount of time
Danyfirex reacted to argumentum for a topic
#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <MsgBox_Extn.au3> ; the magic $MsgText = 'Continue using this software at your own risk !' & @CRLF $MsgText &= 'By clicking on OK button you are agree in the software agreement !' #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 339, 131, -1, -1) $Label1 = GUICtrlCreateLabel("Welcome to the empty frame software :)", 72, 32, 191, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ;~ $returned = MsgBox(65, 'Info', $MsgText) $returned = _MsgBox_Extn(5, 65, 'Info', $MsgText, 0, $Form1) If $returned = $IDCANCEL Then GUIDelete() Exit Else #do nothing EndIf While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd I hope that's good enough1 point -
Create a MsgBox with buttons disabled for specific amount of time
simplercoder000 reacted to argumentum for a topic
lol, then your GUI has to exist first. Then call the MsgBox. You're some developer you know.1 point -
Create a MsgBox with buttons disabled for specific amount of time
simplercoder000 reacted to argumentum for a topic
..if he wanted the MsgBox centered in his GUI, I'd have used chucks of yours too1 point -
Create a MsgBox with buttons disabled for specific amount of time
simplercoder000 reacted to argumentum for a topic
.. , ...just reading. Look. Coding is tedious, slow, error until there are none. If you wanna code, you're gonna have to learn to pace yourself.1 point -
Onkyo/Integra EISCP Example
argumentum reacted to jaberwacky for a topic
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) EndFunc1 point -
Create a MsgBox with buttons disabled for specific amount of time
simplercoder000 reacted to argumentum for a topic
If StringInStr($CmdLineRaw, "/MyMessingAroundWithyMsgBox") Then Exit MyMessingAroundWithyMsgBox() Func MyMessingAroundWithyMsgBox() AutoItWinSetTitle("MyMessingAroundWithyMsgBox") Local $sTitle = StringTrimRight(@ScriptName, 4), $sText = "Please make sure to", $sCtrl = "Button1" WinWait($sTitle, $sText) ControlDisable($sTitle, $sText, $sCtrl) For $n = 5 To 1 Step -1 ControlSetText($sTitle, $sText, $sCtrl, $n) Sleep(999) Next ControlSetText($sTitle, $sText, $sCtrl, "&Ok") ControlEnable($sTitle, $sText, $sCtrl) EndFunc TellThemAndTellThemGood() Func TellThemAndTellThemGood() ShellExecute(@AutoItExe, '"' & @ScriptFullPath & '" /MyMessingAroundWithyMsgBox') WinWait("MyMessingAroundWithyMsgBox") Local $sMsg = "Please make sure to read this:" & @CR $sMsg &= "Some important text is here" & @CR & @CR $sMsg &= "Are you sure want to continue ?" MsgBox(262144 + 64, StringTrimRight(@ScriptName, 4), $sMsg, 60) EndFunc This is what you would like to see @simplercoder000, right ?1 point -
Create a MsgBox with buttons disabled for specific amount of time
simplercoder000 reacted to SmOke_N for a topic
You could make customized MsgBox() funcs (I believe that's the route Melba took, haven't looked in years) like @argumentum suggested. You could write an outside script and execute before the msgbox to disable the message box button (eg using run() to run script from memory or from an executable) before the msgbox (way more of a hassle me thinks). You could set windows hooks, I did it here: But I didn't add a disable/timer option, but it's totally possible. (Warning, I haven't updated that thing in years but the concept is still there) Honestly, with the way Melba keeps up with things, if he has that option, that's probably the way to go.1 point -
Create a MsgBox with buttons disabled for specific amount of time
simplercoder000 reacted to argumentum for a topic
since MsgBox() is a blocking function, the way to go about it is to make your own GUI. Or, use @Melba23's https://www.autoitscript.com/forum/topic/109096-extended-message-box-new-version-19-nov-21/1 point -
Nice 🙂, added CF_HDROP for multiple filename selections. #include <Clipboard.au3> #include <Array.au3> Global $gaArgs = _ClipBoard_GetCurrentFormatArray() ; https://www.autoitscript.com/forum/index.php?showtopic=211494&view=findpost&p=1530297 If @error Then MsgBox(16, "Error", "Error: " & @error) Else _ArrayDisplay($gaArgs, Default, Default, Default, Default, "ID Formatted|ID Raw|ID Type|Memory Location|Data from hMem ( if you added the code )") EndIf Func _ClipBoard_GetCurrentFormatArray($hOwner = 0) _ClipBoard_Open($hOwner) Local $iCount = _ClipBoard_CountFormats() If @error Then _ClipBoard_Close() Return SetError(-1, 0, 0) EndIf ; Array[number of formats][0:format id formatted ; 1:format id raw ; 2:format type ; 3:memory location] ; If memory location = 0, then we'll exclude it from the array Local $i2ndArgs = 4 + 1 ; using redim later, save time making sure count is right ; + 1 to set the data Local $aRet[$iCount][$i2ndArgs] Local $iFormat, $iEnum = 0, $hMem = 0 Do $iFormat = _ClipBoard_EnumFormats($iFormat) If $iFormat <> 0 Then $hMem = _ClipBoard_GetDataEx($iFormat) If $hMem <> 0 Then $aRet[$iEnum][0] = "0x" & Hex($iFormat, 4) ; format id formatted $aRet[$iEnum][1] = $iFormat ; format id raw $aRet[$iEnum][2] = _ClipBoard_FormatStr($iFormat) ; format type $aRet[$iEnum][3] = $hMem ; memory location $aRet[$iEnum][4] = _ClipBoard_ClipBoard_GetDataFromMem($hMem, $iFormat) $iEnum += 1 EndIf EndIf Until $iFormat = 0 _ClipBoard_Close() If $iEnum = 0 Then Return SetError(-2, 0, 0) ; resize array ReDim $aRet[$iEnum][$i2ndArgs] Return SetExtended($iEnum, $aRet) EndFunc ;==>_ClipBoard_GetCurrentFormatArray Func _ClipBoard_ClipBoard_GetDataFromMem($hMem, $iFormat) ; added by argumentum ; based on prior post ; https://www.autoitscript.com/forum/topic/211494-get-path-from-file-in-clipboard/?do=findComment&comment=1530284 Local $pMemoryBlock = _MemGlobalLock($hMem) If $pMemoryBlock = 0 Then Return SetError(-4, 0, "") Local $tData, $iDataSize = _MemGlobalSize($hMem) If $iDataSize = 0 Then _MemGlobalUnlock($hMem) Return SetError(-5, 0, "") EndIf ; hint: https://github.com/tpn/winsdk-10/blob/master/Include/10.0.10240.0/um/ShlObj.h ; I guess someone/you has to declare/enum these: Local Enum $CF_FileName = 49158, $CF_FileNameW Switch $iFormat ; chunk from: #include <Clipboard.au3> ; _ClipBoard_GetData() Case $CF_TEXT, $CF_OEMTEXT, $CF_FileName $tData = DllStructCreate("char[" & $iDataSize & "]", $pMemoryBlock) Case $CF_UNICODETEXT, $CF_FileNameW ; Round() shouldn't be necessary, as CF_UNICODETEXT should be 2-bytes wide & thus evenly-divisible $iDataSize = Round($iDataSize / 2) $tData = DllStructCreate("wchar[" & $iDataSize & "]", $pMemoryBlock) Case $CF_HDROP $tData = DllStructCreate("byte[" & $iDataSize & "]", $pMemoryBlock) ; by jchd ; https://www.autoitscript.com/forum/topic/210647-drag-and-drop-many-files-to-a-compiled-script/?do=findComment&comment=1522418 Local $data = DllStructGetData($tData, 1) Local $bin = BinaryMid($data, 21, BinaryLen($data) - 24) Local $c, $s For $i = 1 To BinaryLen($bin) Step 2 $c = BinaryMid($bin, $i, 2) $s &= ($c <> 0 ? ChrW($c) : "|") Next _MemGlobalUnlock($hMem) Return SetExtended(StringLen($s), $s) Case Else ; Binary data return for all other formats $tData = DllStructCreate("byte[" & $iDataSize & "]", $pMemoryBlock) EndSwitch _MemGlobalUnlock($hMem) Return SetExtended($iDataSize, DllStructGetData($tData, 1)) EndFunc ;==>_ClipBoard_ClipBoard_GetDataFromMem1 point
-
Get path from file in clipboard
ioa747 reacted to argumentum for a topic
When you code your solution(s), post them here. I'd love to have 'em ( for my "copy'n'paste" coding style )1 point -
Here, I wrote something to get you a majority of the way, now you can use the format ids and mem locations to get the data you want (or you can use the array to see if the data you want is even there). #include <Clipboard.au3> #include <Array.au3> Global $gaArgs = _ClipBoard_GetCurrentFormatArray() If @error Then MsgBox(16, "Error", "Error: " & @error) Else _ArrayDisplay($gaArgs, Default, Default, Default, Default, "ID Formatted|ID Raw|ID Type|Memory Location") EndIf Func _ClipBoard_GetCurrentFormatArray($hOwner = 0) _ClipBoard_Open($hOwner) Local $iCount = _ClipBoard_CountFormats() If @error Then _ClipBoard_Close() Return SetError(-1, 0, 0) EndIf ; Array[number of formats][0:format id formatted ; 1:format id raw ; 2:format type ; 3:memory location] ; If memory location = 0, then we'll exclude it from the array Local $i2ndArgs = 4 ; using redim later, save time making sure count is right Local $aRet[$iCount][$i2ndArgs] Local $iFormat, $iEnum = 0, $hMem = 0 Do $iFormat = _ClipBoard_EnumFormats($iFormat) If $iFormat <> 0 Then $hMem = _ClipBoard_GetDataEx($iFormat) If $hMem <> 0 Then $aRet[$iEnum][0] = "0x" & Hex($iFormat, 4) ; format id formatted $aRet[$iEnum][1] = $iFormat ; format id raw $aRet[$iEnum][2] = _ClipBoard_FormatStr($iFormat) ; format type $aRet[$iEnum][3] = $hMem ; memory location $iEnum += 1 EndIf EndIf Until $iFormat = 0 _ClipBoard_Close() If $iEnum = 0 Then Return SetError(-2, 0, 0) ; resize array ReDim $aRet[$iEnum][$i2ndArgs] Return SetExtended($iEnum, $aRet) EndFunc I only wrote this because I believe it should exist for everyone, this is definitely something I can see being handy for a majority of people that use the ClipBoard.au3 extensively.1 point
-
DarkMode UDF for AutoIt's Win32GUIs
taurus905 reacted to argumentum for a topic
Since I'm working on updating the UDFs, I made a demo: that is quite ugly code wise. Hence my participation on this thread. I like your UDF and would love to see it merged to the extent that is currently functional to the standard distribution for a next release. Would you like to make the changes to make it so ? am recruiting you 🤪 ( am not affiliated with MVPs or developers but am nonetheless bringing up ideas , and try my best to have more capable product for us all ) By the way: this demo is to showcase _WinAPI_DwmSetWindowAttribute() and since it has no examples in the help file, I made two of which this is one. Also the enumeration is based in WinXP or 7. It all needs to be updated to Win 11. Having examples help the users use the function and also, out of the attention it gets, it get's debugged and expanded1 point -
Receiving data from a connected TCP device
jaberwacky reacted to SoulA for a topic
Yes, look at getting wireshark.1 point -
Receiving data from a connected TCP device
jaberwacky reacted to SoulA for a topic
Maybe you have to wait for the PASSWORD: prompt before you start sending data. Do the TCPConnect() function and then after you connect have a _TCPRecv() there waiting for the password prompt. You should then see the PASSWORD: that I am seeing in your normal hyperterminal communication. See if that shows up garbled. NOTE: I am not familiar with hyperterminal what so ever so that might have some kind of translation process. If you can read this stuff in telnet than you should be able to read it here using these methods. Be something like this... $ip = "192.168.0.1" $port = 230 $msg = "PASSWORD" TCPStartup() Do $socket = TCPConnect($ip, $port) Until $socket <> -1 $Recv = _TCPRecv($socket) MsgBox(0,"PASSWORD:?",$Recv) ;_TCPSend($socket, $msg) ;$Recv = _TCPRecv($Socket) ;MsgBox(0,"Received this",$Recv) ;TCPShutdown() Func _TCPSend($socket, $msg) TCPSend($socket, $msg) If @error Then MsgBox(0, "Error", "Message failed to send") Exit EndIf EndFunc Func _TCPRecv($socket) $timeout = TimerInit() Do $Recv = TCPRecv($socket, 1024) If TimerDiff($timeout) > 1000 Then MsgBox(0, "Error", "Timeout") Exit EndIf Until $Recv <> "" Return $Recv EndFunc1 point -
Receiving data from a connected TCP device
jaberwacky reacted to SoulA for a topic
What kind of info what it normally return in hyper terminal? I mean its obviously communicating with you and sending you something...1 point -
Receiving data from a connected TCP device
jaberwacky reacted to SoulA for a topic
You sure this isn't using some kind of encryption?1 point -
Receiving data from a connected TCP device
jaberwacky reacted to SoulA for a topic
I would say your sleeps are too long. Specifically the one between your TCPSend and TCPRecv... with a 500 sleep the message could have came and not been read I believe. Try this and see what happens... $ip = "192.168.0.1" $port = 230 $msg = "PASSWORD" TCPStartup() Do $socket = TCPConnect($ip, $port) Until $socket <> -1 sleep(100) _TCPSend($socket, $msg) $Recv = _TCPRecv($Socket) MsgBox(0,"Received this",$Recv) TCPShutdown() Func _TCPSend($socket, $msg) TCPSend($socket, $msg) If @error Then MsgBox(0, "Error", "Message failed to send") Exit EndIf EndFunc Func _TCPRecv($socket) $timeout = TimerInit() Do $Recv = TCPRecv($socket, 1024) If TimerDiff($timeout) > 1000 Then MsgBox(0, "Error", "Timeout") Exit EndIf Until $Recv <> "" Return $Recv EndFunc1 point