Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/29/2024 in all areas

  1. Try this workaround: #include <Word.au3> #include "WordConstants.au3" #include <GDIPlus.au3> #include <Clipboard.au3> _GDIPlus_Startup() Global $hBitmapGDI = _GDIPlus_BitmapCreateFromMemory(_Base64String()) Global $bPNG = _GDIPlus_StreamImage2BinaryString($hBitmapGDI) $iFormat_PNG = _ClipBoard_RegisterFormat("PNG") _ClipBoard_Open(0) _ClipBoard_Empty() $iSize = BinaryLen($bPNG) $hMemory = _MemGlobalAlloc($iSize, $GHND) $hLock = _MemGlobalLock($hMemory) $tData = DllStructCreate("byte png[" & $iSize & "]", $hLock) $tData.png = Binary($bPNG) _MemGlobalUnlock($hMemory) MsgBox(0, "Copy Image as PNG to clipboard", _ "Clipboard handle: " & _ClipBoard_SetDataEx($hMemory, $iFormat_PNG)) _MemGlobalFree($hMemory) _GDIPlus_ImageDispose($hBitmapGDI) _GDIPlus_Shutdown() Exit Func _GDIPlus_StreamImage2BinaryString($hBitmap, $sFormat = "PNG", $iQuality = 80, $bSave = False, $sFilename = @ScriptDir & "\Converted.jpg") ;coded by UEZ 2013 build 2014-01-25 Local $sImgCLSID, $tGUID, $tParams Switch $sFormat Case "JPG" $sImgCLSID = _GDIPlus_EncodersGetCLSID($sFormat) $tGUID = _WinAPI_GUIDFromString($sImgCLSID) Local $tData = DllStructCreate("int Quality") DllStructSetData($tData, "Quality", $iQuality) ;quality 0-100 Local $pData = DllStructGetPtr($tData) $tParams = _GDIPlus_ParamInit(1) _GDIPlus_ParamAdd($tParams, $GDIP_EPGQUALITY, 1, $GDIP_EPTLONG, $pData) Case "PNG", "BMP", "GIF", "TIF" $sImgCLSID = _GDIPlus_EncodersGetCLSID($sFormat) $tGUID = _WinAPI_GUIDFromString($sImgCLSID) Case Else Return SetError(1, 0, 0) EndSwitch Local $hStream = _WinAPI_CreateStreamOnHGlobal() ;http://msdn.microsoft.com/en-us/library/ms864401.aspx If @error Then Return SetError(2, 0, 0) _GDIPlus_ImageSaveToStream($hBitmap, $hStream, DllStructGetPtr($tGUID), DllStructGetPtr($tParams)) If @error Then Return SetError(3, 0, 0) Local $hMemory = _WinAPI_GetHGlobalFromStream($hStream) ;http://msdn.microsoft.com/en-us/library/aa911736.aspx If @error Then Return SetError(4, 0, 0) Local $iMemSize = _MemGlobalSize($hMemory) If Not $iMemSize Then Return SetError(5, 0, 0) Local $pMem = _MemGlobalLock($hMemory) $tData = DllStructCreate("byte[" & $iMemSize & "]", $pMem) Local $bData = DllStructGetData($tData, 1) _WinAPI_ReleaseStream($hStream) ;http://msdn.microsoft.com/en-us/library/windows/desktop/ms221473(v=vs.85).aspx _MemGlobalFree($hMemory) If $bSave Then Local $hFile = FileOpen($sFilename, 18) If @error Then Return SetError(6, 0, $bData) FileWrite($hFile, $bData) FileClose($hFile) EndIf Return $bData EndFunc ;==>_GDIPlus_StreamImage2BinaryString Func _Base64String($bSaveBinary = False, $sSavePath = @ScriptDir) Local $Base64String $Base64String &= 'm7MAiVBORw0KGgoAAAAADUlIRFIlAHBkARgIBgAocOIElVQAGAlwSFlzEAAACxIBDAHS3QB+/AAAA3RJRABBVHgB7ZsxbwDTUBSFDWKq1ACVSmwMwNof0ACNhQXGDsxIlQC6UcHGPwC1WwAlpM79AbCwsADxA7oCAxsSWQCROnM+iFOSWgCJRJN3bsq50gBVHDt59/g79gDzs/PSdYkQCAKBQgJ1JnCjvPgAvcMhidta+UAAeUe5Of7AT70Afld+Vp6N13UA3duDyeI6LKwAiyEbgvlU+UQA+VDJ+3lxro0AH5XvlKdK3g8ARzHD/IYMnwEAPbzbWnip3FcALjKh/87sK2YAHCtfK0ezG6sAnUE3Lwmss+IAuaR8U75Q/qsAGewN36UN2qIAzdJR0RDOCroAGi4eVzFiFjwAbdEmbVOjZFQAM4SL9Sfl4xUA0qJtalCrXFQAMgRAH5T3GlAAoga1yplS5aIAThfCUdvCDJUAmcRXLe0oR5MANf2CafRV5QwAORGH1maAnpoA1C4TFQxh5LMAymvGItjULjMA+mrfZU3fd9AAVTEcXeZoapEAAUPbz7XyrvIAouv6T7ssbvoA3GZgEBrQYg8AZ5cFhH07gQsAAWhBkzWchvBAbMoO4C/6BAagALBa2DU5DeGpAG21sGtyGcIdAHKl7qo/MNBkAL17dxnCj0tVAOO+U5jLEH7pAKsaVm0uQzarCLohXQECCvvhlQDmMoQJCVXDqgDNZQizQ6qGVQCbyxCm6lSNLwBOYS5DzrTTPABhrRZoQpstXACGsMPMm6oWdgBNTkOY/VEt7ACanIbMn1HY3gAquis0WcNpCAAAjq17P10cLQBosobTEHac6QCddghjDWixxwCt5gqmf6sedQB7h6+kgRmFzgBAw8gpoK/tPgBD0HGkfN8LMgC8UhsNJaKCIQCAeKZk0lrroAAmtctE+y5reADX6S52lUzv3AAa/sjS1/5QiwC7+jtCia6q3wC7' $Base64String &= 'KmcIerhDfgCkbHGmUINa1gC7ctW/FJUMQQAcgHaUq7ym0AA2NcqZIU1dNQBD0EQXwuyPAwDlMofEtEWbtABdqpuSnklUNACkF8fIh+mdbwCUVzGG79IGbQCVGU1Jy2C0nwDbOyhjzso/cwCBN/QJJrFxdABf6z99VhllzQBx5PcmjvKTcQCyYlt5Lf8WzSDOJUIgBLkA/AQAfgGdGnQnr6IELMkA5QBJRU5EAK5CYII=' $Base64String = _WinAPI_Base64Decode($Base64String) If @error Then Return SetError(1, 0, 0) Local $tSource = DllStructCreate('byte[' & BinaryLen($Base64String) & ']') DllStructSetData($tSource, 1, $Base64String) Local $tDecompress _WinAPI_LZNTDecompress($tSource, $tDecompress, 962) If @error Then Return SetError(3, 0, 0) $tSource = 0 Local Const $bString = Binary(DllStructGetData($tDecompress, 1)) If $bSaveBinary Then Local Const $hFile = FileOpen($sSavePath & "\Test.png", 18) If @error Then Return SetError(2, 0, $bString) FileWrite($hFile, $bString) FileClose($hFile) EndIf Return $bString EndFunc ;==>_Base64String Func _WinAPI_Base64Decode($sB64String) Local $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "ptr", 0, "dword*", 0, "ptr", 0, "ptr", 0) If @error Or Not $aCrypt[0] Then Return SetError(1, 0, "") Local $bBuffer = DllStructCreate("byte[" & $aCrypt[5] & "]") $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "struct*", $bBuffer, "dword*", $aCrypt[5], "ptr", 0, "ptr", 0) If @error Or Not $aCrypt[0] Then Return SetError(2, 0, "") Return DllStructGetData($bBuffer, 1) EndFunc ;==>_WinAPI_Base64Decode Func _WinAPI_LZNTDecompress(ByRef $tInput, ByRef $tOutput, $iBufferSize) $tOutput = DllStructCreate("byte[" & $iBufferSize & "]") If @error Then Return SetError(1, 0, 0) Local $aRet = DllCall("ntdll.dll", "uint", "RtlDecompressBuffer", "ushort", 0x0002, "struct*", $tOutput, "ulong", $iBufferSize, "struct*", $tInput, "ulong", DllStructGetSize($tInput), "ulong*", 0) If @error Then Return SetError(2, 0, 0) If $aRet[0] Then Return SetError(3, $aRet[0], 0) Return $aRet[6] EndFunc ;==>_WinAPI_LZNTDecompress It converts the image to a PNG image in the memory to put it to the clipboard afterwards. I tested it with MS Word and it worked properly.
    2 points
  2. Zedna

    autoit tutorials?

    I agree that AutoIt's helpfile should be the best start ... Also look at AutoIt's WIKI: https://www.autoitscript.com/wiki -> there is also Tutorials section with useful links: https://www.autoitscript.com/wiki/Tutorials
    1 point
  3. argumentum

    Autoit password style

    Now using @Werty's code as a base: #include <GUIConstants.au3> #include <WinAPIGdi.au3> #include <FontConstants.au3> #include <ColorConstants.au3> #include <SendMessage.au3> #include <WinAPISysWin.au3> Global $g__sEyeSlashsFontname, $g__hEyeSlashsFontHandle = _LoadFont_EyeSlashs($g__sEyeSlashsFontname) ; code tested on WinXP, 10 and 11. 32bit & 64bit Example() Func Example() Local $hGui = GUICreate("Login", 200, 90) Local $idInputA, $idEyeShwnA, $idEyeHddnA, $bHideA, $idInputB, $idEyeShwnB, $idEyeHddnB, $bHideB, $idInputC, $idEyeShwnC, $idEyeHddnC, $bHideC _PasswordInput_GUICtrlsCreate($idInputA, $idEyeShwnA, $idEyeHddnA, $bHideA, ChrW(0xE917), ChrW(0xE918), 10, 10, 180) _PasswordInput_GUICtrlsCreate($idInputB, $idEyeShwnB, $idEyeHddnB, $bHideB, ChrW(0xE9CE), ChrW(0xE9D1), 10, 35, 180) _PasswordInput_GUICtrlsCreate($idInputC, $idEyeShwnC, $idEyeHddnC, $bHideC, ChrW(0xE919), ChrW(0xE91C), 10, 60, 180) GUICtrlSetColor($idEyeHddnC, 0x888888) Local $iDefaultPasswordChar = _SendMessage(GUICtrlGetHandle($idInputC), $EM_GETPASSWORDCHAR) Local $idAccelButtonEnter = GUICtrlCreateDummy() Local $aAccelKeys[1][2] = [["{ENTER}", $idAccelButtonEnter]] GUISetAccelerators($aAccelKeys, $hGui) GUISetState(@SW_SHOW) While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUISetAccelerators("", $hGui) ; unset all accelerators for the specified winhandle. GUIDelete($hGui) ;~ _WinAPI_RemoveFontMemResourceEx($g__hEyeSlashsFontHandle) ; To remove the fonts that were installed, however when the process goes away, the system will unload the fonts. Return "" Case $idAccelButtonEnter ; ..clean up and return some data ? ;~ Local $hCtrl = _WinAPI_GetFocus(), $sCtrl = ControlGetText($hCtrl, "", 0) ;~ GUISetAccelerators("", $hGui) ; unset all accelerators for the specified winhandle. ;~ GUIDelete($hGui) ;~ Return SetExtended($hCtrl, $sCtrl) ConsoleWrite('- >' & ControlGetText(_WinAPI_GetFocus(), "", 0) & '<' & @CRLF) ;~ Send("{TAB}") ; ..to jump to the next field of this example Case $idEyeShwnA ;, $idEyeHddnA _PasswordInput_Clicked($bHideA, $idEyeHddnA, $idInputA, $iDefaultPasswordChar) Case $idEyeShwnB ;, $idEyeHddnB _PasswordInput_Clicked($bHideB, $idEyeHddnB, $idInputB, $iDefaultPasswordChar) Case $idEyeShwnC ;, $idEyeHddnC _PasswordInput_Clicked($bHideC, $idEyeHddnC, $idInputC, $iDefaultPasswordChar) EndSwitch WEnd EndFunc ;==>Example Func _PasswordInput_Clicked(ByRef $bHide, $idEyeHidden, $idInput, $iDefaultPasswordChar) $__PasswordInput_PressedEnter_hTimer = TimerInit() ; for _PasswordInput_OnEnter_Delayed() $bHide = Not $bHide GUICtrlSetState($idEyeHidden, $bHide ? $GUI_SHOW : $GUI_HIDE) GUICtrlSendMsg($idInput, $EM_SETPASSWORDCHAR, $bHide ? $iDefaultPasswordChar : 0, 0) _WinAPI_RedrawWindow(GUICtrlGetHandle($idInput)) EndFunc ;==>_PasswordInput_Clicked Func _PasswordInput_GUICtrlsCreate(ByRef $idInput, ByRef $idEyeShown, ByRef $idEyeHidden, ByRef $bHide, $sCharShown, $sCharHidden, $iLeft, $iTop, $iWidth, $iHeight = 19, $iLabelFontSize = 13) GUICtrlCreateLabel("", $iLeft, $iTop, $iWidth, $iHeight, $SS_BLACKFRAME) ; makes the border GUICtrlSetState(-1, $GUI_DISABLE) ; makes the above Label unclickable $idInput = GUICtrlCreateInput("", $iLeft + 3, $iTop + 1, $iWidth - $iHeight - 5, $iHeight - 2, BitOR($GUI_SS_DEFAULT_INPUT, $ES_PASSWORD), $WS_EX_TOOLWINDOW) GUICtrlSetBkColor(-1, _WinAPI_SwitchColor(_WinAPI_GetSysColor($COLOR_BTNFACE))) ; Match the GUI's color. This fake control has a "border" afterall. $idEyeShown = GUICtrlCreateLabel($sCharShown, $iLeft + $iWidth - $iHeight, $iTop + 1, $iHeight - 2, $iHeight - 2) GUICtrlSetFont(-1, $iLabelFontSize, $FW_NORMAL, $GUI_FONTNORMAL, $g__sEyeSlashsFontname) $idEyeHidden = GUICtrlCreateLabel($sCharHidden, $iLeft + $iWidth - $iHeight, $iTop + 1, $iHeight - 2, $iHeight - 2) GUICtrlSetFont(-1, $iLabelFontSize, $FW_NORMAL, $GUI_FONTNORMAL, $g__sEyeSlashsFontname) $bHide = True EndFunc ;==>_PasswordInput_GUICtrlsCreate Func _LoadFont_EyeSlashs(ByRef $sFontname) Local $hFont = 0, $tFont, $bFont = _bEyeSlashsFontFile() If Not @error Then $sFontname = "EyeSlashs" $tFont = DllStructCreate('byte[' & BinaryLen($bFont) & ']') DllStructSetData($tFont, 1, $bFont) $bFont = "" ; $bFont is in $tFont ; it can be cleared $hFont = _WinAPI_AddFontMemResourceEx(DllStructGetPtr($tFont), DllStructGetSize($tFont)) $tFont = "" ; the system has made its own copy of the memory ; it can be cleared EndIf Return SetError(@error, @extended, $hFont) EndFunc ;==>_LoadFont_EyeSlashs ;Code below was generated by: 'File to Base64 String' Code Generator v1.20 Build 2020-06-05 Func _bEyeSlashsFontFile() Local $Base64String ; https://www.autoitscript.com/forum/index.php?showtopic=211400&view=findpost&p=1529608 $Base64String &= 'i7YAAAEAAAALAIAAAAMAME9TLzJQDxIGwgCIvAAYYABjbWFw/7e9VRAAAAEcADxkZ2FUc3AAHBAAPIAAHAgAZ2x5ZjOIDLQBAB6IAAAHAGhlwGFkJtgdjQA0AB4IADZoACAHwgPNBQAewAAeJGhtdHgWJgAQAB7kAAgwbG8AY2EICAYgAAAECRQADxptYXhwUAASAGkADzAADyAAbmFtZaOXdusFAA9QAGOecG9zdBMApwAACvABHwADAwDHAZAABQAAAiiZAswAEY8DBwHrsAAzAQkCaAcAAQC2AQsAQAAA6dEDwOD/wABAA4ABgRGIDm+ASgAAgTaBARyADYMDA0GCEhwABABIgAMOQAAIAAIABoAJIADpGekc6dH//aT//4Mf6ReAB86CBwAB/+MW7RbrFo46hB6KS4AO/wAPgQsFgEQAgEQCAAA3OYcCE6UJgEz/wAPWgAkgDwAfAC8AEjIXABYVFAcGIyInACY1NDc2EzI3ADY1NCcmIyIHQAYVFBcWE4APFwIGgw8nNjc2AgCUNCYAADRDAVg/AAACWEMBnoCAODiAZICexAECK0YJQAH+BqrGCUABAhZYWJBckFgAAEEBwSUEwiXUAcAlBgAYAC0AP0VAJjOAHh0BJYIhMwgyNyfFKA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RilGFCcTEP6+BgYiE81FAQQBAcU5BwdNEBEx4wRDcSp0bTEAuPUACntfDzz1AAvjgCYAAOHcbLGEdABUFv8AhDFS9HMQARFx8wJQAB12/gyTAQMAYQPxAD8ANwACAAgKABTQHGoA0AEABgE8Ab4CVAKM3gNRj9EFDABnMR8j5AQNAA4ArjQIAQCrUYizAAIAknK0AANwAao8tAAEsACHtAAF8EcqG7QABnABV7QACgBIGgCisYMECRABEquQAbMAArAGebQAA3ABKkW0AASwAJC0AAUAqBYAJrQABnAB' $Base64String &= 'YLQAAAoANAC8RXllQFNsYXNoc6ADeQAAZQBTAGwAYQAAcwBoAHNWZQByc2lvbiAxLigwAFagAXJgAWkACG8AbpCRMQAuAB4wvwO2A68BpgFSZWdAdWxhcgBSYAFnNAB1ggFy/wL2AkZvAG50IGdlbmVyAGF0ZWQgYnkgAEljb01vb24uVABG0gh08AhnMANuRTIKYfAAZQBkMAFi1ZAEIBBtY1ACTTAAsQIOLtScDwAGAA==' $Base64String = _WinAPI_Base64Decode($Base64String) If @error Then Return SetError(1, 0, 0) Local $tDecompress, $tSource = DllStructCreate('byte[' & BinaryLen($Base64String) & ']') DllStructSetData($tSource, 1, $Base64String) _WinAPI_LZNTDecompress($tSource, $tDecompress, 2832) If @error Then Return SetError(3, 0, 0) $tSource = 0 Return Binary(DllStructGetData($tDecompress, 1)) EndFunc ;==>_bEyeSlashsFontFile Func _WinAPI_Base64Decode($sB64String) Local $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "ptr", 0, "dword*", 0, "ptr", 0, "ptr", 0) If @error Or Not $aCrypt[0] Then Return SetError(1, 0, "") Local $bBuffer = DllStructCreate("byte[" & $aCrypt[5] & "]") $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "struct*", $bBuffer, "dword*", $aCrypt[5], "ptr", 0, "ptr", 0) If @error Or Not $aCrypt[0] Then Return SetError(2, 0, "") Return DllStructGetData($bBuffer, 1) EndFunc ;==>_WinAPI_Base64Decode Func _WinAPI_LZNTDecompress(ByRef $tInput, ByRef $tOutput, $iBufferSize) $tOutput = DllStructCreate("byte[" & $iBufferSize & "]") If @error Then Return SetError(1, 0, 0) Local $aRet = DllCall("ntdll.dll", "uint", "RtlDecompressBuffer", "ushort", 0x0002, "struct*", $tOutput, "ulong", $iBufferSize, "struct*", $tInput, "ulong", DllStructGetSize($tInput), "ulong*", 0) If @error Then Return SetError(2, 0, 0) If $aRet[0] Then Return SetError(3, $aRet[0], 0) Return $aRet[6] EndFunc ;==>_WinAPI_LZNTDecompress On my alternate windows theme(s) it looks like these:
    1 point
×
×
  • Create New...