Leaderboard
Popular Content
Showing content with the highest reputation on 07/21/2025 in all areas
-
#Directive_If_Run
WildByDesign and one other reacted to Jos for a topic
Try the current beta v25.205.1420.11 of AutoIt3Wrapper. Added logic to strip the lines between #Autoit3Wrapper_If_* ---- #Autoit3Wrapper_(End)If(_*) that are not valid for the run and save the source to a temp file to process.2 points -
Helper App: #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Clipboard.au3> #include <File.au3> #include <Array.au3> #include <ListViewConstants.au3> ; ================================================================================================= ; Title .........: Files To Hex Generator ; Description ...: A tool to read multiple binary files and generate complete, formatted ; AutoIt functions containing the files' hex data with architecture detection. ; Supports both single and multiple file processing via GUI. ; Author(s) .....: Dao Van Trong - TRONG.PRO ; ================================================================================================= ; Global variables for GUI controls Global $g_hGUI, $g_hListView, $g_hEditOutput, $g_hInputChunkSize Global $g_aSelectedFiles[0][5] ; Array to store selected files info - FIXED: Initialize as 2D array Global $g_sGeneratedCode = "" ; Store the complete generated code ; Check if running in command line mode If $CmdLine[0] > 0 Then _ProcessCommandLine() Else _MainGUI() EndIf Func _ProcessCommandLine() Local $aFiles[0] ; Collect all valid files from command line arguments For $i = 1 To $CmdLine[0] If FileExists($CmdLine[$i]) Then _ArrayAdd($aFiles, $CmdLine[$i]) Else ConsoleWrite("Warning: File not found - " & $CmdLine[$i] & @CRLF) EndIf Next If UBound($aFiles) = 0 Then ConsoleWrite("Error: No valid files provided." & @CRLF) ConsoleWrite("Usage: " & @ScriptName & " <file1> [file2] [file3] ..." & @CRLF) Exit 1 EndIf Local $sOutputContent = "" Local $sOutputFile = "" If UBound($aFiles) = 1 Then ; Single file processing Local $sDrive, $sDir, $sFileName, $sExtension _PathSplit($aFiles[0], $sDrive, $sDir, $sFileName, $sExtension) $sOutputFile = $sDrive & $sDir & $sFileName & "_Embedded.au3" ConsoleWrite("Processing single file: " & $aFiles[0] & @CRLF) Local $sFuncName = _GenerateFunctionName($aFiles[0]) $sOutputContent = _GenerateHexFunction($aFiles[0], $sFuncName) If $sOutputContent = "" Then ConsoleWrite("Error: Failed to process file - " & $aFiles[0] & @CRLF) Exit 1 EndIf $sOutputContent &= _GenerateHelperFunction($sFuncName, $sFileName & $sExtension) Else ; Multiple files processing $sOutputFile = @ScriptDir & "\All_Embedded.au3" ConsoleWrite("Processing " & UBound($aFiles) & " files into: " & $sOutputFile & @CRLF) For $i = 0 To UBound($aFiles) - 1 ConsoleWrite(" Processing: " & $aFiles[$i] & @CRLF) Local $sFuncName = _GenerateFunctionName($aFiles[$i]) Local $sFuncContent = _GenerateHexFunction($aFiles[$i], $sFuncName) If $sFuncContent = "" Then ConsoleWrite(" Warning: Failed to process - " & $aFiles[$i] & @CRLF) ContinueLoop EndIf $sOutputContent &= $sFuncContent & @CRLF & @CRLF Next $sOutputContent &= _GenerateMasterHelperFunction($aFiles) EndIf ; Save the output file Local $hFile = FileOpen($sOutputFile, 2) If $hFile = -1 Then ConsoleWrite("Error: Could not create output file - " & $sOutputFile & @CRLF) Exit 1 EndIf FileWrite($hFile, $sOutputContent) FileClose($hFile) ConsoleWrite("Success: Output saved to - " & $sOutputFile & @CRLF) EndFunc ;==>_ProcessCommandLine Func _MainGUI() $g_hGUI = GUICreate("Files To Hex Generator by Dao Van Trong - TRONG.PRO", 800, 650) GUISetBkColor(0xF0F0F0) ; --- File Selection Section --- GUICtrlCreateLabel("1. File Selection:", 10, 15, 150, 20) GUICtrlSetFont(-1, 9, 600) Local $hBtnAddFiles = GUICtrlCreateButton("Add Files...", 10, 35, 100, 25) Local $hBtnRemoveSelected = GUICtrlCreateButton("Remove Selected", 120, 35, 120, 25) Local $hBtnClearAll = GUICtrlCreateButton("Clear All", 250, 35, 80, 25) ; ListView to display selected files $g_hListView = GUICtrlCreateListView("File Name|Size|Architecture|Function Name", 10, 70, 780, 150) GUICtrlSendMsg($g_hListView, $LVM_SETCOLUMNWIDTH, 0, 250) GUICtrlSendMsg($g_hListView, $LVM_SETCOLUMNWIDTH, 1, 100) GUICtrlSendMsg($g_hListView, $LVM_SETCOLUMNWIDTH, 2, 100) GUICtrlSendMsg($g_hListView, $LVM_SETCOLUMNWIDTH, 3, 320) ; --- Options Section --- GUICtrlCreateLabel("2. Generation Options:", 10, 235, 150, 20) GUICtrlSetFont(-1, 9, 600) GUICtrlCreateLabel("Line Length (chars):", 20, 260, 120, 20) $g_hInputChunkSize = GUICtrlCreateInput("4000", 150, 257, 100, 22) Local $hCheckAddHelpers = GUICtrlCreateCheckbox("Include helper functions", 270, 257, 150, 22) GUICtrlSetState($hCheckAddHelpers, $GUI_CHECKED) ; --- Generation Section --- Local $hBtnGenerate = GUICtrlCreateButton("3. Generate All Functions", 10, 290, 200, 35) GUICtrlSetFont(-1, 10, 700) GUICtrlSetBkColor(-1, 0x90EE90) Local $hBtnPreview = GUICtrlCreateButton("Preview Single", 220, 290, 100, 35) ; --- Output Section --- GUICtrlCreateLabel("Generated Code:", 10, 340, 150, 20) GUICtrlSetFont(-1, 9, 600) $g_hEditOutput = GUICtrlCreateEdit("", 10, 360, 780, 220, $WS_VSCROLL + $WS_HSCROLL) GUICtrlSetFont(-1, 9, 400, 0, "Consolas") ; --- Action Buttons --- Local $hBtnCopy = GUICtrlCreateButton("Copy to Clipboard", 10, 590, 130, 30) Local $hBtnSaveAll = GUICtrlCreateButton("Save All to File", 150, 590, 130, 30) Local $hBtnSaveSeparate = GUICtrlCreateButton("Save Separate Files", 290, 590, 130, 30) Local $hBtnExit = GUICtrlCreateButton("Exit", 660, 590, 130, 30) GUICtrlSetBkColor($hBtnExit, 0xFFB6C1) GUISetState(@SW_SHOW, $g_hGUI) ; --- GUI Event Loop --- While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $hBtnExit ExitLoop Case $hBtnAddFiles _HandleAddFiles() Case $hBtnRemoveSelected _HandleRemoveSelected() Case $hBtnClearAll _HandleClearAll() Case $hBtnGenerate _HandleGenerateAll($hCheckAddHelpers) Case $hBtnPreview _HandlePreviewSingle() Case $hBtnCopy _HandleCopyToClipboard() Case $hBtnSaveAll _HandleSaveAll($hCheckAddHelpers) Case $hBtnSaveSeparate _HandleSaveSeparate($hCheckAddHelpers) EndSwitch WEnd GUIDelete($g_hGUI) EndFunc ;==>_MainGUI Func _HandleAddFiles() Local $sFiles = FileOpenDialog("Select Files", @ScriptDir, "All Files (*.*)", 4) ; 4 = Multiple selection If @error Then Return Local $aNewFiles = StringSplit($sFiles, "|") If $aNewFiles[0] = 1 Then ; Single file selected _AddFileToList($aNewFiles[1]) Else ; Multiple files selected Local $sBasePath = $aNewFiles[1] For $i = 2 To $aNewFiles[0] Local $sFullPath = $sBasePath & "\" & $aNewFiles[$i] _AddFileToList($sFullPath) Next EndIf EndFunc ;==>_HandleAddFiles Func _AddFileToList($sFilePath) If Not FileExists($sFilePath) Then Return ; Check if file already exists in list For $i = 0 To UBound($g_aSelectedFiles) - 1 If UBound($g_aSelectedFiles, 1) > 0 And $g_aSelectedFiles[$i][0] = $sFilePath Then Return ; File already added Next ; Get file info Local $sFileName = _GetFileName($sFilePath) Local $iFileSize = FileGetSize($sFilePath) Local $sFileSize = _FormatFileSize($iFileSize) Local $sArchitecture = _DetectArchitecture($sFilePath) Local $sFuncName = _GenerateFunctionName($sFilePath) ; Add to array - FIXED: Use ReDim to resize and add new row Local $iCurrentSize = UBound($g_aSelectedFiles) ReDim $g_aSelectedFiles[$iCurrentSize + 1][5] $g_aSelectedFiles[$iCurrentSize][0] = $sFilePath $g_aSelectedFiles[$iCurrentSize][1] = $sFileName $g_aSelectedFiles[$iCurrentSize][2] = $sFileSize $g_aSelectedFiles[$iCurrentSize][3] = $sArchitecture $g_aSelectedFiles[$iCurrentSize][4] = $sFuncName ; Add to ListView Local $hItem = GUICtrlCreateListViewItem($sFileName & "|" & $sFileSize & "|" & $sArchitecture & "|" & $sFuncName, $g_hListView) EndFunc ;==>_AddFileToList Func _HandleRemoveSelected() Local $iSelected = GUICtrlSendMsg($g_hListView, $LVM_GETNEXTITEM, -1, $LVNI_SELECTED) If $iSelected = -1 Then Return ; No selection ; Remove from array - FIXED: Use proper 2D array deletion Local $iArraySize = UBound($g_aSelectedFiles) If $iSelected >= 0 And $iSelected < $iArraySize Then ; Shift elements down For $i = $iSelected To $iArraySize - 2 For $j = 0 To 4 $g_aSelectedFiles[$i][$j] = $g_aSelectedFiles[$i + 1][$j] Next Next ; Resize array ReDim $g_aSelectedFiles[$iArraySize - 1][5] EndIf ; Rebuild ListView _RefreshListView() EndFunc ;==>_HandleRemoveSelected Func _HandleClearAll() ReDim $g_aSelectedFiles[0][5] ; FIXED: Maintain 2D structure _RefreshListView() GUICtrlSetData($g_hEditOutput, "") $g_sGeneratedCode = "" EndFunc ;==>_HandleClearAll Func _RefreshListView() ; Clear ListView GUICtrlSendMsg($g_hListView, $LVM_DELETEALLITEMS, 0, 0) ; Repopulate ListView For $i = 0 To UBound($g_aSelectedFiles) - 1 If UBound($g_aSelectedFiles, 1) > 0 Then ; Check if array has elements Local $sData = $g_aSelectedFiles[$i][1] & "|" & $g_aSelectedFiles[$i][2] & "|" & $g_aSelectedFiles[$i][3] & "|" & $g_aSelectedFiles[$i][4] GUICtrlCreateListViewItem($sData, $g_hListView) EndIf Next EndFunc ;==>_RefreshListView Func _HandleGenerateAll($hCheckAddHelpers) If UBound($g_aSelectedFiles) = 0 Then MsgBox(48, "Warning", "Please add at least one file first.") Return EndIf Local $iChunkSize = Number(GUICtrlRead($g_hInputChunkSize)) If $iChunkSize <= 0 Then $iChunkSize = 4000 GUICtrlSetData($g_hEditOutput, "Generating code, please wait...") Sleep(100) Local $sOutput = "; Generated by Dao Van Trong - TRONG.PRO" & @CRLF $sOutput &= "; Total files: " & UBound($g_aSelectedFiles) & @CRLF $sOutput &= "; Generated on: " & @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & @CRLF & @CRLF ; Generate hex functions for all files For $i = 0 To UBound($g_aSelectedFiles) - 1 Local $sFilePath = $g_aSelectedFiles[$i][0] Local $sFuncName = $g_aSelectedFiles[$i][4] Local $sFuncCode = _GenerateHexFunction($sFilePath, $sFuncName, "$sHexData", $iChunkSize) If $sFuncCode <> "" Then $sOutput &= $sFuncCode & @CRLF & @CRLF EndIf Next ; Add helper functions if requested If GUICtrlRead($hCheckAddHelpers) = $GUI_CHECKED Then If UBound($g_aSelectedFiles) = 1 Then $sOutput &= _GenerateHelperFunction($g_aSelectedFiles[0][4], $g_aSelectedFiles[0][1]) Else $sOutput &= _GenerateMasterHelperFunctionFromArray($g_aSelectedFiles) EndIf EndIf $g_sGeneratedCode = $sOutput GUICtrlSetData($g_hEditOutput, $sOutput) EndFunc ;==>_HandleGenerateAll Func _HandlePreviewSingle() Local $iSelected = GUICtrlSendMsg($g_hListView, $LVM_GETNEXTITEM, -1, $LVNI_SELECTED) If $iSelected = -1 Then MsgBox(48, "Warning", "Please select a file from the list first.") Return EndIf If $iSelected >= UBound($g_aSelectedFiles) Then MsgBox(48, "Error", "Invalid selection.") Return EndIf Local $iChunkSize = _ValidateChunkSize(GUICtrlRead($g_hInputChunkSize)) ;If $iChunkSize <= 0 Then $iChunkSize = 4000 GUICtrlSetData($g_hEditOutput, "Generating preview, please wait...") Sleep(100) Local $sFilePath = $g_aSelectedFiles[$iSelected][0] Local $sFuncName = $g_aSelectedFiles[$iSelected][4] Local $sOutput = "; Preview for: " & $g_aSelectedFiles[$iSelected][1] & @CRLF $sOutput &= "; Architecture: " & $g_aSelectedFiles[$iSelected][3] & @CRLF & @CRLF $sOutput &= _GenerateHexFunction($sFilePath, $sFuncName, "$sHexData", $iChunkSize) GUICtrlSetData($g_hEditOutput, $sOutput) EndFunc ;==>_HandlePreviewSingle Func _ValidateChunkSize($iChunkSize) If $iChunkSize < 100 Or $iChunkSize > 4000 Then ;MsgBox(48, "Warning", "Chunk size need 100-4000 chars", 3) Return 4000 ; default EndIf Return $iChunkSize EndFunc ;==>_ValidateChunkSize Func _HandleCopyToClipboard() Local $sCode = GUICtrlRead($g_hEditOutput) If StringStripWS($sCode, 8) = "" Then MsgBox(48, "Warning", "No code to copy. Please generate code first.") Return EndIf _ClipBoard_SetData($sCode) ToolTip("Code copied to clipboard!", @DesktopWidth / 2, @DesktopHeight / 2, "Success", 1, 1) Sleep(1500) ToolTip("") EndFunc ;==>_HandleCopyToClipboard Func _HandleSaveAll($hCheckAddHelpers) If UBound($g_aSelectedFiles) = 0 Or $g_sGeneratedCode = "" Then MsgBox(48, "Warning", "No code to save. Please generate code first.") Return EndIf Local $sSaveFile = FileSaveDialog("Save Combined Code", @ScriptDir, "AutoIt Scripts (*.au3)", 16, "All_Embedded.au3") If @error Then Return Local $hFile = FileOpen($sSaveFile, 2) If $hFile = -1 Then MsgBox(16, "Error", "Could not create file: " & $sSaveFile) Return EndIf FileWrite($hFile, $g_sGeneratedCode) FileClose($hFile) MsgBox(64, "Success", "All functions saved to: " & @CRLF & $sSaveFile) EndFunc ;==>_HandleSaveAll Func _HandleSaveSeparate($hCheckAddHelpers) If UBound($g_aSelectedFiles) = 0 Then MsgBox(48, "Warning", "No files to process.") Return EndIf Local $sSaveDir = FileSelectFolder("Select folder to save separate files", @ScriptDir) If @error Then Return Local $iChunkSize = Number(GUICtrlRead($g_hInputChunkSize)) If $iChunkSize <= 0 Then $iChunkSize = 4000 Local $bAddHelpers = (GUICtrlRead($hCheckAddHelpers) = $GUI_CHECKED) Local $iSaved = 0 For $i = 0 To UBound($g_aSelectedFiles) - 1 Local $sFilePath = $g_aSelectedFiles[$i][0] Local $sFileName = $g_aSelectedFiles[$i][1] Local $sFuncName = $g_aSelectedFiles[$i][4] Local $sDrive, $sDir, $sNameOnly, $sExt _PathSplit($sFilePath, $sDrive, $sDir, $sNameOnly, $sExt) Local $sSaveFile = $sSaveDir & "\" & $sNameOnly & "_Embedded.au3" Local $sCode = "; Generated from: " & $sFileName & @CRLF $sCode &= "; Architecture: " & $g_aSelectedFiles[$i][3] & @CRLF & @CRLF $sCode &= _GenerateHexFunction($sFilePath, $sFuncName, "$sHexData", $iChunkSize) If $bAddHelpers Then $sCode &= _GenerateHelperFunction($sFuncName, $sFileName) EndIf Local $hFile = FileOpen($sSaveFile, 2) If $hFile <> -1 Then FileWrite($hFile, $sCode) FileClose($hFile) $iSaved += 1 EndIf Next MsgBox(64, "Success", "Saved " & $iSaved & " of " & UBound($g_aSelectedFiles) & " files to:" & @CRLF & $sSaveDir) EndFunc ;==>_HandleSaveSeparate Func _GenerateFunctionName($sFilePath) Local $sDrive, $sDir, $sFileName, $sExtension _PathSplit($sFilePath, $sDrive, $sDir, $sFileName, $sExtension) Local $sCleanName = _SanitizeName($sFileName) Local $sArch = _DetectArchitecture($sFilePath) Return "_GetBinData_" & $sCleanName & "_" & $sArch EndFunc ;==>_GenerateFunctionName ; ----------------------------------------------------------------------------- ; Function: _DetectArchitecture ; Purpose : Wrapper to call detailed PE architecture detection ; ----------------------------------------------------------------------------- Func _DetectArchitecture($sFilePath) Local $aInfo = _GetDetailedFileInfo($sFilePath) If Not @error Then Return $aInfo[2] EndIf Return "Unknown" EndFunc ;==>_DetectArchitecture ; ============================================================================= ; Function: _DetectArchitecture_File ; Purpose : Read PE headers to identify CPU architecture (x86, x64, ARM, etc.) ; ============================================================================= Func _DetectArchitecture_File($sFilePath) If Not FileExists($sFilePath) Then Return SetError(1, 0, "FILE_NOT_FOUND") EndIf Local $hFile = FileOpen($sFilePath, 16) ; binary mode If $hFile = -1 Then Return SetError(2, 0, "CANNOT_OPEN_FILE") EndIf ; Read DOS header Local $bDOSHeader = FileRead($hFile, 64) If @error Then FileClose($hFile) Return SetError(3, 0, "CANNOT_READ_DOS_HEADER") EndIf ; Validate "MZ" If BinaryMid($bDOSHeader, 1, 2) <> "0x4D5A" Then FileClose($hFile) Return SetError(4, 0, "INVALID_DOS_SIGNATURE") EndIf ; Get PE header offset Local $iPEOffset = _BinaryToInt(BinaryMid($bDOSHeader, 61, 4)) FileSetPos($hFile, $iPEOffset, 0) Local $bPESig = FileRead($hFile, 4) If @error Or $bPESig <> "0x50450000" Then FileClose($hFile) Return SetError(5, 0, "INVALID_PE_SIGNATURE") EndIf ; Read COFF header Local $bCOFF = FileRead($hFile, 20) Local $iMachine = _BinaryToInt(BinaryMid($bCOFF, 1, 2)) FileClose($hFile) Switch $iMachine Case 0x014c Return "x86" Case 0x8664 Return "x64" Case 0x01c0, 0x01c4 Return "ARM" Case 0xAA64 Return "ARM64" Case 0x0200 Return "IA64" Case 0x0166, 0x0169 Return "MIPS" Case 0x01a2 Return "SH3" Case 0x01a3 Return "SH3DSP" Case 0x01a6 Return "SH4" Case 0x01a8 Return "SH5" Case 0x01c2 Return "THUMB" Case Else Return "UNKNOWN_0x" & Hex($iMachine, 4) EndSwitch EndFunc ;==>_DetectArchitecture_File ; ----------------------------------------------------------------------------- ; Function: _BinaryToInt ; Purpose : Convert a little-endian Binary to integer ; ----------------------------------------------------------------------------- Func _BinaryToInt($bData) Local $iResult = 0, $iLen = BinaryLen($bData) For $i = 1 To $iLen $iResult += Number(BinaryMid($bData, $i, 1)) * (256 ^ ($i - 1)) Next Return $iResult EndFunc ;==>_BinaryToInt ; ----------------------------------------------------------------------------- ; Function: _GetDetailedFileInfo ; Purpose : Retrieve filename, architecture, and size for a given file ; ----------------------------------------------------------------------------- Func _GetDetailedFileInfo($sFilePath) Local $sArch = _DetectArchitecture_File($sFilePath) If @error Then Return SetError(@error, @extended, $sArch) Local $aInfo[4] $aInfo[0] = 3 $aInfo[1] = StringRegExpReplace($sFilePath, ".*\\", "") $aInfo[2] = $sArch $aInfo[3] = FileGetSize($sFilePath) Return $aInfo EndFunc ;==>_GetDetailedFileInfo Func _GenerateHexFunction($sFilePath, $sFuncName, $sVarName = "$sHexData", $iChunkSize = 4000) Local $bData = FileRead($sFilePath) If @error Or $bData = "" Then ConsoleWrite("Error reading file: " & $sFilePath & @CRLF) Return "" EndIf ;Local $sHexWithPrefix = StringTrimRight(StringToBinary($bData), 2) ;Local $sHex = StringReplace($sHexWithPrefix, "0x", "") Local $sHexWithPrefix = StringToBinary($bData) Local $sHex = StringMid($sHexWithPrefix, 3) ; Loại bỏ "0x" ; Ensure variable name starts with $ If StringLeft($sVarName, 1) <> "$" Then $sVarName = "$" & $sVarName ; Calculate safe chunk size Local $iLineOverhead = StringLen("Local " & $sVarName & " = '0x'") Local $iMaxSafeChunkSize = 4096 - $iLineOverhead If $iChunkSize > $iMaxSafeChunkSize Then $iChunkSize = $iMaxSafeChunkSize ; Get filename for comment Local $sFileName = _GetFileName($sFilePath) ; Build the function Local $sOutput = "" $sOutput &= "Func " & $sFuncName & "()" & @CRLF $sOutput &= @TAB & '; This function holds the hex data for ' & $sFileName & @CRLF $sOutput &= @TAB & '; File size: ' & _FormatFileSize(FileGetSize($sFilePath)) & @CRLF $sOutput &= @TAB & '; Architecture: ' & _DetectArchitecture($sFilePath) & @CRLF $sOutput &= @TAB & '; Generated by Dao Van Trong - TRONG.PRO' & @CRLF $sOutput &= @TAB & "Local " & $sVarName & " = '0x" & StringMid($sHex, 1, $iChunkSize) & "'" & @CRLF For $i = $iChunkSize + 1 To StringLen($sHex) Step $iChunkSize $sOutput &= @TAB & $sVarName & " &= '" & StringMid($sHex, $i, $iChunkSize) & "'" & @CRLF Next $sOutput &= @CRLF $sOutput &= @TAB & "Return " & $sVarName & @CRLF $sOutput &= "EndFunc ;==>" & $sFuncName & @CRLF Return $sOutput EndFunc ;==>_GenerateHexFunction Func _GenerateHelperFunction($sFuncName, $sOriginalFileName) Local $sHelperFunc = @CRLF & @CRLF $sHelperFunc &= '; =================================================================' & @CRLF $sHelperFunc &= '; Helper function to deploy the file from hex data.' & @CRLF $sHelperFunc &= '; =================================================================' & @CRLF $sHelperFunc &= 'Func _DeployFileFromHex()' & @CRLF $sHelperFunc &= @TAB & 'Local $sHexData = ' & $sFuncName & '()' & @CRLF $sHelperFunc &= @TAB & 'If $sHexData = "" Then' & @CRLF $sHelperFunc &= @TAB & @TAB & 'MsgBox(16, "Error", "Hex data is empty. Cannot deploy file.")' & @CRLF $sHelperFunc &= @TAB & @TAB & 'Return SetError(1, 0, "")' & @CRLF $sHelperFunc &= @TAB & 'EndIf' & @CRLF $sHelperFunc &= @CRLF $sHelperFunc &= @TAB & 'Local $sOutputFilename = "' & $sOriginalFileName & '"' & @CRLF $sHelperFunc &= @TAB & 'Local $sTempFilePath = @TempDir & "\" & $sOutputFilename' & @CRLF $sHelperFunc &= @TAB & 'Local $hFile = FileOpen($sTempFilePath, 18) ; 18 = Overwrite + Create Path' & @CRLF $sHelperFunc &= @TAB & 'If $hFile = -1 Then' & @CRLF $sHelperFunc &= @TAB & @TAB & 'MsgBox(16, "Error", "Failed to open file for writing at: " & $sTempFilePath)' & @CRLF $sHelperFunc &= @TAB & @TAB & 'Return SetError(2, 0, "")' & @CRLF $sHelperFunc &= @TAB & 'EndIf' & @CRLF $sHelperFunc &= @CRLF $sHelperFunc &= @TAB & 'FileWrite($hFile, BinaryToString($sHexData))' & @CRLF $sHelperFunc &= @TAB & 'FileClose($hFile)' & @CRLF $sHelperFunc &= @CRLF $sHelperFunc &= @TAB & 'If Not FileExists($sTempFilePath) Then' & @CRLF $sHelperFunc &= @TAB & @TAB & 'MsgBox(16, "Error", "Failed to write file to: " & $sTempFilePath)' & @CRLF $sHelperFunc &= @TAB & @TAB & 'Return SetError(3, 0, "")' & @CRLF $sHelperFunc &= @TAB & 'EndIf' & @CRLF $sHelperFunc &= @CRLF $sHelperFunc &= @TAB & 'MsgBox(64, "Success", "File deployed successfully to:" & @CRLF & $sTempFilePath)' & @CRLF $sHelperFunc &= @TAB & 'Return $sTempFilePath' & @CRLF $sHelperFunc &= 'EndFunc ;==>_DeployFileFromHex' & @CRLF & @CRLF $sHelperFunc &= '; Example usage: _DeployFileFromHex()' & @CRLF Return $sHelperFunc EndFunc ;==>_GenerateHelperFunction Func _GenerateMasterHelperFunction($aFiles) Local $sHelperFunc = @CRLF & @CRLF $sHelperFunc &= '; =================================================================' & @CRLF $sHelperFunc &= '; Master helper function to deploy all embedded files.' & @CRLF $sHelperFunc &= '; =================================================================' & @CRLF $sHelperFunc &= 'Func _DeployAllFiles()' & @CRLF $sHelperFunc &= @TAB & 'Local $aResults[0][2] ; [filepath, success/error]' & @CRLF $sHelperFunc &= @CRLF For $i = 0 To UBound($aFiles) - 1 Local $sFuncName = _GenerateFunctionName($aFiles[$i]) Local $sFileName = _GetFileName($aFiles[$i]) $sHelperFunc &= @TAB & '; Deploy ' & $sFileName & @CRLF $sHelperFunc &= @TAB & 'Local $sHexData' & $i & ' = ' & $sFuncName & '()' & @CRLF $sHelperFunc &= @TAB & 'If $sHexData' & $i & ' <> "" Then' & @CRLF $sHelperFunc &= @TAB & @TAB & 'Local $sOutputPath' & $i & ' = @TempDir & "\' & $sFileName & '"' & @CRLF $sHelperFunc &= @TAB & @TAB & 'Local $hFile' & $i & ' = FileOpen($sOutputPath' & $i & ', 18)' & @CRLF $sHelperFunc &= @TAB & @TAB & 'If $hFile' & $i & ' <> -1 Then' & @CRLF $sHelperFunc &= @TAB & @TAB & @TAB & 'FileWrite($hFile' & $i & ', BinaryToString($sHexData' & $i & '))' & @CRLF $sHelperFunc &= @TAB & @TAB & @TAB & 'FileClose($hFile' & $i & ')' & @CRLF $sHelperFunc &= @TAB & @TAB & @TAB & '_ArrayAdd($aResults, $sOutputPath' & $i & ' & "|Success")' & @CRLF $sHelperFunc &= @TAB & @TAB & 'Else' & @CRLF $sHelperFunc &= @TAB & @TAB & @TAB & '_ArrayAdd($aResults, "' & $sFileName & '|Failed to create file")' & @CRLF $sHelperFunc &= @TAB & @TAB & 'EndIf' & @CRLF $sHelperFunc &= @TAB & 'Else' & @CRLF $sHelperFunc &= @TAB & @TAB & '_ArrayAdd($aResults, "' & $sFileName & '|Failed to get hex data")' & @CRLF $sHelperFunc &= @TAB & 'EndIf' & @CRLF $sHelperFunc &= @CRLF Next $sHelperFunc &= @TAB & '; Display results' & @CRLF $sHelperFunc &= @TAB & 'Local $sReport = "Deployment Results:" & @CRLF & @CRLF' & @CRLF $sHelperFunc &= @TAB & 'For $i = 0 To UBound($aResults) - 1' & @CRLF $sHelperFunc &= @TAB & @TAB & 'Local $aParts = StringSplit($aResults[$i], "|")' & @CRLF $sHelperFunc &= @TAB & @TAB & '$sReport &= $aParts[1] & " - " & $aParts[2] & @CRLF' & @CRLF $sHelperFunc &= @TAB & 'Next' & @CRLF $sHelperFunc &= @CRLF $sHelperFunc &= @TAB & 'MsgBox(64, "Deployment Complete", $sReport)' & @CRLF $sHelperFunc &= @TAB & 'Return $aResults' & @CRLF $sHelperFunc &= 'EndFunc ;==>_DeployAllFiles' & @CRLF & @CRLF $sHelperFunc &= '; Example usage: _DeployAllFiles()' & @CRLF Return $sHelperFunc EndFunc ;==>_GenerateMasterHelperFunction Func _GenerateMasterHelperFunctionFromArray($aSelectedFiles) Local $sHelperFunc = @CRLF & @CRLF $sHelperFunc &= '; =================================================================' & @CRLF $sHelperFunc &= '; Master helper function to deploy all embedded files.' & @CRLF $sHelperFunc &= '; =================================================================' & @CRLF $sHelperFunc &= 'Func _DeployAllFiles()' & @CRLF $sHelperFunc &= @TAB & 'Local $aResults[0][3] ; [filename, filepath, status]' & @CRLF $sHelperFunc &= @CRLF For $i = 0 To UBound($aSelectedFiles) - 1 Local $sFileName = $aSelectedFiles[$i][1] Local $sFuncName = $aSelectedFiles[$i][4] $sHelperFunc &= @TAB & '; Deploy ' & $sFileName & ' (' & $aSelectedFiles[$i][3] & ')' & @CRLF $sHelperFunc &= @TAB & 'Local $sHexData' & $i & ' = ' & $sFuncName & '()' & @CRLF $sHelperFunc &= @TAB & 'If $sHexData' & $i & ' <> "" Then' & @CRLF $sHelperFunc &= @TAB & @TAB & 'Local $sOutputPath' & $i & ' = @TempDir & "\' & $sFileName & '"' & @CRLF $sHelperFunc &= @TAB & @TAB & 'Local $hFile' & $i & ' = FileOpen($sOutputPath' & $i & ', 18)' & @CRLF $sHelperFunc &= @TAB & @TAB & 'If $hFile' & $i & ' <> -1 Then' & @CRLF $sHelperFunc &= @TAB & @TAB & @TAB & 'FileWrite($hFile' & $i & ', BinaryToString($sHexData' & $i & '))' & @CRLF $sHelperFunc &= @TAB & @TAB & @TAB & 'FileClose($hFile' & $i & ')' & @CRLF $sHelperFunc &= @TAB & @TAB & @TAB & 'If FileExists($sOutputPath' & $i & ') Then' & @CRLF $sHelperFunc &= @TAB & @TAB & @TAB & @TAB & '_ArrayAdd($aResults, "' & $sFileName & '|" & $sOutputPath' & $i & ' & "|Success")' & @CRLF $sHelperFunc &= @TAB & @TAB & @TAB & 'Else' & @CRLF $sHelperFunc &= @TAB & @TAB & @TAB & @TAB & '_ArrayAdd($aResults, "' & $sFileName & '|N/A|Write failed")' & @CRLF $sHelperFunc &= @TAB & @TAB & @TAB & 'EndIf' & @CRLF $sHelperFunc &= @TAB & @TAB & 'Else' & @CRLF $sHelperFunc &= @TAB & @TAB & @TAB & '_ArrayAdd($aResults, "' & $sFileName & '|N/A|Cannot create file")' & @CRLF $sHelperFunc &= @TAB & @TAB & 'EndIf' & @CRLF $sHelperFunc &= @TAB & 'Else' & @CRLF $sHelperFunc &= @TAB & @TAB & '_ArrayAdd($aResults, "' & $sFileName & '|N/A|No hex data")' & @CRLF $sHelperFunc &= @TAB & 'EndIf' & @CRLF $sHelperFunc &= @CRLF Next $sHelperFunc &= @TAB & '; Display results' & @CRLF $sHelperFunc &= @TAB & 'Local $sReport = "Deployment Results (" & UBound($aResults) & " files):" & @CRLF & @CRLF' & @CRLF $sHelperFunc &= @TAB & 'For $i = 0 To UBound($aResults) - 1' & @CRLF $sHelperFunc &= @TAB & @TAB & 'Local $aParts = StringSplit($aResults[$i], "|")' & @CRLF $sHelperFunc &= @TAB & @TAB & 'If $aParts[0] >= 3 Then' & @CRLF $sHelperFunc &= @TAB & @TAB & @TAB & '$sReport &= "• " & $aParts[1] & ": " & $aParts[3]' & @CRLF $sHelperFunc &= @TAB & @TAB & @TAB & 'If $aParts[3] = "Success" Then $sReport &= " → " & $aParts[2]' & @CRLF $sHelperFunc &= @TAB & @TAB & @TAB & '$sReport &= @CRLF' & @CRLF $sHelperFunc &= @TAB & @TAB & 'EndIf' & @CRLF $sHelperFunc &= @TAB & 'Next' & @CRLF $sHelperFunc &= @CRLF $sHelperFunc &= @TAB & 'MsgBox(64, "Deployment Complete", $sReport)' & @CRLF $sHelperFunc &= @TAB & 'Return $aResults' & @CRLF $sHelperFunc &= 'EndFunc ;==>_DeployAllFiles' & @CRLF & @CRLF $sHelperFunc &= '; Example usage: _DeployAllFiles()' & @CRLF Return $sHelperFunc EndFunc ;==>_GenerateMasterHelperFunctionFromArray ; Helper functions Func _SanitizeName($sInput) If StringLeft($sInput, 1) = "$" Then $sInput = StringTrimLeft($sInput, 1) Return StringRegExpReplace($sInput, "[^a-zA-Z0-9_]", "") EndFunc ;==>_SanitizeName Func _GetFileName($sFilePath) Local $sDrive, $sDir, $sFileName, $sExtension _PathSplit($sFilePath, $sDrive, $sDir, $sFileName, $sExtension) Return $sFileName & $sExtension EndFunc ;==>_GetFileName Func _GetFileExtension($sFilePath) Local $sDrive, $sDir, $sFileName, $sExtension _PathSplit($sFilePath, $sDrive, $sDir, $sFileName, $sExtension) Return $sExtension EndFunc ;==>_GetFileExtension Func _FormatFileSize($iBytes) If $iBytes < 1024 Then Return $iBytes & " B" ElseIf $iBytes < 1024 * 1024 Then Return Round($iBytes / 1024, 1) & " KB" ElseIf $iBytes < 1024 * 1024 * 1024 Then Return Round($iBytes / (1024 * 1024), 1) & " MB" Else Return Round($iBytes / (1024 * 1024 * 1024), 2) & " GB" EndIf EndFunc ;==>_FormatFileSize !2 points
-
Hex code generator for quick embedding into au3 files
Trong and one other reacted to argumentum for a topic
Q & A Q: Why no compression in your code ? A: Because it all depends. If you convert this to an executable, aut2exe will use internal compression and the resultant file is smaller if the "file function" is not pre-compressed.2 points -
#Directive_If_Run
WildByDesign reacted to argumentum for a topic
#AutoIt3Wrapper_If_Run #AutoIt3Wrapper_Run_Au3Check=Y #AutoIt3Wrapper_Run_Tidy=Y #Autoit3Wrapper_If_Compile #AutoIt3Wrapper_Run_Au3Check=N #AutoIt3Wrapper_Run_Tidy=N #AutoIt3Wrapper_EndIf AutoIt3Wrapper has the above ( when not as GUI ) Can a similar be had for AutoIt ? #Directive_If_Run #RequireAdmin #Directive_If_Compile ; highestAvailable #Directive_If_Something ; maybe if_au3, if_exe, etc. Just an idea #Directive_EndIf Because if "#RequireAdmin" is there, it will abide by that instead of: #pragma compile(ExecLevel, highestavailable) or #AutoIt3Wrapper_Res_requestedExecutionLevel=highestAvailable Let it be known that is not a "OMG!, what am I gonna do" kind of thing since we all live with it since always but, it'd be nice to have. PS: I know that requests are by trac only. So this is a wish for when time permits it.1 point -
#Directive_If_Run
argumentum reacted to Jos for a topic
No it is not. Please stop arguing and try to understand that these setting are part of the PE header manifest resource. So as I already stated: these directives have a logical name and will not be changed.1 point -
#Directive_If_Run
argumentum reacted to Jos for a topic
There are some more changes required for the Change I made so that Tidy & Au3Check will process the proper SourceFIle.... will provide update when ready.1 point -
#Directive_If_Run
argumentum reacted to Jos for a topic
The feature is documented in the Helpfile and the autoit3Wrapper.Ini file contains SVN/GIT/HG examples: [Versioning] #~ Versioning=SVN/GIT/HG Versioning=GIT DiffPGM=C:\Program Files (x86)\WinMerge\WinMergeU.exe DiffPGMOptions=/wr Prompt_Comments=y debug=1 [SVN] VersionPGM=C:\Program Files\TortoiseSVN\bin\svn.exe CommandChkVersioning=info "%sourcedir%" CommandChkVersioning_ok_txt=Working Copy Root Path: CommandChkVersioning_ok_rc= CommandStatusSource=status "%sourcefile%" -u CommandStatusSource_ADD_txt=\?\s*?%sourcefile% CommandStatusSource_ok_txt=[MA\?][\s\d-]*?%sourcefile% CommandLogSource=log "%sourcefile%" -l 5 CommandLogSourceLine=(?m)\v+[^\|]*?\|[^\|]*?\|[^\|]*?\|.*\v+(.*?)$ CommandAddSource=add "%sourcefile%" CommandAddSource_ok_txt=A.*?%sourcefileonly% CommandAddSource_ok_rc= CommandCommitSource=commit "%sourcefile%" --message "%commitcomment%" CommandCommitSource_ok_txt= CommandCommitSource_ok_rc=0 CommandCommitSource_new_revision=(?i)(?s)committed revision\s*([0-9]*) CommandGetLastVersion=cat "%sourcefile%" CommandGetLastVersion_ok_txt= CommandGetLastVersion_ok_rc=0 [GIT] VersionPGM=C:\Program Files\Git\bin\git.exe CommandChkVersioning=status -u no CommandChkVersioning_ok_txt= CommandChkVersioning_ok_rc=0 CommandStatusSource=status --porcelain ".\%sourcefileonly%" CommandStatusSource_ADD_txt=\?\s*?%sourcefileonly% CommandStatusSource_ok_txt=[MA\?].*?%sourcefileonly% CommandLogSource=log -n 5 ".\%sourcefileonly%" CommandLogSourceLine=(?m)commit.*\vAuthor.*\vDate.*\v.*\v+\s*(.*?)\v.*\v CommandAddSource=add ".\%sourcefileonly%" CommandAddSource_ok_txt=A.*?%sourcefileonly% CommandAddSource_ok_rc= CommandCommitSource=commit "%sourcefileonly%" --message "%commitcomment%" CommandCommitSource_ok_txt= CommandCommitSource_ok_rc=0 CommandCommitSource_new_revision=(?m)(?i)(?s)(\[.*\]).*?\v+\s*.*?file.*?changed CommandGetLastVersion=cat-file --textconv HEAD:./%sourcefileonly%" CommandGetLastVersion_ok_txt= CommandGetLastVersion_ok_rc=0 CommandPullSource=pull CommandPull_ok_txt= CommandPullSource_ok_rc=0 CommandPushSource=push CommandPush_ok_txt= CommandPushSource_ok_rc=0 [HG] VersionPGM=C:\Program Files\TortoiseHg\hg.exe CommandChkVersioning=config CommandChkVersioning_ok_txt=bundle.mainreporoot= CommandChkVersioning_ok_rc= CommandStatusSource=status "%sourcefile%" -u CommandStatusSource_ADD_txt=\?\s*?%sourcefile% CommandStatusSource_ok_txt=[MA\?][\s\d-]*?%sourcefile% CommandLogSource=log "%sourcefile%" -l 5 CommandAddSource=add "%sourcefile%" CommandAddSource_ok_txt=A.*?%sourcefileonly% CommandAddSource_ok_rc= CommandCommitSource=commit "%sourcefile%" --message "%commitcomment%" CommandCommitSource_ok_txt= CommandCommitSource_ok_rc=0 CommandCommitSource_new_revision=(?i)(?s)committed revision\s*([0-9]*) CommandGetLastVersion=cat "%sourcefile%" CommandGetLastVersion_ok_txt= CommandGetLastVersion_ok_rc=0 So it should be pretty strait forward to use for either tool. I use it mainly for GIT these days,1 point -
_DragNumAdjust
argumentum reacted to ioa747 for a topic
_DragNumAdjust Adjust the value of a numeric control by dragging with the mouse. It also checks whether the Control key (faster) or Shift key (slower) is pressed while dragging, which allows the user to adjust the sensitivity of the adjustment speed. _DragNumAdjust ( $sControls, $iAxis = 1, $iSensitivity = 4 ) $sControls A string containing the IDs of the controls to be adjusted, separated by a vertical bar | Each control ID (Optionaly) is followed by its min and max values, separated by a semicolon ; e.g. _DragNumAdjust("$idNum1;-100;100|$idNum2|-50;50|$idNum3") Adjust control $idNum1 (min=-100, max=100) and $idNum2 (min=-50, max=50) and $idNum3 (without min/max limits) $iAxis [optional] The axis to drag. 0 for horizontal, 1 for vertical. (Default is 1) $iSensitivity [optional] The sensitivity factor for mouse sensitivity. Higher means slower change. (Default is 4) ; https://www.autoitscript.com/forum/topic/213011-_dragnumadjust/ ;---------------------------------------------------------------------------------------- ; Title...........: _DragNumAdjust.au3 ; Description.....: Adjust the value of a numeric control by dragging with the mouse. ; AutoIt Version..: 3.3.16.1 Author: ioa747 Script Version: 0.1 ; Note............: Testet in Win10 22H2 ;---------------------------------------------------------------------------------------- #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <GUIConstantsEx.au3> #include <WinAPIDlg.au3> #include <Array.au3> #include <Misc.au3> Global $hGUI, $idNum1, $idNum2, $idNum3, $idNum4 Example() Func Example() $hGUI = GUICreate("Example GUI", 320, 220) $idNum1 = GUICtrlCreateInput("100", 10, 20, 70, 20) $idNum2 = GUICtrlCreateInput("20", 130, 20, 70, 20) $idNum3 = GUICtrlCreateInput("3", 10, 50, 70, 20) $idNum4 = GUICtrlCreateInput("30", 130, 50, 70, 20) Local $idBtn = GUICtrlCreateButton("Ok", 40, 180, 60, 20) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idBtn ExitLoop EndSwitch ; Test with negative min/max values _DragNumAdjust("$idNum1;-100;100|$idNum2;-50;50|$idNum3;0;10|$idNum4", 0) ; Horizontal dragging WEnd EndFunc ;==>Example ; #FUNCTION# ==================================================================================================================== ; Name...........: _DragNumAdjust ; Description....: Adjust the value of a numeric control by dragging with the mouse. ; Syntax.........: _DragNumAdjust($sControls [, $iAxis = 1 [, $iSensitivity = 4]]) ; Parameters.....: $sControls - A string containing the IDs of the controls to be adjusted, separated by a vertical bar | ; Each control ID (Optionaly) is followed by its min and max values, separated by a semicolon ; ; $iAxis - [optional] The axis to drag. 0 for horizontal, 1 for vertical. (Default is 1) ; $iSensitivity - [optional] The sensitivity factor for mouse movement. Higher means slower change.(Default is 4) ; Return values .: Success: Returns None. (Just adjust the control value) ; Author ........: ioa747 ; Modified ......: ; Remarks .......: This function allows users to adjust numeric control values by dragging the mouse. ; Related .......: ControlGetHandle, GUIGetCursorInfo, MouseGetPos, _IsPressed ; Link ..........: https://www.autoitscript.com/forum/topic/213011-_dragnumadjust/ ; Example .......: _DragNumAdjust("$idNum1;-100;100|$idNum2|-50;50", 1) ; Adjust control $idNum1 (min=-100, max=100) and $idNum2 (min=-50, max=50) ; =============================================================================================================================== Func _DragNumAdjust($sControls, $iAxis = 1, $iSensitivity = 4) ; Define constants locally. Local Const $_GUI_CURSOR_ARROW = 2 ; Default ↖ Arrow cursor Local Const $_GUI_CURSOR_SIZENS = 11 ; Vertical ↕ SizeNS cursor Local Const $_GUI_CURSOR_SIZEWE = 13 ; Horizontal ↔ SizeWE cursor Local Const $_MAXINT = 2147483647 ; Maximum value for a 32-bit signed integer Local Const $_MININT = -2147483648 ; Minimum value for a 32-bit signed integer Local Static $aCtrlParameters ; Initialize $aCtrlParameters once If Not IsArray($aCtrlParameters) Then Local $aParts = StringSplit($sControls, "|") Local $aTempArray[$aParts[0] + 1][3] For $i = 1 To $aParts[0] Local $aTmp = StringSplit($aParts[$i], ";") $aTempArray[$i][0] = Execute($aTmp[1]) $aTempArray[$i][1] = ($aTmp[0] > 1 ? Number($aTmp[2]) : $_MININT) ; set Min $aTempArray[$i][2] = ($aTmp[0] > 2 ? Number($aTmp[3]) : $_MAXINT) ; set Max Next $aCtrlParameters = $aTempArray EndIf If Not WinActive($hGUI) Then Return ; Return if $hGUI has no focus Local $aMouseInfo = GUIGetCursorInfo($hGUI) ; $iFocusCtrlID = which control has the focus Local $hFocusCtrlHandle = ControlGetHandle($hGUI, "", ControlGetFocus($hGUI)) Local $iFocusCtrlID = _WinAPI_GetDlgCtrlID($hFocusCtrlHandle) Local $iCtrlIdx = -1 For $i = 1 To UBound($aCtrlParameters) - 1 If $aCtrlParameters[$i][0] = $iFocusCtrlID Then $iCtrlIdx = $i ExitLoop EndIf Next If $iCtrlIdx = -1 Then Return ; Return if no matching control index is found ; $iCtrlUnderMouse = which control is under the mouse Local $iCtrlUnderMouse = IsArray($aMouseInfo) ? $aMouseInfo[4] : 0 ; Return and set cursor to Default ↖ Arrow if $iCtrlUnderMouse has no focus If $iCtrlUnderMouse <> $iFocusCtrlID Then Return GUICtrlSetCursor($iFocusCtrlID, $_GUI_CURSOR_ARROW) ; Set cursor type based on axis Local $iCursorType = $_GUI_CURSOR_ARROW If $iAxis = 1 Then $iCursorType = $_GUI_CURSOR_SIZENS ElseIf $iAxis = 0 Then $iCursorType = $_GUI_CURSOR_SIZEWE Else Return ; Exit if invalid axis EndIf GUICtrlSetCursor($iFocusCtrlID, $iCursorType) If $aMouseInfo[2] = 1 Then ; Primary button down Local $startValue = GUICtrlRead($iFocusCtrlID) ; Store start value Local $lastDisplayedValue = $startValue ; start value Local $startPos = MouseGetPos($iAxis) ; Initial mouse position (Y or X) While $aMouseInfo[2] = 1 ; Primary button down $aMouseInfo = GUIGetCursorInfo($hGUI) ; Update control Local $currentPos = MouseGetPos($iAxis) ; Current mouse position (Y or X) Local $diff = Int(($startPos - $currentPos) / $iSensitivity) ; Adjust sensitivity If _IsPressed("11") Then ; Control key makes adjustment faster $diff *= 4 ElseIf _IsPressed("10") Then ; Shift key makes adjustment slower $diff = Int($diff / 4) EndIf If $iAxis = 0 Then $diff *= -1 ; Horizontal increases to the right Local $newValue = $startValue + $diff Local $sMin = $aCtrlParameters[$iCtrlIdx][1] Local $sMax = $aCtrlParameters[$iCtrlIdx][2] $newValue = ($newValue < $sMin ? $sMin : $newValue) $newValue = ($newValue > $sMax ? $sMax : $newValue) If $newValue <> $lastDisplayedValue Then GUICtrlSetData($iFocusCtrlID, $newValue) $lastDisplayedValue = $newValue ; Update last displayed value EndIf Sleep(10) WEnd GUICtrlSetCursor($iFocusCtrlID, $_GUI_CURSOR_ARROW) EndIf EndFunc ;==>_DragNumAdjust Please, every comment is appreciated! leave your comments and experiences here! Thank you very much1 point -
#Directive_If_Run
argumentum reacted to Jos for a topic
It is always possible, but that is not something I will be looking at, as that makes it way too complex and doesn't weight up to the effort I would have to put in. Have a go when you want and when done make a proposal for update of Autoit3Wrapper. 😉1 point