Jump to content

Trong

Active Members
  • Posts

    1,102
  • Joined

  • Days Won

    2

Everything posted by Trong

  1. RC2 TEST On Windows 11: @OSVersion = UNKNOWN https://i.postimg.cc/G2z0s3Tc/rc2.png
  2. Change and experiment with the following commands: Global $Pass_Encrypt = $CmdLine[1] Global $Encrypt_exe = 'C:\Progra~1\bin\Encrypt.exe' Global $OUT_pwd_txt = 'C:\temp\pwd.txt' FileDelete($OUT_pwd_txt) Local $CMD = '"' & $Encrypt_exe & '" "' & $Pass_Encrypt & '" > "' & $OUT_pwd_txt & '"' ; #write the parameter $pass in C:\temp\pwd.txt If Not FileExists($Encrypt_exe) Then Exit ConsoleWrite('! ERROR File not Exists: ' & $Encrypt_exe & @CRLF) RunWait(@ComSpec & ' /c ' & $CMD, "", @SW_HIDE) If FileExists($OUT_pwd_txt) Then ConsoleWrite('- Input: ' & $Pass_Encrypt & @CRLF & '- Output: ' & FileRead($OUT_pwd_txt) & @CRLF)
  3. You can use FileReadToArray to get a line-by-line array of the file: Global $FileListProcess = @ScriptDir & "\ListProcess4Kill.txt" Global $ArrayListProcess, $ProcessCount = 0 While 1 If Not FileExists($FileListProcess) Then Exit MsgBox(16 + 262144, "ERROR !", "File list process to kill is not Exists: " & @CRLF & $FileListProcess) $ArrayListProcess = _GetListProcess($FileListProcess) $ProcessCount = @extended If @error Then Exit MsgBox(16 + 262144, "ERROR !", "ERROR on Read File: " & @CRLF & $FileListProcess) For $i = 0 To $ProcessCount ; Loop through the array. ConsoleWrite("! Kill process: " & $ArrayListProcess[$i] & @CRLF) ; Display the contents of the array. If FileExists($ArrayListProcess[$i]) Then _ProcessCloseByPath($ArrayListProcess[$i]) Else _ProcessClose($ArrayListProcess[$i], 1) EndIf Next Sleep(1000) WEnd Func _GetListProcess($FileListProcess) ConsoleWrite("+ Reading the file: " & $FileListProcess & @CRLF) Local $_ArrayListProcess = FileReadToArray($FileListProcess) Local $_ProcessCount = @extended - 1 If @error Then ConsoleWrite("! There was an error reading the file. @error: " & @error & @CRLF) ; An error occurred reading the current script file. Return SetError(1, 0, 0) Else Return SetError(0, $_ProcessCount, $_ArrayListProcess) EndIf EndFunc ;==>_GetListProcess Func _ProcessClose($sProcess, $All = 0) Local $sPID = ProcessExists($sProcess) If Not $sPID Then Return SetError(0, 1, 0) Dim $Q = 0 If $All Then While ProcessExists($sProcess) ProcessClose($sProcess) Sleep(1) $Q += 1 If $Q > 10 Then ExitLoop WEnd If ProcessExists($sProcess) Then RunWait(@ComSpec & " /c taskkill /T /F /IM " & $sProcess, @SystemDir, @SW_HIDE) Else While ProcessExists($sPID) ProcessClose($sPID) Sleep(1) $Q += 1 If $Q > 10 Then ExitLoop WEnd If ProcessExists($sPID) Then RunWait(@ComSpec & " /c taskkill /T /F /PID " & $sPID, @SystemDir, @SW_HIDE) EndIf Return SetError(0, 0, ProcessExists($sPID) = 0) ; Dao Van Trong - TRONG.LIVE EndFunc ;==>_ProcessClose ; * -----:| Func _ProcessCloseByPath($sPath) ; ;#RequireAdmin Local $colItems = "", $strComputer = "localhost", $wbemFlagReturnImmediately = 0x10, $wbemFlagForwardOnly = 0x20 ; Local $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\ROOT\CIMV2"), $sFailure = 0, $sSuccess = 1 ; Local $cQuery = "SELECT ExecutablePath,ProcessId FROM Win32_Process WHERE ExecutablePath = " & '"' & StringReplace($sPath, "\", "\\") & '"' $colItems = $objWMIService.ExecQuery($cQuery, "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) ; If IsObj($colItems) Then ; For $objItem In $colItems ; Local $sPID = $objItem.ProcessId ; ;ConsoleWrite('closing pid = ' & $sPID & ' path = ' & $objitem.executablepath & @CRLF) _ProcessClose($sPID) If ProcessExists($sPID) Then $sFailure += 1 ; Next ; EndIf ; If $sFailure Then $sSuccess = 0 ; Return SetError($sFailure, 0, $sSuccess) ; Dao Van Trong - TRONG.LIVE EndFunc ;==>_ProcessCloseByPath
  4. I don't know how to use RegEx but you can use _StringBetween(): #include <String.au3> Local $InputData = '"text": "Some Youtube comment as example", "timestamp":346230, "text": "SomeSDGs example", "timestamp": 15833460, "text": "Some YoutFGNSFGJnt as example", "timestamp": 45634572800, "' $InputData = StringReplace($InputData, ', "', ',"') $InputData = StringReplace($InputData, '": ', '":') Local $textArray = _StringBetween($InputData, '"text":', ',"') If IsArray($textArray) Then For $i = 0 To UBound($textArray) - 1 ConsoleWrite($textArray[$i] & @CRLF) Next EndIf Local $timestampArray = _StringBetween($InputData, '"timestamp":', ',"') If IsArray($timestampArray) Then For $i = 0 To UBound($timestampArray) - 1 ConsoleWrite($timestampArray[$i] & @CRLF) Next EndIf
  5. Wrong RunAs Parameters #include <ScaleSetup.au3> #include <AutoItConstants.au3> ScaleInstall() Func ScaleInstall() ; Change the username and password to the appropriate values for your system. Local $sUserName = "administrator" Local $sPassword = "mypassword" Local $ComputerName = @ComputerName Local $FilePath = "d:\install\Weight\Megalen_scale.exe" ; Install Shekel OPOS with the window maximized. Program will run under the user previously specified. Local $iPID = RunAs($sUserName, $ComputerName, $sPassword, $RUN_LOGON_NOPROFILE, $FilePath, "", @SW_SHOWMAXIMIZED) ConsoleWrite("+ PID: " & $iPID & ' - Error:'& @error & @CRLF) ; Wait for 4 seconds. Sleep(4000) ; Close the setup process using the PID returned by RunAs. ProcessClose($iPID) EndFunc ;==>ScaleInstall or #RequireAdmin Local $FilePath = "d:\install\Weight\Megalen_scale.exe" Local $iPID = Run( $FilePath, "", @SW_SHOWMAXIMIZED) ConsoleWrite("+ PID: " & $iPID & ' - Error:'& @error & @CRLF)
  6. It needs to be done by AutoIT.exe and AutoIT_x64.exe, if you write it yourself, it's too easy and makes no sense.
  7. I think 90% of users install AutoIT to script and distribute the product as binary. The remaining 10% only need AutoIT.exe to run the script. Therefore, only 2 versions need to be distributed. - version 1: includes only AutoIT.exe and AutoIT_x64.exe - version 2: full-featured and editor. But because AutoIT always has script_breaking_changes in versions up. When i distribution with the original code will include AutoIT.exe and AutoIT_x64.exe versions respectively. All of the above I suggest just distributing a single full-featured version. No. Exactly 1 feature for 'AutoIT.exe' and 'AutoIT_x64.exe' When launching 'AutoIT.exe' will search for a file with the same name as the executable (in this example the original name 'AutoIT') with precedence 'AutoIT.au3' and then 'AutoIT' .a3x', if 'AutoIT.au3' file exists in the same 'AutoIT.exe' folder then 'AutoIT.exe' will run the 'AutoIT.au3' script instead of displaying the 'Run script:' selection dialog.
  8. Thanks for your dedication, Jon. I have 2 wishes with AutoIT. Above all, I'm really looking forward to releasing the Autoit installer with full SCITE. Second, if possible, when running AutoIT.exe with any name it will automatically search for the au3 or a3x script with the same name as the exe without showing the path selection dialog.
  9. Sorry for the unclear question. I don't understand what AutoIT's IsNumber function is used for? if the input data type is already numeric then it must be numeric, up I think it has to compare with different data types, specifically here is string.
  10. I found this UDF to be a perfect alternative, but not the intent of my question: Code quote: Dim $aNumbers[21] $aNumbers[1] = 12345 $aNumbers[2] = "-12345" $aNumbers[3] = +12345.678 $aNumbers[4] = "12345.678" $aNumbers[5] = "One" $aNumbers[6] = "" $aNumbers[7] = "123.One" $aNumbers[8] = 0xFF1165AB $aNumbers[9] = "0x0000Ff" $aNumbers[10] = 0x0000 $aNumbers[11] = "0x0000GG" $aNumbers[12] = 4.395179e+003 $aNumbers[13] = "4.395179e+003" $aNumbers[14] = 4.395179e-003 $aNumbers[15] = "4.395179e-003" $aNumbers[16] = 4e-003 $aNumbers[17] = 4E+003 $aNumbers[18] = "4e-003" $aNumbers[19] = "4E+003" For $i = 1 To 20 Step 1 MsgBox(0,"IsNumeric", '$aNumbers['& $i & '] = ' & $aNumbers[$i] & @CRLF & @CRLF & 'IsNumber() = ' & IsNumber($aNumbers[$i]) & @CRLF & @CRLF & 'IsString() = ' & IsString($aNumbers[$i]) & @CRLF & @CRLF & 'Number() = ' & Number($aNumbers[$i]) & @CRLF & @CRLF & '_IsNumerical() = ' & _IsNumerical($aNumbers[$i]) & @crlf ) Next ; #FUNCTION# ============================================================== ; Name...........: _IsNumerical ; Description ...: Uses a regular expression to check if $vValue can be interpreted as a numeric value ; Syntax.........: _IsNumerical($vValue) ; Parameters ....: $vValue - Value to test if it is numerical ; Return values .: True - If $vValue contains a numeric value ; ...............: False- If $vValue contains a non-numeric value ; Author ........: Bowmore <bowmore at lineone dot net> ; Modified.......: ; Remarks .......: Accepts values in Decimal, Hex and Exponential format. If $vValue is a string then ; the whole string must be numeric value for the function to return True ; Related .......: IsNumber, Number ; Link ..........: ; Example .......: Yes ; =============================================================== Func _IsNumerical($vValue) If IsNumber($vValue) Then Return True If StringRegExp($vValue, "(^[+-]?[0-9]+\.?[0-9]*$|^0x[0-9A-Fa-f]{1,8}$|^[0-9]+\.?[0-9]*[Ee][+-][0-9]+$)") Then Return True Return False EndFunc
  11. Eg 1: Global $exString = '1100' ConsoleWrite("StringIsDigit(" & $exString & ")=" & StringIsDigit($exString) & @CRLF) ConsoleWrite("IsInt(" & $exString & ")=" & IsInt($exString) & @CRLF) ConsoleWrite("IsNumber(" & $exString & ")=" & IsNumber($exString) & @CRLF) MsgBox(0, "Is Numerical ?","StringIsDigit(" & $exString & ")=" & StringIsDigit($exString) & @CRLF & "IsInt(" & $exString & ")=" & IsInt($exString) & @CRLF & "IsNumber(" & $exString & ")=" & IsNumber($exString)) EG2: if treat variable as number it works but value is not correct because i am checking input data is numeric or string: ;Global $exString = 'xx1100' Global $exString = '1100xx' $exString = Number($exString) ConsoleWrite("StringIsDigit(" & $exString & ")=" & StringIsDigit($exString) & @CRLF) ConsoleWrite("IsInt(" & $exString & ")=" & IsInt($exString) & @CRLF) ConsoleWrite("IsNumber(" & $exString & ")=" & IsNumber($exString) & @CRLF) MsgBox(0, "Is Numerical ?","StringIsDigit(" & $exString & ")=" & StringIsDigit($exString) & @CRLF & "IsInt(" & $exString & ")=" & IsInt($exString) & @CRLF & "IsNumber(" & $exString & ")=" & IsNumber($exString))
  12. Trong

    ImageSearchUDF

    The dll is already integrated in the UDF, you don't need to copy the dll!
  13. Not related to autoit but, I use these 2 tools to scan the network: https://www.advanced-ip-scanner.com/ advanced-port-scanner.com
  14. I use it for source code protection. By saving the data to Rescource RCDATA and encrypting and packaging the exe file. Decompiled Autoit source code doesn't seem too difficult, but Unpack technique is not everyone can do! #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Change2CUI=y #AutoIt3Wrapper_Res_File_Add=FileNameInDisk.ext, RT_RCDATA, FileNameInRes, 0 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** If Not @Compiled Then Exit MsgBox(64, "", "You need Compile this script !") Global $FileContent = _RCDATA_GetResAsString('FileNameInRes') ConsoleWrite("Get Resource AsString E: " & @error & @CRLF) ConsoleWrite("Resource Type: " & VarGetType($FileContent) & @CRLF) ConsoleWrite("-Data (" & StringLen($FileContent) & "): " & $FileContent & @CRLF) Sleep(1000) _WriteToFile(@ScriptDir & "\" & "_FileNameInDisk_1.ext", $FileContent, 16) Global $FileContent = _RCDATA_GetResAsBytes('FileNameInRes') ConsoleWrite("Get Resource AsBytes E: " & @error & @CRLF) ConsoleWrite("Resource Type: " & VarGetType($FileContent) & @CRLF) ConsoleWrite("-Data (" & StringLen($FileContent) & "): " & $FileContent & @CRLF) Sleep(1000) _WriteToFile(@ScriptDir & "\" & "_FileNameInDisk_2.ext", $FileContent, 16) Sleep(5000) Func _WriteToFile($pFile, $sData = '', $Mode = 16) FileDelete($pFile) ConsoleWrite("+File: " & $pFile & @CRLF) ;ConsoleWrite("-Data: " & $sData & @CRLF) ConsoleWrite("-Data len: " & StringLen($sData) & @CRLF) Local $hOpen = FileOpen($pFile, 2 + 8 + $Mode) ConsoleWrite("-FileOpen " & $pFile & " E: " & @error & @CRLF) Local $FileWrite = FileWrite($hOpen, $sData) ConsoleWrite("-FileWrite (" & $FileWrite & ") " & $pFile & " E: " & @error & @CRLF) FileClose($hOpen) ConsoleWrite("-FileClose " & $pFile & " E: " & @error & @CRLF) ConsoleWrite("-FileExists: " & FileExists($pFile) & @CRLF) Sleep(500) EndFunc ;==>_WriteToFile ; # Dao Van Trong - TRONG.LIVE # ======================================================= ; Title .........: Resource UDF for RCDATA ; ; _RCDATA_GetResAsBytes($sResNameOrID, $iResLang = 0) ; _RCDATA_GetResAsString($sResNameOrID, $iResLang = 0) ; ; ================================================================ #Region - # FUNCTION # Func _RCDATA_GetResAsBytes($sResNameOrID, $iResLang = 0) Local $hRes, $hInstance = __WinAPI_GetModuleHandle(Null) If ($iResLang <> 0) Then $hRes = __WinAPI_FindResourceEx($hInstance, 10, $sResNameOrID, $iResLang) ;$RT_RCDATA = 10 Else $hRes = __WinAPI_FindResource($hInstance, 10, $sResNameOrID) EndIf If @error Or Not $hRes Then Return SetError(1, 0, 0) Local $dSize = __WinAPI_SizeOfResource($hInstance, $hRes) If @error Or Not $dSize Then Return SetError(2, 0, 0) Local $hLoad = __WinAPI_LoadResource($hInstance, $hRes) If @error Or Not $hLoad Then Return SetError(3, 0, 0) Local $pData = __WinAPI_LockResource($hLoad) If @error Or Not $pData Then Return SetError(4, 0, 0) Local $tBuffer = DllStructCreate("byte[" & $dSize & "]") __WinAPI_MoveMemory(DllStructGetPtr($tBuffer), $pData, $dSize) Return DllStructGetData($tBuffer, 1) EndFunc ;==>_RCDATA_GetResAsBytes Func _RCDATA_GetResAsString($sResNameOrID, $iResLang = 0) Local $pResource = _RCDATA_GetResAsBytes($sResNameOrID, $iResLang) If @error Then Return SetError(1, 0, 0) Local $iError = @error, $iLength = @extended Local Enum $BINARYTOSTRING_NONE, $BINARYTOSTRING_ANSI, $BINARYTOSTRING_UTF16LE, $BINARYTOSTRING_UTF16BE, $BINARYTOSTRING_UTF8 Local $iStart = $BINARYTOSTRING_NONE, $iUTFEncoding = $BINARYTOSTRING_ANSI Local Const $sUTF8 = '0xEFBBBF', $sUTF16BE = '0xFEFF', $sUTF16LE = '0xFFFE', $sUTF32BE = '0x0000FEFF', $sUTF32LE = '0xFFFE0000' Local $iUTF8 = BinaryLen($sUTF8), $iUTF16BE = BinaryLen($sUTF16BE), $iUTF16LE = BinaryLen($sUTF16LE), $iUTF32BE = BinaryLen($sUTF32BE), $iUTF32LE = BinaryLen($sUTF32LE) Select Case BinaryMid($pResource, 1, $iUTF32BE) = $sUTF32BE $iStart = $iUTF32BE $iUTFEncoding = $BINARYTOSTRING_ANSI Case BinaryMid($pResource, 1, $iUTF32LE) = $sUTF32LE $iStart = $iUTF32LE $iUTFEncoding = $BINARYTOSTRING_ANSI Case BinaryMid($pResource, 1, $iUTF16BE) = $sUTF16BE $iStart = $iUTF16BE $iUTFEncoding = $BINARYTOSTRING_UTF16BE Case BinaryMid($pResource, 1, $iUTF16LE) = $sUTF16LE $iStart = $iUTF16LE $iUTFEncoding = $BINARYTOSTRING_UTF16LE Case BinaryMid($pResource, 1, $iUTF8) = $sUTF8 $iStart = $iUTF8 $iUTFEncoding = $BINARYTOSTRING_UTF8 EndSelect $iStart += 1 $iLength = $iLength + 1 - $iStart Local $sString = BinaryToString(BinaryMid($pResource, $iStart), $iUTFEncoding) $pResource = 0 Return SetError($iError, $iLength, $sString) EndFunc ;==>_RCDATA_GetResAsString #EndRegion - # FUNCTION # #Region ; #INTERNAL_USE_ONLY# # Dao Van Trong - TRONG.LIVE ;#include <WinAPIRes.au3> ;#include <WinAPIInternals.au3> Func __WinAPI_GetModuleHandle($sModuleName) If $sModuleName = "" Then $sModuleName = Null Local $aCall = DllCall("kernel32.dll", "handle", "GetModuleHandleW", "wstr", $sModuleName) If @error Then Return SetError(@error, @extended, 0) Return $aCall[0] EndFunc ;==>__WinAPI_GetModuleHandle Func __WinAPI_IsBadReadPtr($pAddress, $iLength) Local $aCall = DllCall('kernel32.dll', 'bool', 'IsBadReadPtr', 'struct*', $pAddress, 'uint_ptr', $iLength) If @error Then Return SetError(@error, @extended, False) Return $aCall[0] EndFunc ;==>__WinAPI_IsBadReadPtr Func __WinAPI_IsBadWritePtr($pAddress, $iLength) Local $aCall = DllCall('kernel32.dll', 'bool', 'IsBadWritePtr', 'struct*', $pAddress, 'uint_ptr', $iLength) If @error Then Return SetError(@error, @extended, False) Return $aCall[0] EndFunc ;==>__WinAPI_IsBadWritePtr Func __WinAPI_MoveMemory($pDestination, $pSource, $iLength) If __WinAPI_IsBadReadPtr($pSource, $iLength) Then Return SetError(10, @extended, 0) If __WinAPI_IsBadWritePtr($pDestination, $iLength) Then Return SetError(11, @extended, 0) DllCall('ntdll.dll', 'none', 'RtlMoveMemory', 'struct*', $pDestination, 'struct*', $pSource, 'ulong_ptr', $iLength) If @error Then Return SetError(@error, @extended, 0) Return 1 EndFunc ;==>__WinAPI_MoveMemory Func __WinAPI_FindResource($hInstance, $sType, $sName) Local $sTypeOfType = 'int', $sTypeOfName = 'int' If IsString($sType) Then $sTypeOfType = 'wstr' EndIf If IsString($sName) Then $sTypeOfName = 'wstr' EndIf Local $aCall = DllCall('kernel32.dll', 'handle', 'FindResourceW', 'handle', $hInstance, $sTypeOfName, $sName, $sTypeOfType, $sType) If @error Then Return SetError(@error, @extended, 0) Return $aCall[0] EndFunc ;==>__WinAPI_FindResource Func __WinAPI_FindResourceEx($hInstance, $sType, $sName, $iLanguage) Local $sTypeOfType = 'int', $sTypeOfName = 'int' If IsString($sType) Then $sTypeOfType = 'wstr' EndIf If IsString($sName) Then $sTypeOfName = 'wstr' EndIf Local $aCall = DllCall('kernel32.dll', 'handle', 'FindResourceExW', 'handle', $hInstance, $sTypeOfType, $sType, $sTypeOfName, $sName, 'ushort', $iLanguage) If @error Then Return SetError(@error, @extended, 0) Return $aCall[0] EndFunc ;==>__WinAPI_FindResourceEx Func __WinAPI_LoadResource($hInstance, $hResource) Local $aCall = DllCall('kernel32.dll', 'handle', 'LoadResource', 'handle', $hInstance, 'handle', $hResource) If @error Then Return SetError(@error, @extended, 0) Return $aCall[0] EndFunc ;==>__WinAPI_LoadResource Func __WinAPI_LockResource($hData) Local $aCall = DllCall('kernel32.dll', 'ptr', 'LockResource', 'handle', $hData) If @error Then Return SetError(@error, @extended, 0) Return $aCall[0] EndFunc ;==>__WinAPI_LockResource Func __WinAPI_SizeOfResource($hInstance, $hResource) Local $aCall = DllCall('kernel32.dll', 'dword', 'SizeofResource', 'handle', $hInstance, 'handle', $hResource) If @error Or Not $aCall[0] Then Return SetError(@error, @extended, 0) Return $aCall[0] EndFunc ;==>__WinAPI_SizeOfResource #EndRegion ; #INTERNAL_USE_ONLY# # Dao Van Trong - TRONG.LIVE ;# Dao Van Trong - TRONG.LIVE
  15. In my code optimization work, I only work with these 2 functions so I share it: ; # Dao Van Trong - TRONG.LIVE # ======================================================= ; Title .........: Resource UDF for RCDATA ; ; _RCDATA_GetResAsBytes($sResNameOrID, $iResLang = 0) ; _RCDATA_GetResAsString($sResNameOrID, $iResLang = 0) ; ; ================================================================ #Region - # FUNCTION # Func _RCDATA_GetResAsBytes($sResNameOrID, $iResLang = 0) Local $hRes, $hInstance = __WinAPI_GetModuleHandle(Null) If ($iResLang <> 0) Then $hRes = __WinAPI_FindResourceEx($hInstance, 10, $sResNameOrID, $iResLang) ;$RT_RCDATA = 10 Else $hRes = __WinAPI_FindResource($hInstance, 10, $sResNameOrID) EndIf If @error Or Not $hRes Then Return SetError(1, 0, 0) Local $dSize = __WinAPI_SizeOfResource($hInstance, $hRes) If @error Or Not $dSize Then Return SetError(2, 0, 0) Local $hLoad = __WinAPI_LoadResource($hInstance, $hRes) If @error Or Not $hLoad Then Return SetError(3, 0, 0) Local $pData = __WinAPI_LockResource($hLoad) If @error Or Not $pData Then Return SetError(4, 0, 0) Local $tBuffer = DllStructCreate("byte[" & $dSize & "]") __WinAPI_MoveMemory(DllStructGetPtr($tBuffer), $pData, $dSize) Return DllStructGetData($tBuffer, 1) EndFunc ;==>_RCDATA_GetResAsBytes Func _RCDATA_GetResAsString($sResNameOrID, $iResLang = 0) Local $pResource = _RCDATA_GetResAsBytes($sResNameOrID, $iResLang) If @error Then Return SetError(1, 0, 0) Local $iError = @error, $iLength = @extended Local Enum $BINARYTOSTRING_NONE, $BINARYTOSTRING_ANSI, $BINARYTOSTRING_UTF16LE, $BINARYTOSTRING_UTF16BE, $BINARYTOSTRING_UTF8 Local $iStart = $BINARYTOSTRING_NONE, $iUTFEncoding = $BINARYTOSTRING_ANSI Local Const $sUTF8 = '0xEFBBBF', $sUTF16BE = '0xFEFF', $sUTF16LE = '0xFFFE', $sUTF32BE = '0x0000FEFF', $sUTF32LE = '0xFFFE0000' Local $iUTF8 = BinaryLen($sUTF8), $iUTF16BE = BinaryLen($sUTF16BE), $iUTF16LE = BinaryLen($sUTF16LE), $iUTF32BE = BinaryLen($sUTF32BE), $iUTF32LE = BinaryLen($sUTF32LE) Select Case BinaryMid($pResource, 1, $iUTF32BE) = $sUTF32BE $iStart = $iUTF32BE $iUTFEncoding = $BINARYTOSTRING_ANSI Case BinaryMid($pResource, 1, $iUTF32LE) = $sUTF32LE $iStart = $iUTF32LE $iUTFEncoding = $BINARYTOSTRING_ANSI Case BinaryMid($pResource, 1, $iUTF16BE) = $sUTF16BE $iStart = $iUTF16BE $iUTFEncoding = $BINARYTOSTRING_UTF16BE Case BinaryMid($pResource, 1, $iUTF16LE) = $sUTF16LE $iStart = $iUTF16LE $iUTFEncoding = $BINARYTOSTRING_UTF16LE Case BinaryMid($pResource, 1, $iUTF8) = $sUTF8 $iStart = $iUTF8 $iUTFEncoding = $BINARYTOSTRING_UTF8 EndSelect $iStart += 1 $iLength = $iLength + 1 - $iStart Local $sString = BinaryToString(BinaryMid($pResource, $iStart), $iUTFEncoding) $pResource = 0 Return SetError($iError, $iLength, $sString) EndFunc ;==>_RCDATA_GetResAsString #EndRegion - # FUNCTION # #Region ; #INTERNAL_USE_ONLY# # Dao Van Trong - TRONG.LIVE ;#include <WinAPIRes.au3> ;#include <WinAPIInternals.au3> Func __WinAPI_GetModuleHandle($sModuleName) If $sModuleName = "" Then $sModuleName = Null Local $aCall = DllCall("kernel32.dll", "handle", "GetModuleHandleW", "wstr", $sModuleName) If @error Then Return SetError(@error, @extended, 0) Return $aCall[0] EndFunc ;==>__WinAPI_GetModuleHandle Func __WinAPI_IsBadReadPtr($pAddress, $iLength) Local $aCall = DllCall('kernel32.dll', 'bool', 'IsBadReadPtr', 'struct*', $pAddress, 'uint_ptr', $iLength) If @error Then Return SetError(@error, @extended, False) Return $aCall[0] EndFunc ;==>__WinAPI_IsBadReadPtr Func __WinAPI_IsBadWritePtr($pAddress, $iLength) Local $aCall = DllCall('kernel32.dll', 'bool', 'IsBadWritePtr', 'struct*', $pAddress, 'uint_ptr', $iLength) If @error Then Return SetError(@error, @extended, False) Return $aCall[0] EndFunc ;==>__WinAPI_IsBadWritePtr Func __WinAPI_MoveMemory($pDestination, $pSource, $iLength) If __WinAPI_IsBadReadPtr($pSource, $iLength) Then Return SetError(10, @extended, 0) If __WinAPI_IsBadWritePtr($pDestination, $iLength) Then Return SetError(11, @extended, 0) DllCall('ntdll.dll', 'none', 'RtlMoveMemory', 'struct*', $pDestination, 'struct*', $pSource, 'ulong_ptr', $iLength) If @error Then Return SetError(@error, @extended, 0) Return 1 EndFunc ;==>__WinAPI_MoveMemory Func __WinAPI_FindResource($hInstance, $sType, $sName) Local $sTypeOfType = 'int', $sTypeOfName = 'int' If IsString($sType) Then $sTypeOfType = 'wstr' EndIf If IsString($sName) Then $sTypeOfName = 'wstr' EndIf Local $aCall = DllCall('kernel32.dll', 'handle', 'FindResourceW', 'handle', $hInstance, $sTypeOfName, $sName, $sTypeOfType, $sType) If @error Then Return SetError(@error, @extended, 0) Return $aCall[0] EndFunc ;==>__WinAPI_FindResource Func __WinAPI_FindResourceEx($hInstance, $sType, $sName, $iLanguage) Local $sTypeOfType = 'int', $sTypeOfName = 'int' If IsString($sType) Then $sTypeOfType = 'wstr' EndIf If IsString($sName) Then $sTypeOfName = 'wstr' EndIf Local $aCall = DllCall('kernel32.dll', 'handle', 'FindResourceExW', 'handle', $hInstance, $sTypeOfType, $sType, $sTypeOfName, $sName, 'ushort', $iLanguage) If @error Then Return SetError(@error, @extended, 0) Return $aCall[0] EndFunc ;==>__WinAPI_FindResourceEx Func __WinAPI_LoadResource($hInstance, $hResource) Local $aCall = DllCall('kernel32.dll', 'handle', 'LoadResource', 'handle', $hInstance, 'handle', $hResource) If @error Then Return SetError(@error, @extended, 0) Return $aCall[0] EndFunc ;==>__WinAPI_LoadResource Func __WinAPI_LockResource($hData) Local $aCall = DllCall('kernel32.dll', 'ptr', 'LockResource', 'handle', $hData) If @error Then Return SetError(@error, @extended, 0) Return $aCall[0] EndFunc ;==>__WinAPI_LockResource Func __WinAPI_SizeOfResource($hInstance, $hResource) Local $aCall = DllCall('kernel32.dll', 'dword', 'SizeofResource', 'handle', $hInstance, 'handle', $hResource) If @error Or Not $aCall[0] Then Return SetError(@error, @extended, 0) Return $aCall[0] EndFunc ;==>__WinAPI_SizeOfResource #EndRegion ; #INTERNAL_USE_ONLY# # Dao Van Trong - TRONG.LIVE ;# Dao Van Trong - TRONG.LIVE
  16. great, i like PureBasic too
  17. 🙃 ConsoleWrite("- Is Windows 11: " & _IsWindows_11() & @CRLF) ;ConsoleWrite("- Is Windows Server 2022: " &_IsWindows_22() & @CRLF) Func _IsWindows_11() If StringInStr(@OSVersion, "11") Or StringInStr(_GetOS_Name(), "11") Then Return 1 Return 0 EndFunc ;==>_IsWindows_11 Func _IsWindows_22() If StringInStr(@OSVersion, "22") Or StringInStr(_GetOS_Name(), "22") Then Return 1 Return 0 EndFunc ;==>_IsWindows_22 Func _GetOS_Name() Local $OSname, $objItem = "", $strComputer = ".", $wbemFlagReturnImmediately = 0x10, $wbemFlagForwardOnly = 0x20 Local $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\") Local $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) Then For $objItem In $colItems $OSname = $objItem.Caption ConsoleWrite("> System: " & $OSname & @CRLF) Return $OSname Next Else ConsoleWrite("! No WMI Objects Found for class: Win32_OperatingSystem" & @CRLF) Return SetError(1, 0, "") EndIf EndFunc ;==>_GetOS_Name ; DAO VAN TRONG - TRONG.LIVE
  18. https://www.google.com/search?q=bypass+windows+11+hardware+requirements https://www.tomshardware.com/how-to/bypass-windows-11-tpm-requirement https://appuals.com/bypass-windows-11-installation-requirements/
  19. You don't need a computer that's compatible with Microsoft's requirements. They make those requirements for the best use of windows. I use windows 11 on a 4th gen intel laptop with 4GB of RAM it doesn't seem any slower than previous windows 10. Of course with some tricks to bypass the hardware check of windows 11.
  20. I think you should do a test! With windows 11 running on my laptop, the inet function works properly. IE Mode will continue to be supported until 2029
  21. Couldn't be more detailed in the div tag, to use _StringBetween(). And your Regex code is not working correctly either. Script with regex: #include <String.au3> Global $HTML_Test $HTML_Test &= '<div class="0">[' & @CRLF ; $HTML_Test &= '<code unknown code 1>' & @CRLF ; $HTML_Test &= '<div class="1">[' & @CRLF ; $HTML_Test &= '<code unknown code 2>' & @CRLF ; $HTML_Test &= '<div class="2 3 4">[' & @CRLF ; $HTML_Test &= '<code unknown code 3>' & @CRLF ; $HTML_Test &= '2]</div>' & @CRLF ; $HTML_Test &= '<code unknown code 4>' & @CRLF ; $HTML_Test &= '1]</div>' & @CRLF ; $HTML_Test &= '<code unknown code 5>' & @CRLF ; $HTML_Test &= '0]</div>' & @CRLF ; Global $rSearch = _BetweenString($HTML_Test, '<div class="1">', '</div>') ConsoleWrite('! ============================' & @CRLF & $rSearch & @CRLF & '! ============================' & @CRLF) Exit Func _BetweenString($iString, $iStart, $iEnd) Local $aSearch = StringRegExp($iString, '(?s)' & $iStart & '(.*)' & $iEnd, 3) If IsArray($aSearch) Then For $i = 0 To UBound($aSearch) - 1 ;ConsoleWrite('!-> SB Return: ' & $aSearch[$i] & @CRLF) If ($aSearch[$i] <> "") Then Return $aSearch[$i] Next Else ConsoleWrite('! SB: No strings found. ' & @CRLF) EndIf EndFunc ;==>_BetweenString
  22. I'm having trouble trying to collect data that's inside an html tag, I haven't found a solution to it yet. If you have ideas please help. Thank you Script: #include <String.au3> Global $HTML_Test $HTML_Test &= '<div class="accordion-item">' & @CRLF ; <!---- START GET--> $HTML_Test &= ' <div class="accordion-inner">' & @CRLF $HTML_Test &= ' <p>Khoá an toàn giúp bếp luôn được an toàn</p>' & @CRLF $HTML_Test &= ' </div>' & @CRLF $HTML_Test &= ' <a href="#" class="accordion-title plain">' & @CRLF $HTML_Test &= ' <button class="toggle">' & @CRLF $HTML_Test &= ' <i class="icon-angle-down"></i>' & @CRLF $HTML_Test &= ' </button>' & @CRLF $HTML_Test &= ' <span>Khoá an toàn</span>' & @CRLF $HTML_Test &= ' </a>' & @CRLF $HTML_Test &= '</div>' & @CRLF ;<!---- END GET --> Global $aSearch = _StringBetween($HTML_Test, '<div class="accordion-item">', '</div>') If IsArray($aSearch) Then For $i = 0 To UBound($aSearch) - 1 ConsoleWrite('!-> SB Return: ' & $aSearch[$i] & @CRLF) Next Else ConsoleWrite('! SB: No strings found. ' & @CRLF) EndIf Unexpected output: <div class="accordion-inner"> <p>Khoá an toàn giúp bếp luôn được an toàn</p> Input: <div class="accordion-item"> <div class="accordion-inner"> <p>Khoá an toàn giúp bếp luôn được an toàn</p> </div> <a href="#" class="accordion-title plain"> <button class="toggle"> <i class="icon-angle-down"></i> </button> <span>Khoá an toàn</span> </a> </div> Desired output: <div class="accordion-inner"> <p>Khoá an toàn giúp bếp luôn được an toàn</p> </div> <a href="#" class="accordion-title plain"> <button class="toggle"> <i class="icon-angle-down"></i> </button> <span>Khoá an toàn</span> </a>
  23. Thank you very much for noticing my error, it has been fixed!
  24. The steps for this function are: 1. Write the current program's PID to the Registry. 2. Pause the program, so that other programs can start more slowly overwrite the value. 3. Check the initial PID value, if it is different, exit because another program starts later. 4. Check once again if there exist applications with the same name running. 5. Delete the temporary reg key just written above. If the application runs normally then the chance of an error is 0%!
×
×
  • Create New...