Leaderboard
Popular Content
Showing content with the highest reputation on 07/15/2024 in all areas
-
You can calculate Adler32 without zlib_udf.au3 and without zlib1.dll. I made an example based on original code written by @Ward but using modern AutoIt features: #include <Memory.au3> MsgBox(0, '', Adler32('hahahahahahahahahahahehe')) Func Adler32($sData) ; Based on code written by Ward ; https://www.autoitscript.com/forum/topic/121985-autoit-machine-code-algorithm-collection/#comment-846714 Local $sCode If @AutoItX64 Then $sCode = '0x55450FB7D041C1E8104189D15756534883EC0885D27E69BEB0150000BB718007804181F9B01500008' & _ '9F54589CB410F4EE94889C84129EB83ED01488D7C29014589D90FB6104883C0014101D24501D04839F875EE4489D' & _ '0488D4C2901F7E34489C0C1EA0F69D2F1FF00004129D2F7E3C1EA0F69D2F1FF00004129D04585DB7FA14883C4084' & _ '489C05B5EC1E0105F4409D05DC3' Else $sCode = '0x5557565383EC048B5C24208B7C241C8B7424180FB7CBC1EB1085FF7E5181FFB015000089FD7E05BDB' & _ '015000029EF31C0893C240FB6140683C00101D101CB39C575F189C801EEBD71800780F7E589D8C1EA0F69D2F1FF0' & _ '00029D1F7E58B0424C1EA0F69D2F1FF000029D385C07FAF89D883C404C1E01009C85B5E5F5DC3' EndIf Local $bCode = Binary($sCode) Local $iCode = BinaryLen($bCode) Local $pCode = _MemVirtualAlloc(0, $iCode, $MEM_COMMIT, $PAGE_EXECUTE_READWRITE) Local $tCode = DllStructCreate('byte Data[' & $iCode & ']', $pCode) $tCode.Data = $bCode Local $bData = Binary($sData) Local $tBuffer = DllStructCreate('byte Data[' & BinaryLen($bData) & ']') $tBuffer.Data = $bData Local $aCall = DllCallAddress('int:cdecl', $pCode, 'ptr', DllStructGetPtr($tBuffer), 'int', DllStructGetSize($tBuffer), 'int', 1) Local $iResult = '0x' & Hex($aCall[0], 8) _MemVirtualFree($pCode, 0, $MEM_RELEASE) Return $iResult EndFunc2 points
-
Thanks @ioa747this really worked perfectly. This way I can shorten the whole script: so this is how the needed part looks now, if anyone after me would be also curious: If (StringLen($TargetSID) = 0) Then Send("{TAB}") Sleep(100) Send("!e") Sleep(1000) Send("{TAB}") Send("{TAB}") Send($TargetServiceName) @donnyh13 thanks for the recommendation, will be sure useful later on.2 points
-
Inputbox text not center vertically
ioa747 reacted to pixelsearch for a topic
Hi @ioa747 Yes it works too using the "disable label way" as you did. There is a little problem as shown in the following pic, but I guess we can live with that. Note: I changed the GUI title in your script (it indicates now #3) to differentiate the scripts : As you see, while dragging the right bottom corner (notice in the pic the Gui cursor #12 SizeNWSE) then the vertical alignment is not done until we stop the drag process and only now $GUI_EVENT_RESIZED is processed to redraw everything correctly when your function _OrderPos() is called. It seems hard to have a correct vertical positioning during the drag process if you don't register the WM_SIZE message. I remember @Melba23 doing it in a special way to take care of all events when he wrote in this post from 2020 : I never forgot the 2 "successive" functions M23 scripted, presented like this, very clever ! Func _WM_SIZE($hWnd, $iMsg, $wParam, $lParam) ; If it is our GUI If $hWnd = $GuiMain Then _Resize() EndIf EndFunc Func _Resize() ; Get the new position and size of the labels ... ; And set the RichEdits to the same position and size ... EndFunc1 point -
It should be easy to check and exclude some extensions: #include <File.au3> CreateExtDirs(@ScriptDir) Func CreateExtDirs($sPath, $fRec = False) Local $aFile = _FileListToArrayRec(@ScriptDir, Default, $FLTAR_FILES, ($fRec ? $FLTAR_RECUR : $FLTAR_NORECUR), $FLTAR_NOSORT, $FLTAR_FULLPATH) If @error Then Return SetError(1, 0, 0) Local $sDrive, $sDir, $sFileName, $sExt, $sExtDir, $vIdx = '' For $Index = 1 To $aFile[0] $vIdx = '' _PathSplit($aFile[$Index], $sDrive, $sDir, $sFileName, $sExt) If StringLower($sExt) = '.au3' Or StringLower($sExt) = '.exe' Then ContinueLoop $sExtDir = @ScriptDir & '\' & StringReplace($sExt, '.', '') If Not FileExists($sExtDir) Then DirCreate($sExtDir) While FileExists($sExtDir & '\' & $sFileName & $vIdx & $sExt) $vIdx += 1 WEnd FileMove($aFile[$Index], $sExtDir & '\' & $sFileName & $vIdx & $sExt) Next EndFunc Note that you can also pass wanted extensions to _FileListToArrayRec().1 point
-
Inputbox text not center vertically
pixelsearch reacted to ioa747 for a topic
variation #include <EditConstants.au3> #include <StaticConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPIGdi.au3> Global $hGui = GUICreate("Input without border #3 (resizable GUI)", 215, 214, 192, 124, $WS_OVERLAPPEDWINDOW, $WS_EX_COMPOSITED) Global $Input0 = GUICtrlCreateInput("Standard input control", 16, 10, 180, 20, BitOR($ES_CENTER, $ES_AUTOHSCROLL)) Global $Input1 = _CreateInput("This is an input control gg", 16, 40, 180, 20, 0xFF0000, BitOR($ES_CENTER, $ES_AUTOHSCROLL)) Global $Input2 = _CreateInput("and there is no border", 16, 70, 180, 51, 0x00FF00, BitOR($ES_CENTER, $ES_AUTOHSCROLL)) Global $Input3 = _CreateInput("and it is vertical centered ;)", 16, 130, 180, 31, 0x00FFFF, BitOR($ES_CENTER, $ES_AUTOHSCROLL)) Global $Input4 = GUICtrlCreateInput("Standard input control" & @CRLF & "with out border", 16, 170, 180, 36, BitOR($ES_CENTER, $ES_AUTOHSCROLL, $ES_MULTILINE ), 0) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_RESIZED, $GUI_EVENT_MAXIMIZE, $GUI_EVENT_RESTORE _OrderPos() EndSwitch WEnd ;-------------------------------------------------------------------------------------------------------------------------------- Func _CreateInput($Text, $Left, $Top, $Width, $Height, $FullColor = "0xFFFFFF", $iStyle = -1) Local $idInput = GUICtrlCreateInput($Text, $Left + 1, $Top + ($Height - 16) / 2, $Width - 2, 18, $iStyle, $WS_EX_TOOLWINDOW) ConsoleWrite("$idInput=" & $idInput & @CRLF) GUICtrlSetBkColor(-1, $FullColor) GUICtrlCreateLabel("", $Left, $Top, $Width, $Height) GUICtrlSetBkColor(-1, $FullColor) GUICtrlSetState(-1, $GUI_DISABLE) Return $idInput EndFunc ;==>_CreateInput ;-------------------------------------------------------------------------------------------------------------------------------- Func _OrderPos() Local $aPos For $iCtrl = 4 To 8 Step 2 $aPos = ControlGetPos($hGUI, "", $iCtrl + 1) GUICtrlSetPos($iCtrl, $aPos[0] + 1, $aPos[1] + ($aPos[3] - 16) / 2, $aPos[2] - 2) Next EndFunc ;==>_OrderPos ;--------------------------------------------------------------------------------------------------------------------------------1 point -
This is another way: #include <File.au3> CreateExtDirs(@ScriptDir) Func CreateExtDirs($sPath, $fRec = False) Local $aFile = _FileListToArrayRec(@ScriptDir, Default, $FLTAR_FILES, ($fRec ? $FLTAR_RECUR : $FLTAR_NORECUR), $FLTAR_NOSORT, $FLTAR_FULLPATH) If @error Then Return SetError(1, 0, 0) Local $sDrive, $sDir, $sFileName, $sExt, $sExtDir, $vIdx = '' For $Index = 1 To $aFile[0] $vIdx = '' _PathSplit($aFile[$Index], $sDrive, $sDir, $sFileName, $sExt) $sExtDir = @ScriptDir & '\' & StringReplace($sExt, '.', '') If Not FileExists($sExtDir) Then DirCreate($sExtDir) While FileExists($sExtDir & '\' & $sFileName & $vIdx & $sExt) $vIdx += 1 WEnd FileMove($aFile[$Index], $sExtDir & '\' & $sFileName & $vIdx & $sExt) Next EndFunc1 point
-
I don't know how this site or zlib1.dll implement the function but it seems like _Zlib_CalculateAdler32() function from zlib_udf.au3 use as base the number 65521. If you change this base to 65522 the result will be exactly like the online hash calculator used by you to check the result. Don't ask me why because I don't know how the function it's implemented inside the dll. Actually if you want just to calculate the adler32 for a certain string you don't necessarily need the entire udf. Here is a demo with the base modified: Local $sData = 'hahahahahahahahahahahehe' Local $bData = StringToBinary($sData) Local $tBuffer = DllStructCreate('byte Data[' & BinaryLen($bData) & ']') $tBuffer.Data = $bData Local $aCall = DllCall('zlib1.dll', "ulong:cdecl", "adler32", "ulong", 65522, "ptr", DllStructGetPtr($tBuffer), "int", DllStructGetSize($tBuffer)) ConsoleWrite(Hex($aCall[0], 8) & @CRLF)1 point
-
copy-move-folders-or-files-according-to-its-extension-to-the-favorite-folders Edit: #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <File.au3> #include <Array.au3> _Example() ;-------------------------------------------------------------------------------------------------------------------------------- Func _Example() Local $aFiles = _FindAll(@UserProfileDir & "\Pictures", "*.jpg;*.png;*.bmp;*.tiff") ;~ _ArrayDisplay($aFiles) Local $iFileExists, $sNewFilePath, $sDestination ; , $sDrive, $sDir, $sFileName, $sExtension For $i = 1 To $aFiles[0] Local $sDrive = "", $sDir = "", $sFileName = "", $sExtension = "", $iCnt = 0 _PathSplit($aFiles[$i], $sDrive, $sDir, $sFileName, $sExtension) Switch $sExtension Case ".jpg" $sDestination = "D:\Pictures\jpg\" Case ".png" $sDestination = "D:\Pictures\png\" Case ".bmp" $sDestination = "D:\Pictures\bmp\" Case ".tiff" $sDestination = "D:\Pictures\tif\" Case Else ConsoleWrite("?? " & $aFiles[$i] & @CRLF) ContinueCase EndSwitch Do ; Increase the value of $iCnt until File not Exists If $iCnt = 0 Then $sNewFilePath = $sDestination & $sFileName & $sExtension Else $sNewFilePath = $sDestination & $sFileName & "~" & $iCnt & $sExtension EndIf $iFileExists = FileExists($sNewFilePath) $iCnt += 1 Until $iFileExists = 0 FileMove($aFiles[$i], $sNewFilePath, $FC_OVERWRITE + $FC_CREATEPATH) Next EndFunc ;==>_Example ;-------------------------------------------------------------------------------------------------------------------------------- Func _FindAll($dir, $sMask = "*", $iReturn = $FLTAR_FILES, $iRecur = $FLTAR_RECUR) Local $aList = _FileListToArrayRec($dir, $sMask, $iReturn, $iRecur, $FLTAR_NOSORT, $FLTAR_FULLPATH) If Not IsArray($aList) Then Local $aEmpty[] =[0] ConsoleWrite($dir & " There are not '" & $sMask & "' in " & $dir & @CRLF) Return SetError(1, 0, $aEmpty) Else Return $aList EndIf EndFunc ;==>_FindAll1 point
-
Moved to the appropriate forum. Moderation Team1 point
-
in the photo you sent us, I see an underlined letter in each word. E.G. Username, Password, SID, Service name, etc. This means that with alt and U it goes to the Username, with alt and P it goes to the password, etc. Try to find the keyboard navigation logic first, and then try it with the script good luck1 point
-
RichEdit resize
ioa747 reacted to pixelsearch for a topic
Hi everybody, I would like to revive this thread for 2 reasons : 1) In case jcpetu (OP) still got his issue unsolved, maybe the solution below could work for him. 2) To share with you an alternate way of resizing UDF-created controls, without using the "disabled label way" described in this thread (though it worked fine for me). All credits go to MrCreatoR's UDF GUICtrlSetResizingEx.au3 version 1.3 found in this link. For the record, I discovered MrCreatoR's UDF just now, after having read this new thread from matwachich in this link. So here is jcpetu's code, simplified, with 1 line only to resize the RichEdit controls and it worked great for me, with lesser (apparent) code. Fingers crossed for you, jcpetu #include <GUIConstantsEx.au3> #include <GuiRichEdit.au3> #include <GuiListView.au3> #include <WindowsConstants.au3> #include 'GUICtrlSetResizingEx.au3' ; https://www.autoitscript.com/forum/topic/202781-guictrlsetresizing-on-udf-createwindowex-created-controls/?tab=comments#comment-1455745 Opt('GUIOnEventMode', 1) Opt('GUICloseOnESC', 0) Global $GuiMain, $GUIversion = 'Rich Edit Resize', $DeskW = @DesktopWidth - 20, $DeskH = @DesktopHeight - 80 Global $I1, $I2, $Edit1, $Edit2 $GuiMain = GUICreate($GUIversion, $DeskW, $DeskH, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX)) ; GUISetBkColor(0xC4C4C4) ; Just so you can see the RichEdits GUISetOnEvent($GUI_EVENT_CLOSE, 'CloseApp') $I1 = GUICtrlCreateInput('', 66, 30, 581, 31) GUICtrlSetResizing(-1, 1) $I2 = GUICtrlCreateInput('', 66, 70, 581, 31) GUICtrlSetResizing(-1, 1) $Edit1 = _GUICtrlRichEdit_Create($GuiMain, '', 10, 140, ($DeskW / 2) - 10, 320, BitOR($ES_MULTILINE, $WS_HSCROLL, $WS_VSCROLL)) _GUICtrlSetResizingEx($Edit1, $GUI_DOCKAUTO) $Edit2 = _GUICtrlRichEdit_Create($GuiMain, '', ($DeskW / 2) + 10, 140, ($DeskW / 2) - 15, 320, BitOR($ES_MULTILINE, $WS_HSCROLL, $WS_VSCROLL)) _GUICtrlSetResizingEx($Edit2, $GUI_DOCKAUTO) $LV1 = GUICtrlCreateListView("", 8, 480, $DeskW - 18, 161, -1, BitOR($LVS_EX_CHECKBOXES, $LVS_EX_SUBITEMIMAGES, $LVS_EX_CHECKBOXES, $LVS_EX_FULLROWSELECT, $LVS_EX_HEADERDRAGDROP, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER)) GUICtrlSetResizing(-1, 1) _GUICtrlListView_AddColumn(-1, "#", 30, 1) _GUICtrlListView_AddColumn(-1, "Date", 110, 2) _GUICtrlListView_AddColumn(-1, "Time", 110, 2) _GUICtrlListView_AddColumn(-1, "Event", 110, 2) GUISetState(@SW_SHOW, $GuiMain) While 1 Sleep(10) WEnd Func CloseApp() _GUICtrlRichEdit_Destroy($Edit1) _GUICtrlRichEdit_Destroy($Edit2) GUIDelete($GuiMain) Exit EndFunc ;==>CloseApp To make it easier for you to run the script, I attach below MrCreatoR's UDF GUICtrlSetResizingEx.au3 (version 1.3 dated 09/22/2015), it's the original UDF as found in his archive file : GUICtrlSetResizingEx.au31 point -
@Programfilesdir and 64 bit windows...
Atakanbasturk reacted to UEZ for a topic
Atakan, just for your information. @ProgramFilesDir macro depends also how you start your compiled script. If it is compiled as x64 @ProgramFilesDir is C:Program Files, as x86 is C:Program Files (x86). The 64-bit version can only be installed when the os architecture supports x64 execution. Br, UEZ1 point