Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/17/2023 in all areas

  1. Version v2.2.0

    1,417 downloads

    Encryption / Decryption / Hashing / Signing Purpose Cryptography API: Next Generation (CNG) is Microsoft's long-term replacement for their CryptoAPI. Microsoft's CNG is designed to be extensible at many levels and cryptography agnostic in behavior. Although the Crypt.au3 UDF lib that is installed with AutoIt3 still works well, the advapi32.dll functions that it uses have been deprecated. In addition the Crypt.au3 UDF lib, as it is currently written, has a very limited ability to decrypt AES data that was not encrypted using Crypt.au3 functions. That is because Crypt.au3 functions do not allow you to specify an actual key or initialization vector (IV). It only lets you specify data to be used to derive a key and uses a static IV. This UDF was created to offer a replacement for the deprecated functions used by Crypt.au3. According to Microsoft, deprecated functions may be removed in future release. It was also created to allow more flexibility and functionality in encryption/decryption/hashing/signing and to expand the ability for users to implement cryptography in their scripts. Description This UDF implements some of Microsoft's Cryptography API: Next Generation (CNG) Win32 API functions. It implements functions to encrypt/decrypt text and files, generate hashes, derive keys using Password-Based Key Derivation Function 2 (PBKDF2), create and verify signatures, and has several cryptography-related helper functions. The UDF can implement any encryption/decryption algorithms and hashing algorithms that are supported by the installed cryptography providers on the PC in which it is running. Most, if not all, of the "magic number" values that you would commonly use to specify that desired algorithms, key bit lengths, and other magic number type values, are already defined as constants or enums in the UDF file. To flatten the learning curve, there is an example file that shows examples of all of the major functionality. This example file is not created to be an exhaustive set of how to implement each feature and parameter. It is designed to give you a template or guide to help you hit the ground running in terms of using the functions. I have tried to fully document the headers of all of the functions as well as the code within the functions themselves. As of v1.4.0, there is also a Help file that includes all of the functions, with examples. Current UDF Functions Algorithm-Specific Symmetric Encryption/Decryption Functions _CryptoNG_AES_CBC_EncryptData _CryptoNG_AES_CBC_DecryptData _CryptoNG_AES_CBC_EncryptFile _CryptoNG_AES_CBC_DecryptFile _CryptoNG_AES_ECB_EncryptData _CryptoNG_AES_ECB_DecryptData _CryptoNG_AES_GCM_EncryptData _CryptoNG_AES_GCM_DecryptData _CryptoNG_3DES_CBC_EncryptData _CryptoNG_3DES_CBC_DecryptData _CryptoNG_3DES_CBC_EncryptFile _CryptoNG_3DES_CBC_DecryptFile Generic Symmetric Encryption/Decryption Functions _CryptoNG_EncryptData _CryptoNG_DecryptData _CryptoNG_EncryptFile _CryptoNG_DecryptFile Hashing Functions _CryptoNG_HashData _CryptoNG_HashFile _CryptoNG_PBKDF2 Asymmetric (Public/Private Key) Cryptography Functions _CryptoNG_ECDSA_CreateKeyPair _CryptoNG_ECDSA_SignHash _CryptoNG_ECDSA_VerifySignature _CryptoNG_RSA_CreateKeyPair _CryptoNG_RSA_EncryptData _CryptoNG_RSA_DecryptData _CryptoNG_RSA_SignHash _CryptoNG_RSA_VerifySignature Misc / Helper Functions _CryptoNG_CryptBinaryToString _CryptoNG_CryptStringToBinary _CryptoNG_GenerateRandom _CryptoNG_EnumAlgorithms _CryptoNG_EnumRegisteredProviders _CryptoNG_EnumKeyStorageProviders _CryptoNG_LastErrorMessage _CryptoNG_Version Related Links Cryptography API: Next Generation - Main Page Cryptography API: Next Generation - Reference Cryptography API: Next Generation - Primitives Cryptography API: Next Generation - Cryptographic Algorithm Providers
    1 point
  2. #include <String.au3> $data = FileRead(@ScriptDir & "\Tel (1).txt") $data = _StringBetween($data, "", "!") $data[0] &= "!" ; <<<< this changed ;~ ConsoleWrite('>' & $data[0] & '<' & @CRLF) ConsoleWrite('>>>' & _Crc16($data[0]) & ' = !F7F2' & @CRLF) ; ======================================================= ; Function _Crc16 ; Purpose: Return the crc16 checksum of the input value ; Author: 'roby' at http://www.autoitscript.com/forum ; ======================================================= Func _Crc16($value) $value = Binary($value) Local $crc = 0xFFFF Local $table[256] = [ _ 0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241, _ 0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440, _ 0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40, _ 0x0A00, 0xCAC1, 0xCB81, 0x0B40, 0xC901, 0x09C0, 0x0880, 0xC841, _ 0xD801, 0x18C0, 0x1980, 0xD941, 0x1B00, 0xDBC1, 0xDA81, 0x1A40, _ 0x1E00, 0xDEC1, 0xDF81, 0x1F40, 0xDD01, 0x1DC0, 0x1C80, 0xDC41, _ 0x1400, 0xD4C1, 0xD581, 0x1540, 0xD701, 0x17C0, 0x1680, 0xD641, _ 0xD201, 0x12C0, 0x1380, 0xD341, 0x1100, 0xD1C1, 0xD081, 0x1040, _ 0xF001, 0x30C0, 0x3180, 0xF141, 0x3300, 0xF3C1, 0xF281, 0x3240, _ 0x3600, 0xF6C1, 0xF781, 0x3740, 0xF501, 0x35C0, 0x3480, 0xF441, _ 0x3C00, 0xFCC1, 0xFD81, 0x3D40, 0xFF01, 0x3FC0, 0x3E80, 0xFE41, _ 0xFA01, 0x3AC0, 0x3B80, 0xFB41, 0x3900, 0xF9C1, 0xF881, 0x3840, _ 0x2800, 0xE8C1, 0xE981, 0x2940, 0xEB01, 0x2BC0, 0x2A80, 0xEA41, _ 0xEE01, 0x2EC0, 0x2F80, 0xEF41, 0x2D00, 0xEDC1, 0xEC81, 0x2C40, _ 0xE401, 0x24C0, 0x2580, 0xE541, 0x2700, 0xE7C1, 0xE681, 0x2640, _ 0x2200, 0xE2C1, 0xE381, 0x2340, 0xE101, 0x21C0, 0x2080, 0xE041, _ 0xA001, 0x60C0, 0x6180, 0xA141, 0x6300, 0xA3C1, 0xA281, 0x6240, _ 0x6600, 0xA6C1, 0xA781, 0x6740, 0xA501, 0x65C0, 0x6480, 0xA441, _ 0x6C00, 0xACC1, 0xAD81, 0x6D40, 0xAF01, 0x6FC0, 0x6E80, 0xAE41, _ 0xAA01, 0x6AC0, 0x6B80, 0xAB41, 0x6900, 0xA9C1, 0xA881, 0x6840, _ 0x7800, 0xB8C1, 0xB981, 0x7940, 0xBB01, 0x7BC0, 0x7A80, 0xBA41, _ 0xBE01, 0x7EC0, 0x7F80, 0xBF41, 0x7D00, 0xBDC1, 0xBC81, 0x7C40, _ 0xB401, 0x74C0, 0x7580, 0xB541, 0x7700, 0xB7C1, 0xB681, 0x7640, _ 0x7200, 0xB2C1, 0xB381, 0x7340, 0xB101, 0x71C0, 0x7080, 0xB041, _ 0x5000, 0x90C1, 0x9181, 0x5140, 0x9301, 0x53C0, 0x5280, 0x9241, _ 0x9601, 0x56C0, 0x5780, 0x9741, 0x5500, 0x95C1, 0x9481, 0x5440, _ 0x9C01, 0x5CC0, 0x5D80, 0x9D41, 0x5F00, 0x9FC1, 0x9E81, 0x5E40, _ 0x5A00, 0x9AC1, 0x9B81, 0x5B40, 0x9901, 0x59C0, 0x5880, 0x9841, _ 0x8801, 0x48C0, 0x4980, 0x8941, 0x4B00, 0x8BC1, 0x8A81, 0x4A40, _ 0x4E00, 0x8EC1, 0x8F81, 0x4F40, 0x8D01, 0x4DC0, 0x4C80, 0x8C41, _ 0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641, _ 0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040 ] $crc = 0 ; <<<< this changed For $i = 1 To BinaryLen($value) $crc = BitXOR(BitShift($crc, 8), $table[BitAND(BitXOR($crc, BinaryMid($value, $i, 1)), 0xFF)]) Next Return Hex($crc, 4) EndFunc ;==>_Crc16
    1 point
  3. put on top of your script #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 ;-w 5 -w 6 -w 7 at least until comment ; he will point out mistakes like this MsgBox($MB_SYSTEMMODAL, "Information", _GUICtrlEdit_GetLine($Edit1, 0))) or this global $line1 = _GUICtrlEdit_GetLine($Edit1, 0))
    1 point
  4. Yes, I have to confirm that the forum editor CKEditor is changing the content to spaces instead of TABs. This is quite usual I guess, because it's web content at the end and without specific tags, such characters will be replaced by &nbsp; (I would expect). So I believe, if the author of a post use TABs in a code block of the forum editor, TABs will be lost for everyone 😔 . Best regards Sven Tests with different code, quote, spoiler and combinations of them: this is a test this is a test this is a test <pre> this is a test </pre>
    1 point
  5. here is my approach with out RegEx. Also from yesterday #include <MsgBoxConstants.au3> #include <StringConstants.au3> #include <FileConstants.au3> _FixIt(@ScriptDir & "\OutputData.dat") ;---------------------------------------------------------------------------------------- Func _FixIt($FilePath) ;Read the current script file into an array using the filepath. Local $aArray = FileReadToArray($FilePath) Local $iLineCount = @extended Local $NewTxt, $sTmp, $aSpl If @error Then ;If An error occurred reading the current script file Then Exit MsgBox($MB_SYSTEMMODAL, "", "There was an error reading the file. @error: " & @error) Exit Else $NewTxt = "" ; For $i = 0 To $iLineCount - 1 If $i < 2 Then ;ignore 2 first line $NewTxt &= $aArray[$i] & @CRLF ContinueLoop EndIf $aSpl = StringSplit($aArray[$i], @TAB, 1) ;Splits line into tab substrings $sTmp = "" For $x = 2 To $aSpl[0] ;skip first tab $sTmp = StringStripWS($aSpl[$x], $STR_STRIPALL) If $sTmp = 0 Or $sTmp = "" Then ;If tab = 0 Or "" Then go next line ConsoleWrite("--> Empty line: " & $i & @CRLF) ContinueLoop 2 EndIf Next $NewTxt &= $aArray[$i] & @CRLF ;add line to $NewTxt Next ;rename the old FileMove($FilePath, $FilePath & ".old", $FC_OVERWRITE + $FC_CREATEPATH) ;make new _SaveFile($FilePath, $NewTxt) EndIf EndFunc ;==>_FixIt ;---------------------------------------------------------------------------------------- Func _SaveFile($sFile, $sData, $iFormat = 266) ; 256+8+2 Local $hFileOpen = FileOpen($sFile, $iFormat) If $hFileOpen = -1 Then Return SetError(1, 0, "") EndIf Local $msg = FileWrite($hFileOpen, $sData) FileClose($hFileOpen) Return $msg EndFunc ;==>_SaveFile ;----------------------------------------------------------------------------------------
    1 point
  6. Okay, to hopefully complete this @SoftWearInGinEar, here is one approach/solution to handle your requirements: #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #AutoIt3Wrapper_AU3Check_Stop_OnWarning=y #AutoIt3Wrapper_Run_Au3Stripper=y #AutoIt3Wrapper_UseUpx=n #Au3Stripper_Parameters=/sf /sv /mo /rm /rsln #include-once #include <Array.au3> _Actions() Func _Actions() Local Const $sSourceFile = @ScriptDir & '\OutputData.dat' Local Const $sDestinationFile = @ScriptDir & '\OutputData2.dat' Local Const $aListOfLines = FileReadToArray($sSourceFile) Local Const $aNewList = _RemoveInvalidLines($aListOfLines) Local Const $sNewFileContent = _ArrayToString($aNewList, @CRLF) _WriteFile($sDestinationFile, $sNewFileContent) EndFunc Func _RemoveInvalidLines($aListOfLines) Local Const $iLastLine = UBound($aListOfLines) - 1 Local Const $iFirstLine = 2 For $i = $iLastLine To $iFirstLine Step -1 If Not _IsLineInvalid($aListOfLines[$i]) Then ContinueLoop EndIf _ArrayDelete($aListOfLines, $i) ; remove the invalid line from the list (array) Next Return $aListOfLines EndFunc Func _IsLineInvalid($sLine) Local Const $sRegExPattern = '(?m)^0\t|^\t|(?<=\t)0(?=\t)|\t0$|\t$|\t\t' Return StringRegExp($sLine, $sRegExPattern) ; if pattern matches, then yes - invalid line EndFunc Func _WriteFile($sFile, $sText) Local Const $iUtf8WithoutBomAndOverwriteCreationMode = 256 + 2 + 8 Local $hFile = FileOpen($sFile, $iUtf8WithoutBomAndOverwriteCreationMode) FileWrite($hFile, $sText) FileClose($hFile) EndFunc Hint: I already prepared this yesterday because it was pretty fun to interact with @pixelsearch on the RegEx topic. I wanted to fulfill your request and hope that's it is what you're looking for 🤞 . Best regards Sven
    1 point
  7. Hi, thanks for the advice, I had a look and it seems really cool, I'll try this method, I thank you for your time Marco
    1 point
  8. Hi @MarcoMonte, this totally depends on you, your experience and your interest which way do you want and prefer. I personal would say, in case of AutoIt you should go with au3WebDriver (WebDriver) for browser automation. See this related post of mine. You could also go with IUIAutomation for browser automation. You could even use other common frameworks that are not related to AutoIt, like Selenium, Playwright, WebdriverIO and so one. What is the "easier way" for you? Tell us a bit more about your experience etc., then the suggestions would be more precise 🤝 . Best regards Sven
    1 point
  9. ioa747

    SciTE PlusBar

    CollorSX.au3 ShareX.exe -ColorPicker for those who don't know ! ShareX is a free and open source program - Screen capture, file sharing and productivity tool ColorPicker It is a separate tool of his where you can call it with ShareX.exe -ColorPicker I use it Regularly, so I said to order in AutoIt services if you choose a color by double-clicking in scite on the hex color , you can then use get Get to get it, to see the color, or use Set to set it, change it with <-- button insert color name as comment, at the cursor position ; https://www.autoitscript.com/forum/topic/208404-scite-plusbar/page/2/?tab=comments#comment-1515180 ;------------------------------------------------------------------------------ ; Title...........: CollorSX.au3 ; Description.....: ShareX.exe -ColorPicker ;------------------------------------------------------------------------------ #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=..\ICO\CollorSX.ico #AutoIt3Wrapper_Res_Description=ShareX.exe -ColorPicker #AutoIt3Wrapper_Res_Fileversion=0.0.0.10 #AutoIt3Wrapper_Res_ProductName=CollorSX.au3 #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <WindowsConstants.au3> #include <SendMessage.au3> #include <AutoItConstants.au3> #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <StringConstants.au3> Global $ClipBack, $ClipData, $hSciTE, $hCtrlHnd, $hShareX, $ShareX_Pos, $iState, $ColorName Global $hGhostGUI, $idButtonGet, $idButtonSet, $idColorName, $idButtonCopyTxt, $ActStatus, $TmpStatus, $HexColor If Not WinExists("[CLASS:SciTEWindow]") Then Exit EndIf ; copy selected text from SciTE $ClipBack = ClipGet() ; backup clip data $hSciTE = WinActivate("[CLASS:SciTEWindow]") $hCtrlHnd = ControlGetFocus($hSciTE) $hCtrlHnd = ControlGetHandle($hSciTE, '', $hCtrlHnd) _SendMessage($hCtrlHnd, $WM_COPY) $ClipData = ClipGet() LoadShareX("C:\Program Files\ShareX\ShareX.exe") $hShareX = WinWait("ShareX - Color picker") WinActivate($hShareX) ControlClick($hShareX, "", "[NAME:btnClipboardColorPicker]") $ColorName = ControlGetText($hShareX, "", "[NAME:lblNameValue]") $ShareX_Pos = WinGetPos($hShareX) ; get the ShareX win color $HexColor = PixelGetColor($ShareX_Pos[0] + 550, $ShareX_Pos[1] + 50) $HexColor = "0x" & Hex($HexColor, 6) ClipPut($ClipBack) ; Restore backup clip data ; Set the ShareX window as being ontop ConsoleWrite("$WinOnTop=" & WinSetOnTop($hShareX, "", $WINDOWS_ONTOP) & @CRLF) $hGhostGUI = GUICreate('GhostGUI', 210, 43, $ShareX_Pos[0] + 475, $ShareX_Pos[1] + 320, $WS_POPUP, $WS_EX_TOOLWINDOW, $hShareX) GUISetBkColor($HexColor) $idColorName = GUICtrlCreateEdit($ColorName, 3, 1, 180, 19, $ES_CENTER) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor(-1, 0x272727) $idButtonCopyTxt = GUICtrlCreateButton("<--", 183, 0, 24, 21) $idButtonGet = GUICtrlCreateButton("Get", 3, 23, 100, 20) $idButtonSet = GUICtrlCreateButton("Set", 107, 23, 100, 20) ; Display the GUI. GUISetState(@SW_SHOW, $hGhostGUI) WinActivate($hShareX) ;Yellow 0xFFFF00 ;Gray 0x7E7E7E ;Goldenrod 0xE39024 ;Lawn green 0x75DC19 ;Dark slate gray 0x063549 ;********************************************************************* While WinExists($hShareX) If Not WinExists($hSciTE) Then Exit EndIf ; Retrieve the state of the ShareX window $iState = WinGetState($hShareX) Switch $iState Case 7, 15 $ActStatus = @SW_SHOW Case 5, 23 $ActStatus = @SW_HIDE EndSwitch If $ActStatus <> $TmpStatus Then ;ConsoleWrite("$iState=" & $iState & @CRLF) GUISetState($ActStatus, $hGhostGUI) $TmpStatus = $ActStatus If $ActStatus = @SW_SHOW Then WinActivate($hShareX) $HexColor = "0x" & ControlGetText($hShareX, "", "[NAME:txtHex]") $ColorName = ControlGetText($hShareX, "", "[NAME:lblNameValue]") ConsoleWrite("# " & $HexColor & " ; " & $ColorName & @CRLF) GUICtrlSetData($idColorName, $ColorName) EndIf EndIf If WinActive($hShareX) Then $ShareX_Pos = WinGetPos($hShareX) WinMove($hGhostGUI, "", $ShareX_Pos[0] + 475, $ShareX_Pos[1] + 320) $ColorName = ControlGetText($hShareX, "", "[NAME:lblNameValue]") If $ColorName <> GUICtrlRead($idColorName) Then GUICtrlSetData($idColorName, $ColorName) EndIf EndIf Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idButtonCopyTxt $ClipBack = ClipGet() ; backup clip data ClipPut(";" & GUICtrlRead($idColorName)) WinActivate($hSciTE) _SendMessage($hCtrlHnd, $WM_PASTE) Global $SpaceCnt = 2 StringReplace(ClipGet(), " ", " ", 0, $STR_CASESENSE) If @extended >= 1 Then $SpaceCnt += @extended EndIf Send("+^{LEFT " & $SpaceCnt & "}") ClipPut($ClipBack) ; Restore backup clip data Case $idButtonGet $ClipBack = ClipGet() ; backup clip data _SendMessage($hCtrlHnd, $WM_COPY) ControlClick($hShareX, "", "[NAME:btnClipboardColorPicker]") $HexColor = "0x" & ControlGetText($hShareX, "", "[NAME:txtHex]") $ColorName = ControlGetText($hShareX, "", "[NAME:lblNameValue]") ConsoleWrite("- Get " & $HexColor & " ; " & $ColorName & @CRLF) GUICtrlSetData($idColorName, $ColorName) ClipPut($ClipBack) ; Restore backup clip data Case $idButtonSet $ClipBack = ClipGet() ; backup clip data $HexColor = "0x" & ControlGetText($hShareX, "", "[NAME:txtHex]") $ColorName = ControlGetText($hShareX, "", "[NAME:lblNameValue]") ClipPut($HexColor) WinActivate($hSciTE) _SendMessage($hCtrlHnd, $WM_PASTE) Send("+^{LEFT}") ConsoleWrite("+ Set " & $HexColor & " ; " & $ColorName & @CRLF) GUICtrlSetData($idColorName, $ColorName) ClipPut($ClipBack) ; Restore backup clip data EndSwitch Sleep(10) WEnd ;********************************************************************* Exit ;---------------------------------------------------------------------------------------- Func LoadShareX($sFullPath) If Not WinExists("ShareX - Color picker") Then If Not FileExists($sFullPath) Then $sFullPath = @ScriptDir & "\ShareX.exe" If Not FileExists($sFullPath) Then $sFullPath = @ScriptDir & "\ShareX\ShareX.exe" If Not FileExists($sFullPath) Then Exit MsgBox(262144, StringTrimRight(@ScriptName, 4), "Kindly tell the script where to find ShareX.exe, bye now.", 10) Run('"' & $sFullPath & '" -ColorPicker') EndIf EndFunc ;==>LoadShareX it will definitely be included in the SciTE PusBar I am attaching the icon as well CollorSX.ico Back to first post
    1 point
  10. Gianni

    Writing hand

    This simple code snippet simulates a writing hand as you type into any input field (hand follows caret) P.S. I don't know what it's for, but I'll post it anyway. .... One possible use would be to draw attention to a message. (such as what I posted here: https://www.autoitscript.com/forum/topic/209396-3202-sraey-wen-yppah/?do=findComment&comment=1510993) Have fun #include <GUIConstants.au3> #include <GDIPlus.au3> Global $iWidth = 100, $iHeight = 70, $iPosX = -1, $iPosY = -1, $aCaretPos, $msg Global $iHandMoves = 2, $iAmplitude = 5, $iHideHidleDelay = 1000, $iFlag = True, $iTimer Global Const $hGUI = GUICreate('', $iWidth, $iHeight, $iPosX, $iPosY, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_NOACTIVATE)) Global Const $idLogo = GUICtrlCreatePic("", 0, 0, $iWidth, $iHeight) _GDIPlus_Startup() Global $Bmp_Logo = _GDIPlus_BitmapCreateFromMemory(_WritingHand(), True) _WinAPI_DeleteObject(GUICtrlSendMsg($idLogo, $STM_SETIMAGE, $IMAGE_BITMAP, $Bmp_Logo)) $Bmp_Logo = '' _GDIPlus_Shutdown() While True $aCaretPos = _WinGetCaretPos() If @extended Then $iTimer = TimerInit() $iFlag = True If Not @error Then GUISetState(@SW_SHOWNOACTIVATE, $hGUI) _MoveHand($aCaretPos) EndIf EndIf If $iFlag And (TimerDiff($iTimer) > $iHideHidleDelay) Then GUISetState(@SW_HIDE, $hGUI) $iFlag = False EndIf Sleep(250) WEnd Func _MoveHand($aCaretPos) For $i = 1 To $iHandMoves WinMove($hGUI, '', $aCaretPos[0] + Random(-$iAmplitude, $iAmplitude, 1), $aCaretPos[1] + Random(-$iAmplitude, $iAmplitude, 1), Default, Default, 1) Next WinMove($hGUI, '', $aCaretPos[0], $aCaretPos[1]) EndFunc ;==>_MoveHand ; A more reliable method to retrieve the caret coordinates in MDI Func _WinGetCaretPos() Local Static $iXAdjust = -5, $iYAdjust = -5, $aPrevPos[2] = [0, 0] Local $iOpt = Opt("CaretCoordMode", 0) ; Set "CaretCoordMode" to relative mode and store the previous option. Local $aGetCaretPos = WinGetCaretPos() ; Retrieve the relative caret coordinates. Local $aGetPos = WinGetPos("[ACTIVE]") ; Retrieve the position as well as height and width of the active window. Local $sControl = ControlGetFocus("[ACTIVE]") ; Retrieve the control name that has keyboard focus. Local $aControlPos = ControlGetPos("[ACTIVE]", "", $sControl) ; Retrieve the position as well as the size of the control. $iOpt = Opt("CaretCoordMode", $iOpt) ; Reset "CaretCoordMode" to the previous option. Local $aReturn[2] = [0, 0] ; Create an array to store the x, y position. If IsArray($aGetCaretPos) And IsArray($aGetPos) And IsArray($aControlPos) Then $aReturn[0] = $aGetCaretPos[0] + $aGetPos[0] + $aControlPos[0] + $iXAdjust $aReturn[1] = $aGetCaretPos[1] + $aGetPos[1] + $aControlPos[1] + $iYAdjust ; Check if caret has moved If ($aReturn[0] <> $aPrevPos[0]) Or ($aReturn[1] <> $aPrevPos[1]) Then $aPrevPos[0] = $aReturn[0] $aPrevPos[1] = $aReturn[1] SetError(0, 1) ; if caret has moved set @Extended EndIf Return $aReturn ; Return the array Else Return SetError(1, 0, $aReturn) ; Return the array and set @error to 1. EndIf EndFunc ;==>_WinGetCaretPos ;Code below was generated by: 'File to Base64 String' Code Generator v1.20 Build 2020-06-05 Func _WritingHand($bSaveBinary = False, $sSavePath = @ScriptDir) Local $WritingHand $WritingHand &= 'R0lGODlhZABGAHAAACH5BAEAAP8ALAAAAABkAEYAhwAAAAAAMwAAZgAAmQAAzAAA/wArAAArMwArZgArmQArzAAr/wBVAABVMwBVZ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ZyjKUpmGOevMEzcOqROi2RGfm6elZ/cRr0X42PfMMHzXfVJ8+sdhUm381Z3O5Vbjiyl/V5Mril4+95FkRGNDI55Z19c4qLhPaMH6Hvcl9in1NChb+xoaxJjEQe0maS08Mtz9EsWRlQWOZqcr2v4I8722J41/+ygS4g5VQIOir1VLY1UECzktPGpub/M7Xqrp80CrdkgT+/xL4pClF4kgvREkGHygxZcHvhhlbkalItcP51eqDimsW/OC1okV0iBG7KE0Vj0Y4vmGRixWU2+bMNCAXltCBMGFfnpzUrHlpbBFQAtwYO5Y1GbYEi5OQWAhZyMZaSMmNDdwa91oisSUN8IZSzI2kDMa8/6EPjvbzISPhxsU8Rik0JMTeMrRnFMp9UJMrU6EUwRglSfZpLs3LWs7k4pie8aIXF8NYHdHES/TocI+AggZnFKktltjSlhibIhg71CdTLRN4WSMl02qlpEYCEV4yIpiMPOnMWBJDe+mTi/3M+C4m1bGIm0uPqSyZPneUklh0sWYQiVi1RZRQGUtrxxLngoQoVPKiSGXq3w1feMksaUuDx2QSS87ZP6sk8ZusgiNMPmLLcgZUfPQi6DySlEF9Hcl+WHTixJbnrHvOMhmsoqYmbZkJq+ASaMpKouRQypm7geRIyUIlI/d3PZkqMWffVGkc4/jDivbCpwPRxzALFU6E1oWfxhQiFpEqOY5mSqjGPKU1AwIAOw==' Local $bString = _WinAPI_Base64Decode($WritingHand) If @error Then Return SetError(1, 0, 0) Return Binary($bString) EndFunc ;==>_WritingHand 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
    1 point
  11. Maybe _GUICtrlEdit_GetCueBanner ?
    1 point
  12. Jon

    AutoIt (Latest Stable Version)

    Version v3.3.16.1

    50,299 downloads

    This is the current stable version of AutoIt. What's new: Changelog. Main AutoIt download page (for AutoIt and other tools like the script editor).
    1 point
  13. Here is a small example (from @UEZ: #include <ButtonConstants.au3> #include <MsgBoxConstants.au3> #include <StructureConstants.au3> #include <WinAPIConstants.au3> #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> _GDIPlus_Startup() Global Const $SC_DRAGMOVE = 0xF012 Global $iW, $iH, $hImage, $hBitmap, $hGUI $hImage = _GDIPlus_BitmapCreateFromFile("C:\Program Files\AutoIt3\Examples\GUI\Torus.png") $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $iW = _GDIPlus_ImageGetWidth($hImage) $iH = _GDIPlus_ImageGetHeight($hImage) $hGUI = GUICreate("", $iW, $iH, -1, -1, $WS_POPUP, $WS_EX_LAYERED) GUISetState() _WinAPI_BitmapDisplayTransparentInGUI($hBitmap, $hGUI) GUIRegisterMsg($WM_LBUTTONDOWN, "_WM_LBUTTONDOWN") Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _WinAPI_DeleteObject($hBitmap) _GDIPlus_BitmapDispose($hImage) _GDIPlus_Shutdown() GUIDelete() Func _WinAPI_BitmapDisplayTransparentInGUI(ByRef $hHBitmap, ByRef $hGUI, $iOpacity = 0xFF, $bReleaseGDI = True) If Not BitAND(GUIGetStyle($hGUI)[1], $WS_EX_LAYERED) = $WS_EX_LAYERED Then Return SetError(1, 0, 0) Local $tDim = DllStructCreate($tagBITMAP) If Not _WinAPI_GetObject($hHBitmap, DllStructGetSize($tDim), DllStructGetPtr($tDim)) Then Return SetError(2, 0, 0) Local $tSize = DllStructCreate($tagSIZE), $tSource = DllStructCreate($tagPOINT), $tBlend = DllStructCreate($tagBLENDFUNCTION) Local Const $hScrDC = _WinAPI_GetDC(0), $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC), $hOld = _WinAPI_SelectObject($hMemDC, $hHBitmap) $tSize.X = $tDim.bmWidth $tSize.Y = $tDim.bmHeight $tBlend.Alpha = $iOpacity $tBlend.Format = 1 _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, DllStructGetPtr($tSize), $hMemDC, DllStructGetPtr($tSource), 0, DllStructGetPtr($tBlend), $ULW_ALPHA) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteDC($hMemDC) If $bReleaseGDI Then _WinAPI_DeleteObject($hHBitmap) Return True EndFunc Func _WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) _SendMessage($hGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndFunc ;==>_WM_LBUTTONDOWN Edit: after some changes (upgrades) you have to insert: #include <WinAPISysWin.au3> at top of script "#include section"
    1 point
×
×
  • Create New...