Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/14/2024 in all areas

  1. 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_GetDataFromMem
    2 points
  2. If I wrote it and posted it, it's free to use (unless there's real royalties, then thank you in advance 😂).
    2 points
  3. SmOke_N

    ClipBoard.au3 udf extras

    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.zip
    1 point
  4. When you code your solution(s), post them here. I'd love to have 'em ( for my "copy'n'paste" coding style )
    1 point
  5. 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
  6. Used this Problem by Writing a DLL === closed ===
    1 point
  7. Version 0.03 ist out with new HookOpenNcThemeData.dll als Replacement for the FixScrollbar Feature!!
    1 point
  8. Little update of what im doing right now, for those who are intrested. Im working right now on writing a DLL in C++ to hoock the OpenNcThemeData to make the change that the Folowing code in the C++ FixDarkScrollBari func dose (https://github.com/ysc3839/win32-darkmode/blob/master/win32-darkmode/DarkMode.h) Ill use a differen method to realise the hoockup but it will make the same changes. auto MyOpenThemeData = [](HWND hWnd, LPCWSTR classList) -> HTHEME { if (wcscmp(classList, L"ScrollBar") == 0) { hWnd = nullptr; classList = L"Explorer::ScrollBar"; } return _OpenNcThemeData(hWnd, classList); }; P.s. but since I'm doing this for the first time... it takes some time and nerves :3
    1 point
  9. I have solved the issue by combining HiDPI_Changes.au3 UDF by @Jos with @InnI method to get current value of DPI That resulted in getting a correctly working GUI with High DPI support and without any issues. For more info please check here: Thanks @argumentum for helping me.
    1 point
  10. System will not resize GUI and controls according to DPI scaling. You must do this manually. For example ; current value of primary monitor DPI is stored in the registry: ; HKCU\Control Panel\Desktop\WindowMetrics, AppliedDPI ; need to relogin after DPI changed to update this value $Scale = RegRead("HKCU\Control Panel\Desktop\WindowMetrics", "AppliedDPI") / 96 DllCall("User32.dll", "bool", "SetProcessDPIAware") GUICreate("DPI test", 200 * $Scale, 100 * $Scale) GUICtrlCreateButton("test button text", 10 * $Scale, 10 * $Scale, 80 * $Scale, 25 * $Scale) GUICtrlCreateCombo("test combo text", 10 * $Scale, 40 * $Scale, 100 * $Scale, 25 * $Scale) GUICtrlCreateLabel("test label text", 10 * $Scale, 70 * $Scale, 70 * $Scale, 25 * $Scale) GUISetState() Do Until GUIGetMsg() = -3
    1 point
  11. Cool! I have an Onkyo home theater receiver, but I don't think it's an Ethernet enabled one. Interesting option.
    1 point
  12. You might get some help from this post: AVForums: Onkyo (TX-NR 1007) Webinterface Programming The message formatting in VB.net looks like this: Dim sendBytes(command.Length + 18) As Char sendBytes(0) = "I" sendBytes(1) = "S" sendBytes(2) = "C" sendBytes(3) = "P" sendBytes(4) = Chr(0) sendBytes(5) = Chr(0) sendBytes(6) = Chr(0) sendBytes(7) = Chr(16) sendBytes(8) = Chr(0) sendBytes(9) = Chr(0) sendBytes(10) = Chr(0) sendBytes(11) = Chr(command.Length + 3) sendBytes(12) = Chr(1) sendBytes(13) = Chr(0) sendBytes(14) = Chr(0) sendBytes(15) = Chr(0) sendBytes(16) = "!" 'Chr(33) sendBytes(17) = "1" 'Chr(49) ' 1 is for the Receiver Dim i As Int32 For i = 0 To (command.Length - 1) sendBytes(18 + i) = command.Chars(i) Next sendBytes(command.Length + 18) = Chr(13)Note there are null characters in the stream. So you want to convert it all to a binary before transmission (null terminates a string in AutoIt). My interpretation in AutoIt: ; ISCP 00000010 00000007 01000000 !1PWR01 0D Global $binISCP_Header = StringToBinary("ISCP") Global $binISCP_HeaderSize = Binary("0x00000010") ; Header size = 16 Global $binISCP_DataSize = Binary("0x00000007") ; Data size (command length) = 7 chars Global $binISCP_Version = Binary("0x01000000") ; Version 1.0.0.0 Global $binISCP_Data = StringToBinary("!1PWR01") ; Command = !1PWR01 Global $binISCP_End = Binary("0x0D") ; @CR Global $binISCP_Message = $binISCP_Header & _ $binISCP_HeaderSize & _ $binISCP_DataSize & _ $binISCP_Version & _ $binISCP_Data & _ $binISCP_End ; ... TCPSend($ConnectedSocket, $binISCP_Message) ; Send message over connected socket Not tested, of course. Changing the end of my code to this: ; TCPSend($ConnectedSocket, $binISCP_Message) ; Send message over connected socket ConsoleWrite("$binISCP_Message = " & $binISCP_Message & @LF)I get this out: $binISCP_Message = 0x49534350000000100000000701000000213150575230310D
    1 point
  13. Hex is a method to display data (like in the SciTE console pane), not encode it for transmission. The TCPSend() is given either string or binary data. What is called for and what did you pass? Since you haven't shared any code or a complete description of your method, we can't help much.
    1 point
×
×
  • Create New...