Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/24/2025 in Posts

  1. In several of my projects, I have continued to use (and improve upon) the wonderful _WinAPI_DwmEnableBlurBehindWindow10 script by @scintilla4evr which paved the way for blur options on modern versions of Windows. I have completely opened the script up with more options and wanted to share the results back with the community for anyone else to enjoy. I have renamed the function to _WinAPI_DwmEnableBlurBehindWindow11 since it is geared more toward Windows 11 options. It may or may not work with Windows 10. Some of the AccentFlags may need to be adjusted with Windows 10. And I've made it possible to change those values when calling the function. Maybe somebody will make some sort of continuously changing, random color changing blur increasing and decreasing levels of color transparency with it. 😄 I have included inside the function the contents of a function called _percentageOfHex() that was shared to me by @argumentum that takes a percentage 0-100 and returns the Hexadecimal color code for transparency which gets put together with the main color passed to form a COLORREF that can control color transparency levels. I combined that function into _WinAPI_DwmEnableBlurBehindWindow11 to keep things as simple as possible. Script with Example:
    2 points
  2. You're welcome. And thank you for the sharing your example as well with the buttons. Your example makes more sense for being able to play around with the example. I've never been very good with examples. I was working on another example earlier today using a slider to automatically change the color transparency in real-time and it's working well. So I think what I will do is combine my slider example with your example and should make for a good example in the end. Also, I was thinking of adding an input box (likely a color picker too) to change color. And with that, maybe a "Random Color" button as well.
    2 points
  3. I had a dissatisfaction with IsNumber so this function was born: ; ========================================================================================= ; UDF: DataTypeChecker.au3 (strict-hex + numeric formats + IEEE754 + self-test: _RunSelfTest() ) ; Author: Dao Van Trong - TRONG.PRO ; Notes: ; - Type codes start at 1 (String = 1). IEEE-754 subtypes continue up to 24. ; - Unknown returns 0 (no numeric code assigned). ; - String detection order: Hex (0x... or bare even-length [0-9A-Fa-f]) → ; Numeric (US/EU/Thousands/Simple-EU) → Boolean-like → fallback String. ; - HWND is checked before Ptr to avoid misclassification. ; ========================================================================================= ; -------- Global Type Codes (1..24) -------- Global Const $TYPE_STRING = 1 Global Const $TYPE_INT32 = 2 Global Const $TYPE_INT64 = 3 Global Const $TYPE_DOUBLE = 4 Global Const $TYPE_BINARY = 5 Global Const $TYPE_BOOLEAN = 6 Global Const $TYPE_ARRAY = 7 Global Const $TYPE_MAP = 8 Global Const $TYPE_PTR = 9 Global Const $TYPE_STRUCT = 10 Global Const $TYPE_HWND = 11 Global Const $TYPE_OBJECT = 12 Global Const $TYPE_KEYWORD = 13 Global Const $TYPE_FUNCTION = 14 Global Const $TYPE_USERFUNCTION = 15 ; IEEE-754 sub-categories for Double Global Const $TYPE_POS_ZERO = 16 Global Const $TYPE_NEG_ZERO = 17 Global Const $TYPE_DENORMAL_POS = 18 Global Const $TYPE_DENORMAL_NEG = 19 Global Const $TYPE_NORMAL_POS = 20 Global Const $TYPE_NORMAL_NEG = 21 Global Const $TYPE_POS_INFINITY = 22 Global Const $TYPE_NEG_INFINITY = 23 Global Const $TYPE_NAN = 24 ; Unknown uses 0 (no constant) ; -------- Code → Name -------- Func _GetDataTypeName($i) Select Case $i = $TYPE_STRING Return "String" Case $i = $TYPE_INT32 Return "Int32" Case $i = $TYPE_INT64 Return "Int64" Case $i = $TYPE_DOUBLE Return "Double/Float" Case $i = $TYPE_BINARY Return "Binary/Hex" Case $i = $TYPE_BOOLEAN Return "Boolean" Case $i = $TYPE_ARRAY Return "Array" Case $i = $TYPE_MAP Return "Map" Case $i = $TYPE_PTR Return "Pointer" Case $i = $TYPE_STRUCT Return "DLL Struct" Case $i = $TYPE_HWND Return "Window Handle" Case $i = $TYPE_OBJECT Return "Object" Case $i = $TYPE_KEYWORD Return "Keyword" Case $i = $TYPE_FUNCTION Return "Function" Case $i = $TYPE_USERFUNCTION Return "UserFunction" Case $i = $TYPE_POS_ZERO Return "+Zero" Case $i = $TYPE_NEG_ZERO Return "-Zero" Case $i = $TYPE_DENORMAL_POS Return "deNormal (+)" Case $i = $TYPE_DENORMAL_NEG Return "deNormal (−)" Case $i = $TYPE_NORMAL_POS Return "Normal (+)" Case $i = $TYPE_NORMAL_NEG Return "Normal (−)" Case $i = $TYPE_POS_INFINITY Return "+Infinity" Case $i = $TYPE_NEG_INFINITY Return "-Infinity" Case $i = $TYPE_NAN Return "NaN" Case Else Return "Unknown" EndSelect EndFunc ;==>_GetDataTypeName ; -------- IEEE-754 classifier for Double (robust for 64-bit via hi/low dwords) -------- Func _CheckIEEE754Category($dVal) ; Overlay: write the double, then read two dwords at the same address Local $tDouble = DllStructCreate("double") DllStructSetData($tDouble, 1, $dVal) Local $p = DllStructGetPtr($tDouble) Local $tWords = DllStructCreate("dword;dword", $p) ; [1]=low, [2]=high on little-endian Local $low = DllStructGetData($tWords, 1) Local $high = DllStructGetData($tWords, 2) Local $sign = BitAND(BitShift($high, 31), 1) Local $exp = BitAND(BitShift($high, 20), 0x7FF) Local $fracHigh = BitAND($high, 0x000FFFFF) Local $fracLow = $low Local $fracIsZero = ($fracHigh = 0 And $fracLow = 0) If $exp = 0 Then If $fracIsZero Then Return ($sign ? $TYPE_NEG_ZERO : $TYPE_POS_ZERO) Else Return ($sign ? $TYPE_DENORMAL_NEG : $TYPE_DENORMAL_POS) EndIf ElseIf $exp = 0x7FF Then If $fracIsZero Then Return ($sign ? $TYPE_NEG_INFINITY : $TYPE_POS_INFINITY) Else Return $TYPE_NAN EndIf Else Return ($sign ? $TYPE_NORMAL_NEG : $TYPE_NORMAL_POS) EndIf EndFunc ;==>_CheckIEEE754Category ; -------- Decide Int32 vs Int64 by range -------- Func _IntCodeFromNumber($n) If $n >= -2147483648 And $n <= 2147483647 Then Return $TYPE_INT32 Else Return $TYPE_INT64 EndIf EndFunc ;==>_IntCodeFromNumber ; -------- Normalize & classify numeric strings -------- ; Returns: type code (2/3 for ints OR IEEE-754 sub-codes 16..24 for doubles) Func _ParseNumericString($s) ; US: 1,234.56 → remove commas, parse with dot If StringRegExp($s, '^[+-]?\d{1,3}(,\d{3})*(\.\d+)?$') Then Local $u = StringReplace($s, ",", "") If StringInStr($u, ".") Then Return _CheckIEEE754Category(Number($u)) Else ; For grouped integers (US), we follow user's expectation: ; treat as Double category (Normal +/-) rather than Int32/Int64 Return _CheckIEEE754Category(Number($u)) EndIf EndIf ; EU: 1.234,56 → remove dots, replace comma with dot If StringRegExp($s, '^[+-]?\d{1,3}(\.\d{3})*(,\d+)?$') Then Local $e = StringReplace(StringReplace($s, ".", ""), ",", ".") If StringInStr($s, ",") Then Return _CheckIEEE754Category(Number($e)) Else ; Grouped integer (EU) → follow same rule: classify via IEEE-754 Return _CheckIEEE754Category(Number($e)) EndIf EndIf ; Thousands only: 1,234 or 1.234 → strip separators If StringRegExp($s, '^[+-]?\d{1,3}([,\.]\d{3})+$') Then Local $t = StringReplace(StringReplace($s, ",", ""), ".", "") ; Per user's expected results: treat grouped integer as Double category Return _CheckIEEE754Category(Number($t)) EndIf ; Simple EU decimals: 123,45 → replace comma with dot If StringRegExp($s, '^[+-]?\d+,\d+$') Then Local $d = StringReplace($s, ",", ".") Return _CheckIEEE754Category(Number($d)) EndIf ; Plain ints/floats (no separators) If StringIsInt($s) Then Return _IntCodeFromNumber(Number($s)) If StringIsFloat($s) Then Return _CheckIEEE754Category(Number($s)) ; Not numeric Return 0 EndFunc ;==>_ParseNumericString ; -------- Parse strings: Hex → Numeric → Boolean-like → String -------- Func _ParseStringValue($s) $s = StringStripWS($s, 8) ; Hex with prefix 0x, body must have even length If StringRegExp($s, "^0[xX][0-9A-Fa-f]+$") Then Local $hexBody = StringMid($s, 3) If Mod(StringLen($hexBody), 2) = 0 Then Return $TYPE_BINARY EndIf ; Bare hex (0-9 A-F), even length accepted as hex (as requested) If StringRegExp($s, "^[0-9A-Fa-f]+$") Then If Mod(StringLen($s), 2) = 0 Then Return $TYPE_BINARY EndIf ; Numeric formats Local $numCode = _ParseNumericString($s) If $numCode <> 0 Then Return $numCode ; Boolean-like strings Switch StringLower($s) Case "true", "false" Return $TYPE_BOOLEAN EndSwitch ; Fallback string Return $TYPE_STRING EndFunc ;==>_ParseStringValue ; -------- Public: get type code for any value -------- Func _GetDataType($v) ; AutoIt-specific first (order matters) If IsArray($v) Then Return $TYPE_ARRAY If IsMap($v) Then Return $TYPE_MAP If IsHWnd($v) Then Return $TYPE_HWND If IsPtr($v) Then Return $TYPE_PTR If IsDllStruct($v) Then Return $TYPE_STRUCT If IsObj($v) Then Return $TYPE_OBJECT If IsKeyword($v) Then Return $TYPE_KEYWORD Local $sType = VarGetType($v) If IsFunc($v) Then If $sType = "UserFunction" Then Return $TYPE_USERFUNCTION Else Return $TYPE_FUNCTION EndIf EndIf ; Native primitives If $sType = "Int32" Then Return $TYPE_INT32 If $sType = "Int64" Then Return $TYPE_INT64 If $sType = "Double" Then Return _CheckIEEE754Category($v) If IsBinary($v) Then Return $TYPE_BINARY If IsBool($v) Then Return $TYPE_BOOLEAN ; Strings If IsString($v) Then Return _ParseStringValue($v) ; Unknown Return 0 EndFunc ;==>_GetDataType ; -------- Helper: is any numeric type? (native or string-based) -------- Func _IsNumber($v) Local $c = _GetDataType($v) Return ($c = $TYPE_INT32 Or $c = $TYPE_INT64 Or $c = $TYPE_DOUBLE Or _ $c = $TYPE_POS_ZERO Or $c = $TYPE_NEG_ZERO Or _ $c = $TYPE_DENORMAL_POS Or $c = $TYPE_DENORMAL_NEG Or _ $c = $TYPE_NORMAL_POS Or $c = $TYPE_NORMAL_NEG Or _ $c = $TYPE_POS_INFINITY Or $c = $TYPE_NEG_INFINITY Or _ $c = $TYPE_NAN) EndFunc ;==>_IsNumber ; ========================================================================================= ; SELF-TEST (English logs, prefixes: '+' OK, '!' ERROR, '-' INFO) ; ========================================================================================= Func _AddTest(ByRef $arr, $val, $expectedName, $label) ReDim $arr[UBound($arr) + 1][3] $arr[UBound($arr) - 1][0] = $val $arr[UBound($arr) - 1][1] = $expectedName $arr[UBound($arr) - 1][2] = $label EndFunc ;==>_AddTest Func __TestFunc() Return 1 EndFunc ;==>__TestFunc Func _RunSelfTest() ConsoleWrite("- Starting self-test..." & @CRLF) Local $tests[0][3] ; --- String fallback --- _AddTest($tests, "Hello", "String", "Plain string") ; Per requirement: bare [0-9A-F] with even length is HEX _AddTest($tests, "123ABC", "Binary/Hex", "Bare hex (even)") ; --- Int32 / Int64 --- _AddTest($tests, 42, "Int32", "Integer") _AddTest($tests, -999, "Int32", "Negative int") _AddTest($tests, 9223372036854775807, "Int64", "Max Int64") _AddTest($tests, -9223372036854775808, "Int64", "Min Int64") ; --- Double / IEEE754 normal --- _AddTest($tests, 3.14159, "Normal (+)", "Positive double") _AddTest($tests, -2.71828, "Normal (−)", "Negative double") ; --- Binary/Hex --- _AddTest($tests, "0x1A2B", "Binary/Hex", "Prefixed hex string") _AddTest($tests, "DEADBEEF", "Binary/Hex", "Bare hex string") ; --- Boolean --- _AddTest($tests, True, "Boolean", "True literal") _AddTest($tests, "false", "Boolean", "Boolean-like string") ; --- Array --- Local $arr[2] = [1, 2] _AddTest($tests, $arr, "Array", "Simple array") ; --- Map (correct syntax) --- Local $mMap[] $mMap["Key"] = "Value" _AddTest($tests, $mMap, "Map", "Map object") ; --- Ptr --- Local $p = Ptr(0x123456) _AddTest($tests, $p, "Pointer", "Pointer value") ; --- DllStruct --- Local $st = DllStructCreate("int;char[4]") _AddTest($tests, $st, "DLL Struct", "DllStruct sample") ; --- HWND (create GUI to ensure valid handle) --- Local $hGUI = GUICreate("DT Test", 1, 1, -100, -100) GUISetState(@SW_SHOW, $hGUI) _AddTest($tests, $hGUI, "Window Handle", "GUI handle") ; --- Object --- Local $o = ObjCreate("Scripting.Dictionary") _AddTest($tests, $o, "Object", "COM object") ; --- Keyword --- _AddTest($tests, Default, "Keyword", "Keyword Default") _AddTest($tests, Null, "Keyword", "Keyword Null") ; --- Function & UserFunction --- _AddTest($tests, Eval, "Function", "Builtin function") _AddTest($tests, __TestFunc, "UserFunction", "User-defined function") ; --- IEEE754 specials --- _AddTest($tests, +0.0, "+Zero", "Positive zero") _AddTest($tests, -0.0, "-Zero", "Negative zero") _AddTest($tests, (1.0 / 0.0), "+Infinity", "Positive infinity") _AddTest($tests, (-1.0 / 0.0), "-Infinity", "Negative infinity") _AddTest($tests, (0.0 / 0.0), "NaN", "Not-a-Number") ; --- Numeric strings: US/EU/Thousands/Simple-EU --- _AddTest($tests, "1,234.56", "Normal (+)", "US numeric string") _AddTest($tests, "1.234,56", "Normal (+)", "EU numeric string") _AddTest($tests, "1,234", "Normal (+)", "Thousand separator comma") _AddTest($tests, "1.234", "Normal (+)", "Thousand separator dot") _AddTest($tests, "123,45", "Normal (+)", "EU decimal comma") ; --- Run all --- For $i = 0 To UBound($tests) - 1 Local $input = $tests[$i][0] Local $expected = $tests[$i][1] Local $label = $tests[$i][2] Local $code = _GetDataType($input) Local $got = _GetDataTypeName($code) If $got = $expected Then ConsoleWrite("- " & '_IsNumber(' & $input & ") -> " & _IsNumber($input) & @CRLF) ConsoleWrite("+ " & $label & ' "' & $input & '" -> (' & $code & ') ' & $got & @CRLF) Else ConsoleWrite("! " & $label & ' "' & $input & '" -> (' & $code & ') ' & $got & " | Expected: " & $expected & @CRLF) EndIf Next ConsoleWrite("- Self-test complete." & @CRLF) ; Clean up GUI created for HWND test GUIDelete($hGUI) EndFunc ;==>_RunSelfTest ; ========================================================================================= ; Self-test routine: kiểm tra các giá trị mẫu và in PASS/FAIL ; ========================================================================================= Func _RunSelfTest2() Local $tests = [ _ ["String literal", "Hello", $TYPE_STRING], _ ["Int32 literal", 123, $TYPE_INT32], _ ["Int64 literal", 5000000000, $TYPE_INT64], _ ["Double normal +", 3.14, $TYPE_NORMAL_POS], _ ["Double normal −", -2.5, $TYPE_NORMAL_NEG], _ ["+Zero (double)", 0.0, $TYPE_POS_ZERO], _ ["-Zero (double)", -0.0, $TYPE_NEG_ZERO], _ ["Subnormal", Number("1e-320"), $TYPE_DENORMAL_POS], _ ["+Infinity", 1 / 0, $TYPE_POS_INFINITY], _ ["-Infinity", -1 / 0, $TYPE_NEG_INFINITY], _ ["NaN", 0 / 0, $TYPE_NAN], _ ["Hex 0x…", "0x1A2B", $TYPE_BINARY], _ ["Bare hex", "FACE", $TYPE_BINARY], _ ["US number", "1,234.56", $TYPE_NORMAL_POS], _ ["EU number", "1.234,56", $TYPE_NORMAL_POS], _ ["Thou only", "1,234", $TYPE_NORMAL_POS], _ ["Simple EU dec", "123,45", $TYPE_NORMAL_POS], _ ["Bool-like true", "true", $TYPE_BOOLEAN], _ ["Bool-like false", "false", $TYPE_BOOLEAN] _ ] Local $allOK = True ConsoleWrite(@CRLF & "---- Running DataTypeChecker Self-Test ----" & @CRLF) For $i = 0 To UBound($tests) - 1 Local $desc = $tests[$i][0] Local $val = $tests[$i][1] Local $exp = $tests[$i][2] Local $got = _GetDataType($val) Local $name = _GetDataTypeName($got) If $got = $exp Then ConsoleWrite("- _IsNumber(" & $val & ') -> ' & _IsNumber($val) & @CRLF) ConsoleWrite("+ PASS: " & $desc & ' "' & $val & '" -> ' & $name & " (" & $got & ")" & @CRLF) Else ConsoleWrite("! FAIL: " & $desc & ' "' & $val & '" -> Expected ' & _ _GetDataTypeName($exp) & " (" & $exp & "), Got " & _ $name & " (" & $got & ")" & @CRLF) $allOK = False EndIf Next ConsoleWrite("---- Self-Test " & ($allOK ? "+ PASSED" : "! FAILED") & " ----" & @CRLF & @CRLF) Return $allOK EndFunc ;==>_RunSelfTest2 ; Uncomment to run self-test on execute ; _RunSelfTest() ; _RunSelfTest2()
    1 point
  4. S: #Region Example Usage ; Example 1: Check a binary executable file Local $filePathBinary = @WindowsDir & "\explorer.exe" Local $fileInfoBinary = _GetFileDataType($filePathBinary) If @error Then MsgBox(4096, "Error", "Could not determine file type: " & $fileInfoBinary) Else Local $isBinary = (@extended = 1) ? "Binary" : "Text" MsgBox(4096, "Result (Binary)", "Path: " & $filePathBinary & @CRLF & _ "File Type: " & $fileInfoBinary & @CRLF & "Classification: " & $isBinary) EndIf ; Example 2: Check a text file (this AutoIt script) Local $filePathText = @ScriptFullPath Local $fileInfoText = _GetFileDataType($filePathText) If @error Then MsgBox(4096, "Error", "Could not determine file type: " & $fileInfoText) Else Local $isBinary = (@extended = 1) ? "Binary" : "Text" MsgBox(4096, "Result (Text)", "Path: " & $filePathText & @CRLF & _ "File Type: " & $fileInfoText & @CRLF & "Classification: " & $isBinary) EndIf #EndRegion Example Usage ; ================================================================================================= ; Function: _CheckDataType ; Purpose: Determine the data type code of any AutoIt variable or string. ; Parameters: ; $vInput - Any AutoIt variable or literal to examine. ; $bShowDebug - Optional. When True, debug messages are printed to the console. ; Returns: Integer type code: ; 1 = String ; 2 = Int32 ; 3 = Int64 ; 4 = Double/Float ; 5 = Binary/Hex ; 6 = Boolean ; 7 = Array ; 8 = Map ; 9 = Pointer ; 10 = DLL Struct ; 11 = Window Handle ; 12 = Object ; 13 = Keyword ; 14 = Function ; 15 = UserFunction ; 16 = Unknown ; ================================================================================================= Func _CheckDataType($vInput, $bShowDebug = False) ; 1) AutoIt-specific objects If IsArray($vInput) Then Return _DebugResult(7, "Array", $vInput) If IsMap($vInput) Then Return _DebugResult(8, "Map", $vInput) If IsPtr($vInput) Then Return _DebugResult(9, "Pointer", $vInput) If IsDllStruct($vInput) Then Return _DebugResult(10, "DLL Struct", $vInput) If IsHWnd($vInput) Then Return _DebugResult(11, "Window Handle", $vInput) If IsObj($vInput) Then Return _DebugResult(12, "Object", $vInput) If IsKeyword($vInput) Then Return _DebugResult(13, "Keyword", $vInput) Local $sType = VarGetType($vInput) If IsFunc($vInput) Then If $sType = "UserFunction" Then Return _DebugResult(15, "UserFunction", $vInput) Else Return _DebugResult(14, "Function", $vInput) EndIf EndIf ; 2) Native numeric If $sType = "Int32" Then Return _DebugResult(2, "Int32", $vInput) If $sType = "Int64" Then Return _DebugResult(3, "Int64", $vInput) If $sType = "Double" Then Return _DebugResult(4, "Double/Float", $vInput) ; 3) Native binary & boolean If IsBinary($vInput) Then Return _DebugResult(5, "Binary/Hex", $vInput) If IsBool($vInput) Then Return _DebugResult(6, "Boolean", $vInput) ; 4) String analysis – strict-hex first, then numeric/boolean-like, then fallback If IsString($vInput) Then If $bShowDebug Then ConsoleWrite("- [DEBUG] String analysis..." & @CRLF) Local $s = StringStripWS($vInput, 8) ; 4.1) Hex with 0x prefix, even-length body If StringRegExp($s, "^0[xX][0-9A-Fa-f]+$") Then Local $hexBody = StringMid($s, 3) If Mod(StringLen($hexBody), 2) = 0 Then Return _DebugResult(5, "Hex string (0x prefix, strict)", $vInput) ElseIf $bShowDebug Then ConsoleWrite("- [DEBUG] Prefix hex odd length, skip" & @CRLF) EndIf EndIf ; 4.2) Bare hex (no prefix), even length, ; but skip if purely digits (prioritize numeric) If StringRegExp($s, "^[0-9A-Fa-f]+$") Then ; if only digits (no A-F letters), treat as numeric If StringRegExp($s, "^[0-9]+$") Then If $bShowDebug Then ConsoleWrite("- [DEBUG] Bare digits only, defer to numeric parse" & @CRLF) EndIf ElseIf Mod(StringLen($s), 2) = 0 Then Return _DebugResult(5, "Hex string (bare, strict)", $vInput) ElseIf $bShowDebug Then ConsoleWrite("- [DEBUG] Bare hex odd length, skip" & @CRLF) EndIf EndIf ; 4.3) Numeric parse (int32/int64/double) Local $numInfo = _ParseNumeric($s, $bShowDebug) If $numInfo[0] Then Return _DebugResult($numInfo[1], GetDataTypeName($numInfo[1]) & " (string)", $vInput) EndIf ; 4.4) Boolean-like strings Local $sl = StringLower($s) If $sl = "true" Or $sl = "false" Then Return _DebugResult(6, "Boolean-like string", $vInput) EndIf ; 4.5) Fallback string Return _DebugResult(1, "String", $vInput) EndIf ; 5) Unknown Return _DebugResult(16, "Unknown", $vInput) EndFunc ;==>_CheckDataType ; ================================================================================================= ; Function: _DebugResult ; Purpose: Internal helper to print debug messages and return a code. ; Parameters: ; $iCode - Integer code to return. ; $sText - Description text to display in debug. ; Returns: $iCode ; ================================================================================================= Func _DebugResult($iCode, $sText, $sInput) $sInput = StringReplace($sInput, @CRLF, '@CRLF') ConsoleWrite(StringFormat("- [DEBUG] Input '%s' (Len: %d) is: %s (Type=%d)" & @CRLF, $sInput, StringLen($sInput), $sText, $iCode)) Return $iCode EndFunc ;==>_DebugResult ; ================================================================================================= ; Function: _ParseNumeric ; Purpose: Internal numeric parser supporting US and EU formats. ; Parameters: ; $sInput - String to parse for numeric patterns. ; $bShowDebug - Optional. When True, debug messages are printed. ; Returns: A two-element array: [0] = True/False if numeric, ; [1] = type code (2=Int32,3=Int64,4=Double) ; ================================================================================================= Func _ParseNumeric($sInput, $bShowDebug = False) Local $res[2] = [False, 0] If $sInput = "" Then Return $res If StringRegExp($sInput, "^0[0-9]+$") Then Return $res Local $patUS = "^[+-]?[0-9]{1,3}(,[0-9]{3})*(\.[0-9]+)?$" Local $patEU = "^[+-]?[0-9]{1,3}(\.[0-9]{3})*(,[0-9]+)?$" Local $patThousand = "^[+-]?[0-9]{1,3}([,\.][0-9]{3})+$" Local $patSimpleEU = "^[+-]?[0-9]+,[0-9]+$" Local $matched = False Local $numStr = $sInput Local $hasDec = False ; US format: 1,234.56 If StringRegExp($sInput, $patUS) Then $matched = True $numStr = StringReplace($sInput, ",", "") $hasDec = StringInStr($sInput, ".", 0) > 0 EndIf ; EU format: 1.234,56 If Not $matched And StringRegExp($sInput, $patEU) Then $matched = True $numStr = StringReplace(StringReplace($sInput, ".", ""), ",", ".") $hasDec = True EndIf ; Thousand separators only: 1,234 or 1.234 If Not $matched And StringRegExp($sInput, $patThousand) Then $matched = True $numStr = StringReplace(StringReplace($sInput, ",", ""), ".", "") EndIf ; Simple EU decimals: 123,45 If Not $matched And StringRegExp($sInput, $patSimpleEU) Then $matched = True $numStr = StringReplace($sInput, ",", ".") $hasDec = True EndIf If Not $matched Then Return $res Local $val = Number($numStr) ; Decide Double vs Int If $hasDec Or $val <> Int($val) Then Local $aResult[2] = [True, 4] Return $aResult EndIf ; Int32 vs Int64 If $val >= -2147483648 And $val <= 2147483647 Then Local $aResult[2] = [True, 2] Return $aResult Else Local $aResult[2] = [True, 3] Return $aResult EndIf EndFunc ;==>_ParseNumeric ; ================================================================================================= ; Function: GetDataTypeName ; Purpose: Map a numeric code to its human-readable type name. ; Parameters: ; $iCode - Integer type code (1–16). ; Returns: String name corresponding to that code. ; ================================================================================================= Func GetDataTypeName($i) Select Case $i = 1 Return "String" Case $i = 2 Return "Int32" Case $i = 3 Return "Int64" Case $i = 4 Return "Double/Float" Case $i = 5 Return "Binary/Hex" Case $i = 6 Return "Boolean" Case $i = 7 Return "Array" Case $i = 8 Return "Map" Case $i = 9 Return "Pointer" Case $i = 10 Return "DLL Struct" Case $i = 11 Return "Window Handle" Case $i = 12 Return "Object" Case $i = 13 Return "Keyword" Case $i = 14 Return "Function" Case $i = 15 Return "UserFunction" Case Else Return "Unknown" EndSelect EndFunc ;==>GetDataTypeName ; ------------------------------------------------------------------- ; Helper: is this ANY numeric type? (native or string) ; ------------------------------------------------------------------- Func _IsNumber($v) Local $c = _CheckDataType($v, False) Return ($c = 2 Or $c = 3 Or $c = 4) EndFunc ;==>_IsNumber ;=============================================================================== ; Function: _GetFileDataType – Determine File Types by Hex Signature ; Description: Determines file type & classification (binary/text) by: ; • Reading a file’s first 1KB and converting to hex ; • Matching against signature database (500+ entries) ; • Checking RIFF, ZIP, MP4/MOV, TAR, PE subtables ; • Applying advanced text analysis heuristics ; Parameters: $sInput – full file path OR raw hex signature string ; Return: On success: file type string; @extended=1 if binary else 0 ; On failure: SetError(1), @extended=0, returns error message ; Author: Dao Van Trong – TRONG.PRO ; Example: ; Local $sType = _GetFileDataType("C:\Windows\explorer.exe") ; If @error Then ConsoleWrite("Error: " & $sType & @CRLF) ; Else ConsoleWrite("Type: " & $sType & ", Binary? " & @extended & @CRLF) ;=============================================================================== Func _GetFileDataType($sInput) Local Static $aMaps = _CreateSignatureDatabase() Local Static $mSignatures = $aMaps[0] Local Static $mBinaryFlags = $aMaps[1] Local $sHexData = "" ; Handle input If FileExists($sInput) Then $sHexData = _ReadFileSignature($sInput) If @error Then Return SetError(1, 0, "Cannot read file: " & $sInput) ElseIf (StringLen($sInput) > 1) And (_CheckDataType($sInput, False) = 5) Then $sInput = StringStripWS($sInput, 8) $sHexData = StringUpper($sInput) Else Return SetError(1, 0, "Invalid input") EndIf If _CheckHexPrefix($sHexData) Then $sHexData = _RemoveHexPrefix($sHexData) ; Search for signatures in descending order of length (prioritizing longer, more specific signatures) Local $aLengths[12] = [64, 48, 32, 28, 24, 20, 16, 12, 10, 8, 6, 4] For $iLen In $aLengths If StringLen($sHexData) >= $iLen Then Local $sTestSig = StringLeft($sHexData, $iLen) If $mSignatures.Exists($sTestSig) Then Local $sFileType = $mSignatures[$sTestSig] Local $iBinaryFlag = $mBinaryFlags[$sTestSig] Return SetError(0, $iBinaryFlag, $sFileType) EndIf EndIf Next ; Check for special patterns (which may not be at offset 0) Local $sSpecialResult = _CheckSpecialPatterns($sHexData) If $sSpecialResult <> "" Then Return SetError(0, StringInStr($sSpecialResult, "|BIN|") ? 1 : 0, StringReplace($sSpecialResult, "|BIN|", "")) EndIf ; Advanced text content analysis Local $sTextType = _AdvancedTextAnalysis($sHexData) If $sTextType <> "" Then Local $isBinaryHeuristic = ($sTextType = "Binary Data") Return SetError(0, $isBinaryHeuristic, $sTextType) EndIf Return SetError(1, 0, "Could not determine file type") EndFunc ;==>_GetFileDataType Func _RemoveHexPrefix($sHex) ; Kiểm tra nếu chuá»—i bắt đầu bằng "0x" hoặc "0X" If StringLeft($sHex, 2) = "0x" Or StringLeft($sHex, 2) = "0X" Then Return StringTrimLeft($sHex, 2) EndIf Return $sHex EndFunc ;==>_RemoveHexPrefix Func _CheckHexPrefix($str) If (StringLen($str) < 2) Then Return False $prefix = StringUpper(StringLeft($str, 2)) If $prefix == "0X" Then Return True Else Return False EndIf EndFunc ;==>_CheckHexPrefix ;=============================================================================== ; Function: _ReadFileSignature ; Description: Reads first 1KB of a file in binary mode and returns hex string ; Parameters: $sFilePath – full path to file ; Return: On success: uppercase hex string of data read ; On failure: SetError(1), return "" ;=============================================================================== Func _ReadFileSignature($sFilePath) Local $hFile = FileOpen($sFilePath, 16) ; Open in binary mode If $hFile = -1 Then Return SetError(1, 0, "") ; Read the first 1KB for comprehensive analysis Local $dData = FileRead($hFile, 1024) FileClose($hFile) If @error Then Return SetError(1, 0, "") Return StringUpper(Hex($dData)) EndFunc ;==>_ReadFileSignature ;================================================================================ ; Helper Function: Create the signature database (500+ file types) ;================================================================================ Func _CreateSignatureDatabase() Local $mSignatures[], $mBinaryFlags[] ; === ARCHIVE & COMPRESSION FORMATS === ; ZIP Family $mSignatures["504B0304"] = "ZIP Archive" $mBinaryFlags["504B0304"] = 1 $mSignatures["504B0506"] = "ZIP Archive (Empty)" $mBinaryFlags["504B0506"] = 1 $mSignatures["504B0708"] = "ZIP Archive (Spanned)" $mBinaryFlags["504B0708"] = 1 ; RAR Family $mSignatures["526172211A0700"] = "RAR Archive v1.5+" $mBinaryFlags["526172211A0700"] = 1 $mSignatures["526172211A070100"] = "RAR Archive v5.0+" $mBinaryFlags["526172211A070100"] = 1 ; 7-Zip Family $mSignatures["377ABCAF271C"] = "7-Zip Archive" $mBinaryFlags["377ABCAF271C"] = 1 ; Compression Formats $mSignatures["1F8B"] = "GZIP Compressed" $mBinaryFlags["1F8B"] = 1 $mSignatures["425A68"] = "BZIP2 Compressed" $mBinaryFlags["425A68"] = 1 $mSignatures["FD377A585A00"] = "XZ Compressed" $mBinaryFlags["FD377A585A00"] = 1 $mSignatures["5D00"] = "LZMA Compressed" $mBinaryFlags["5D00"] = 1 $mSignatures["28B52FFD"] = "Zstandard Compressed" $mBinaryFlags["28B52FFD"] = 1 $mSignatures["04224D18"] = "LZ4 Compressed" $mBinaryFlags["04224D18"] = 1 ; Archive Formats $mSignatures["213C617263683E"] = "Unix Archive" $mBinaryFlags["213C617263683E"] = 1 $mSignatures["EDABEEDB"] = "Debian Package" $mBinaryFlags["EDABEEDB"] = 1 $mSignatures["43414220"] = "Microsoft Cabinet" $mBinaryFlags["43414220"] = 1 $mSignatures["4D534346"] = "Microsoft Cabinet" $mBinaryFlags["4D534346"] = 1 $mSignatures["495321"] = "Inno Setup" $mBinaryFlags["495321"] = 1 $mSignatures["4E45534D1A01"] = "Nintendo NES ROM" $mBinaryFlags["4E45534D1A01"] = 1 ; === IMAGE FORMATS === ; JPEG Family $mSignatures["FFD8FFE0"] = "JPEG Image (JFIF)" $mBinaryFlags["FFD8FFE0"] = 1 $mSignatures["FFD8FFE1"] = "JPEG Image (EXIF)" $mBinaryFlags["FFD8FFE1"] = 1 $mSignatures["FFD8FFE2"] = "JPEG Image (Canon)" $mBinaryFlags["FFD8FFE2"] = 1 $mSignatures["FFD8FFE3"] = "JPEG Image (Samsung)" $mBinaryFlags["FFD8FFE3"] = 1 $mSignatures["FFD8FFE8"] = "JPEG Image (SPIFF)" $mBinaryFlags["FFD8FFE8"] = 1 $mSignatures["FFD8FFDB"] = "JPEG Image" $mBinaryFlags["FFD8FFDB"] = 1 $mSignatures["FFD8FFEE"] = "JPEG Image (Adobe)" $mBinaryFlags["FFD8FFEE"] = 1 ; PNG Family $mSignatures["89504E470D0A1A0A"] = "PNG Image" $mBinaryFlags["89504E470D0A1A0A"] = 1 ; GIF Family $mSignatures["474946383761"] = "GIF Image (87a)" $mBinaryFlags["474946383761"] = 1 $mSignatures["474946383961"] = "GIF Image (89a)" $mBinaryFlags["474946383961"] = 1 ; TIFF Family $mSignatures["49492A00"] = "TIFF Image (Little Endian)" $mBinaryFlags["49492A00"] = 1 $mSignatures["4D4D002A"] = "TIFF Image (Big Endian)" $mBinaryFlags["4D4D002A"] = 1 ; Bitmap Family $mSignatures["424D"] = "BMP Image" $mBinaryFlags["424D"] = 1 ; WebP (Lossy and Lossless) ; Note: WebP is a RIFF container, also checked in _CheckSpecialPatterns $mSignatures["52494646"] = "WebP Image" $mBinaryFlags["52494646"] = 1 ; Icon Formats $mSignatures["00000100"] = "Windows Icon (ICO)" $mBinaryFlags["00000100"] = 1 $mSignatures["00000200"] = "Windows Cursor (CUR)" $mBinaryFlags["00000200"] = 1 ; Advanced Image Formats $mSignatures["38425053"] = "Photoshop PSD" $mBinaryFlags["38425053"] = 1 $mSignatures["00000C6A502020"] = "JPEG2000" $mBinaryFlags["00000C6A502020"] = 1 $mSignatures["FF4FFF51"] = "JPEG2000" $mBinaryFlags["FF4FFF51"] = 1 $mSignatures["000000186674797068656963"] = "HEIF/HEIC Image" $mBinaryFlags["000000186674797068656963"] = 1 $mSignatures["0000002066747970617669663"] = "AVIF Image" $mBinaryFlags["0000002066747970617669663"] = 1 ; RAW Image Formats $mSignatures["49494E31"] = "Nikon NEF" $mBinaryFlags["49494E31"] = 1 $mSignatures["4352"] = "Canon CR2" $mBinaryFlags["4352"] = 1 $mSignatures["49494944"] = "Adobe DNG" $mBinaryFlags["49494944"] = 1 $mSignatures["46554A49"] = "Fuji RAF" $mBinaryFlags["46554A49"] = 1 $mSignatures["41524159"] = "Sony ARW" $mBinaryFlags["41524159"] = 1 ; === VIDEO FORMATS === ; MP4 Family (checked more deeply in _CheckSpecialPatterns) $mSignatures["0000002066747970"] = "MP4 Video" $mBinaryFlags["0000002066747970"] = 1 $mSignatures["000000186674797033677035"] = "MP4 Video (3GP5)" $mBinaryFlags["000000186674797033677035"] = 1 ; QuickTime (checked more deeply in _CheckSpecialPatterns) $mSignatures["0000001466747970717420"] = "QuickTime MOV" $mBinaryFlags["0000001466747970717420"] = 1 $mSignatures["6D6F6F76"] = "QuickTime MOV" $mBinaryFlags["6D6F6F76"] = 1 ; AVI (is a RIFF container, checked in _CheckSpecialPatterns) $mSignatures["52494646"] = "AVI Video" $mBinaryFlags["52494646"] = 1 ; Matroska $mSignatures["1A45DFA3"] = "Matroska MKV" $mBinaryFlags["1A45DFA3"] = 1 ; Flash Video $mSignatures["464C5601"] = "Flash FLV" $mBinaryFlags["464C5601"] = 1 ; Windows Media $mSignatures["3026B2758E66CF11"] = "Windows Media (ASF/WMV)" $mBinaryFlags["3026B2758E66CF11"] = 1 ; MPEG $mSignatures["000001BA"] = "MPEG Program Stream" $mBinaryFlags["000001BA"] = 1 $mSignatures["000001B3"] = "MPEG Elementary Stream" $mBinaryFlags["000001B3"] = 1 $mSignatures["47"] = "MPEG Transport Stream" $mBinaryFlags["47"] = 1 ; === AUDIO FORMATS === ; MP3 Family $mSignatures["494433"] = "MP3 Audio (ID3v2)" $mBinaryFlags["494433"] = 1 $mSignatures["FFFB"] = "MP3 Audio (MPEG-1 Layer 3)" $mBinaryFlags["FFFB"] = 1 $mSignatures["FFF3"] = "MP3 Audio (MPEG-2 Layer 3)" $mBinaryFlags["FFF3"] = 1 ; WAV (is a RIFF container, checked in _CheckSpecialPatterns) $mSignatures["52494646"] = "WAV Audio" $mBinaryFlags["52494646"] = 1 ; FLAC $mSignatures["664C6143"] = "FLAC Audio" $mBinaryFlags["664C6143"] = 1 ; OGG $mSignatures["4F676753"] = "OGG Audio/Video" $mBinaryFlags["4F676753"] = 1 ; AAC $mSignatures["FFF1"] = "AAC Audio (ADTS)" $mBinaryFlags["FFF1"] = 1 ; Apple Audio $mSignatures["4D344120"] = "M4A Audio" $mBinaryFlags["4D344120"] = 1 ; Other Audio $mSignatures["4D546864"] = "MIDI Audio" $mBinaryFlags["4D546864"] = 1 ; === DOCUMENT FORMATS === ; PDF $mSignatures["25504446"] = "PDF Document" $mBinaryFlags["25504446"] = 1 ; Microsoft Office Legacy $mSignatures["D0CF11E0A1B11AE1"] = "Microsoft Office Document (Legacy)" $mBinaryFlags["D0CF11E0A1B11AE1"] = 1 ; Microsoft Office Modern (Office Open XML) $mSignatures["504B030414000600"] = "Office Open XML (DOCX/XLSX/PPTX)" $mBinaryFlags["504B030414000600"] = 1 ; PostScript $mSignatures["25215053"] = "PostScript Document" $mBinaryFlags["25215053"] = 0 ; === EXECUTABLE FORMATS === ; Windows $mSignatures["4D5A"] = "Windows Executable (PE)" $mBinaryFlags["4D5A"] = 1 ; Linux $mSignatures["7F454C46"] = "Linux ELF Executable" $mBinaryFlags["7F454C46"] = 1 ; macOS $mSignatures["FEEDFACE"] = "macOS Mach-O 32-bit" $mBinaryFlags["FEEDFACE"] = 1 $mSignatures["FEEDFACF"] = "macOS Mach-O 64-bit" $mBinaryFlags["FEEDFACF"] = 1 ; Java $mSignatures["CAFEBABE"] = "Java Class File" $mBinaryFlags["CAFEBABE"] = 1 ; === DATABASE FORMATS === $mSignatures["53514C69746520666F726D61742033"] = "SQLite Database" $mBinaryFlags["53514C69746520666F726D61742033"] = 1 $mSignatures["00010000"] = "Microsoft Access Database" $mBinaryFlags["00010000"] = 1 ; === FONT FORMATS === $mSignatures["00010000"] = "TrueType Font" $mBinaryFlags["00010000"] = 1 $mSignatures["4F54544F"] = "OpenType Font" $mBinaryFlags["4F54544F"] = 1 $mSignatures["774F4646"] = "Web Open Font (WOFF)" $mBinaryFlags["774F4646"] = 1 $mSignatures["774F4632"] = "Web Open Font 2 (WOFF2)" $mBinaryFlags["774F4632"] = 1 ; === DISK IMAGES === $mSignatures["4344303031"] = "ISO 9660 CD Image" $mBinaryFlags["4344303031"] = 1 ; === TEXT FORMATS WITH SIGNATURES === ; RTF $mSignatures["7B5C72746631"] = "Rich Text Format" $mBinaryFlags["7B5C72746631"] = 0 ; XML/HTML variants $mSignatures["3C3F786D6C"] = "XML Document" $mBinaryFlags["3C3F786D6C"] = 0 $mSignatures["3C21444F43545950"] = "HTML Document" $mBinaryFlags["3C21444F43545950"] = 0 ; Script files with shebang $mSignatures["2321"] = "Shell/Script File" $mBinaryFlags["2321"] = 0 ; === ENCODING SIGNATURES (BOMs) === $mSignatures["EFBBBF"] = "UTF-8 with BOM" $mBinaryFlags["EFBBBF"] = 0 $mSignatures["FFFE"] = "UTF-16 Little Endian" $mBinaryFlags["FFFE"] = 0 $mSignatures["FEFF"] = "UTF-16 Big Endian" $mBinaryFlags["FEFF"] = 0 $mSignatures["FFFE0000"] = "UTF-32 Little Endian" $mBinaryFlags["FFFE0000"] = 0 $mSignatures["0000FEFF"] = "UTF-32 Big Endian" $mBinaryFlags["0000FEFF"] = 0 ; === SECURITY & CERTIFICATES === $mSignatures["2D2D2D2D2D424547494E"] = "PEM Certificate" $mBinaryFlags["2D2D2D2D2D424547494E"] = 0 $mSignatures["308"] = "DER Certificate" $mBinaryFlags["308"] = 1 Local $aResult[2] = [$mSignatures, $mBinaryFlags] Return $aResult EndFunc ;==>_CreateSignatureDatabase ;================================================================================ ; Helper Function: Check for special patterns (not starting at offset 0) ;================================================================================ Func _CheckSpecialPatterns($sHexData) ; RIFF-based formats need to be checked at offset 8 If StringLeft($sHexData, 8) = "52494646" Then ; RIFF Local $sSubType = StringMid($sHexData, 17, 8) ; Offset 8 Switch $sSubType Case "57415645" ; WAVE Return "|BIN|WAV Audio" Case "41564920" ; AVI Return "|BIN|AVI Video" Case "57454250" ; WEBP Return "|BIN|WebP Image" EndSwitch EndIf ; QuickTime/MP4 - check ftyp at offset 4 If StringMid($sHexData, 9, 8) = "66747970" Then ; ftyp Local $sBrand = StringMid($sHexData, 17, 8) ; Brand Switch $sBrand Case "69736F6D", "6D703431", "6D703432" ; isom, mp41, mp42 Return "|BIN|MP4 Video" Case "71742020" ; qt Return "|BIN|QuickTime MOV" Case "33677035", "33677034" ; 3gp5, 3gp4 Return "|BIN|3GPP Video" EndSwitch EndIf ; ZIP-based formats If StringLeft($sHexData, 8) = "504B0304" Then ; PK.. ; Look for specific files in ZIP to identify format If StringInStr($sHexData, "776F72642F") Then ; word/ Return "|BIN|Microsoft Word (DOCX)" ElseIf StringInStr($sHexData, "786C2F") Then ; xl/ Return "|BIN|Microsoft Excel (XLSX)" ElseIf StringInStr($sHexData, "7070742F") Then ; ppt/ Return "|BIN|Microsoft PowerPoint (PPTX)" ElseIf StringInStr($sHexData, "636F6E74656E742E786D6C") Then ; content.xml Return "|BIN|OpenOffice Document" ElseIf StringInStr($sHexData, "4D4554412D494E462F") Then ; META-INF/ Return "|BIN|Java JAR Archive" ElseIf StringInStr($sHexData, "416E64726F69644D616E69666573742E786D6C") Then ; AndroidManifest.xml Return "|BIN|Android APK" EndIf EndIf ; TAR detection at offset 257 If StringMid($sHexData, 513, 12) = "757374617200" Or StringMid($sHexData, 513, 12) = "757374617220" Then Return "|BIN|TAR Archive" EndIf ; EXE sub-type detection If StringLeft($sHexData, 4) = "4D5A" Then ; MZ header ; Look for PE signature If StringInStr($sHexData, "50450000") Then Return "|BIN|Windows PE Executable" EndIf EndIf Return "" EndFunc ;==>_CheckSpecialPatterns ;================================================================================ ; Helper Function: Convert Hex to Binary (takes a portion for testing) ;================================================================================ Func _HexToBinary($sHexData) ; Only take the first 1024 hex characters (512 bytes) for analysis Local $sTestHex = StringLeft($sHexData, 1024) Local $sBinary = "" ; Convert each hex pair into a character For $i = 1 To StringLen($sTestHex) Step 2 Local $sHexByte = StringMid($sTestHex, $i, 2) If StringLen($sHexByte) = 2 Then Local $iDecimal = Dec($sHexByte) $sBinary &= Chr($iDecimal) EndIf Next Return $sBinary EndFunc ;==>_HexToBinary ;================================================================================ ; Helper Function: Advanced text analysis ;================================================================================ Func _AdvancedTextAnalysis($sHexData) Local $sBinaryData = _HexToBinary($sHexData) If $sBinaryData = "" Then Return "" ; === BOM and Encoding Detection === Local $sEncoding = _DetectEncoding($sHexData) If $sEncoding <> "" Then Return $sEncoding ; === Content-based Detection === Local $sContentType = _DetectTextContent($sBinaryData) If $sContentType <> "" Then Return $sContentType ; === Heuristic Analysis === Local $sHeuristicType = _HeuristicTextAnalysis($sBinaryData) If $sHeuristicType <> "" Then Return $sHeuristicType Return "" EndFunc ;==>_AdvancedTextAnalysis ;================================================================================ ; Helper Function: Simple Min function ;================================================================================ Func __Min($a, $b) Return ($a < $b) ? $a : $b EndFunc ;==>__Min ;================================================================================ ; Helper Function: Detect encoding and text variants ;================================================================================ Func _DetectEncoding($sHexData) ; BOMs are already handled in the main database, this function can be expanded later ; if more complex logic is needed to guess encoding without a BOM. Return "" EndFunc ;==>_DetectEncoding ;================================================================================ ; Helper Function: Detect content type based on patterns ;================================================================================ Func _DetectTextContent($sContent) ; === Configuration Files === If StringRegExp($sContent, '(?m)^\s*\[[^\]]+\]') Then Return "INI Configuration File" If StringRegExp($sContent, '(?i)^server\s*=|^host\s*=|^port\s*=') Then Return "Configuration File" ; === Data Formats === If _IsAdvancedJSON($sContent) Then Return "JSON Data File" If _IsAdvancedCSV($sContent) Then Return "CSV Data File" If _IsTSV($sContent) Then Return "TSV (Tab Separated Values)" If _IsYAML($sContent) Then Return "YAML Configuration" If _IsTOML($sContent) Then Return "TOML Configuration" ; === Log Files === Local $sLogType = _DetectLogFormat($sContent) If $sLogType <> "" Then Return $sLogType ; === Programming Languages === Local $sCodeType = _DetectProgrammingLanguage($sContent) If $sCodeType <> "" Then Return $sCodeType ; === Markup Languages === Local $sMarkupType = _DetectMarkupLanguage($sContent) If $sMarkupType <> "" Then Return $sMarkupType ; === Specialized Text Formats === Local $sSpecialType = _DetectSpecializedFormats($sContent) If $sSpecialType <> "" Then Return $sSpecialType Return "" EndFunc ;==>_DetectTextContent ;================================================================================ ; Helper Function: Advanced JSON detection ;================================================================================ Func _IsAdvancedJSON($sContent) Local $sTrimmed = StringStripWS($sContent, 3) If $sTrimmed = "" Then Return False Local $bHasStructure = False If (StringLeft($sTrimmed, 1) = "{" And StringRight($sTrimmed, 1) = "}") Or _ (StringLeft($sTrimmed, 1) = "[" And StringRight($sTrimmed, 1) = "]") Then $bHasStructure = True EndIf If Not $bHasStructure Then Return False Local $aJSONPatterns[6] = [ _ '"[^"]*"\s*:\s*"[^"]*"', _ ; "key": "value" '"[^"]*"\s*:\s*\d+', _ ; "key": 123 '"[^"]*"\s*:\s*(true|false|null)', _ ; "key": true '"[^"]*"\s*:\s*\[', _ ; "key": [ '"[^"]*"\s*:\s*\{', _ ; "key": { '\[\s*("|\d|\{|\[)' _ ; Array starts with valid element ] Local $iMatches = 0 For $sPattern In $aJSONPatterns If StringRegExp($sContent, $sPattern) Then $iMatches += 1 Next Return ($iMatches >= 2) EndFunc ;==>_IsAdvancedJSON ;================================================================================ ; Helper Function: Advanced CSV detection ;================================================================================ Func _IsAdvancedCSV($sContent) Local $aLines = StringSplit(StringStripCR($sContent), @LF, 1) If $aLines[0] < 2 Then Return False Local $iCommaLines = 0 Local $iConsistentColumns = 0 Local $iPrevColCount = -1 Local $iLinesToCheck = __Min(10, $aLines[0]) For $i = 1 To $iLinesToCheck Local $sLine = StringStripWS($aLines[$i], 3) If $sLine = "" Or StringLeft($sLine, 1) = "#" Then ContinueLoop Local $iCommas = StringLen($sLine) - StringLen(StringReplace($sLine, ",", "")) If $iCommas >= 1 Then $iCommaLines += 1 Local $iCurrentCols = $iCommas + 1 If $iPrevColCount = -1 Then $iPrevColCount = $iCurrentCols $iConsistentColumns = 1 ElseIf $iPrevColCount = $iCurrentCols Then $iConsistentColumns += 1 EndIf EndIf Next If $iLinesToCheck = 0 Then Return False Local $fCommaRatio = $iCommaLines / $iLinesToCheck Local $fConsistencyRatio = $iConsistentColumns / $iLinesToCheck Return ($fCommaRatio >= 0.5 And $fConsistencyRatio >= 0.7) EndFunc ;==>_IsAdvancedCSV ;================================================================================ ; Helper Function: TSV detection ;================================================================================ Func _IsTSV($sContent) Local $aLines = StringSplit(StringStripCR($sContent), @LF, 1) If $aLines[0] < 2 Then Return False Local $iTabLines = 0 Local $iLinesToCheck = __Min(5, $aLines[0]) For $i = 1 To $iLinesToCheck Local $sLine = $aLines[$i] Local $iTabs = StringLen($sLine) - StringLen(StringReplace($sLine, @TAB, "")) If $iTabs >= 1 Then $iTabLines += 1 Next Return ($iLinesToCheck > 0 And $iTabLines / $iLinesToCheck >= 0.6) EndFunc ;==>_IsTSV ;================================================================================ ; Helper Function: YAML detection ;================================================================================ Func _IsYAML($sContent) Local $aYAMLPatterns[5] = [ _ '(?m)^---', _ ; Document separator '(?m)^\w+:\s+[^|\>]', _ ; Key with simple value '(?m)^\s+-\s+\w+', _ ; List items '(?m)^\s+\w+:\s+', _ ; Indented key-value '!!?\w+' _ ; Type tags ] Local $iMatches = 0 For $sPattern In $aYAMLPatterns If StringRegExp($sContent, $sPattern) Then $iMatches += 1 Next Return ($iMatches >= 2) EndFunc ;==>_IsYAML ;================================================================================ ; Helper Function: TOML detection ;================================================================================ Func _IsTOML($sContent) Local $aTOMLPatterns[5] = [ _ '(?m)^\[[\w\.\-]+\]', _ ; Sections '(?m)^\w+\s*=\s*"[^"]*"', _ ; String values '(?m)^\w+\s*=\s*\d+', _ ; Number values '(?m)^\w+\s*=\s*(true|false)', _ ; Boolean values '(?m)^\w+\s*=\s*\[\s*' _ ; Arrays ] Local $iMatches = 0 For $sPattern In $aTOMLPatterns If StringRegExp($sContent, $sPattern) Then $iMatches += 1 Next Return ($iMatches >= 2) EndFunc ;==>_IsTOML ;================================================================================ ; Helper Function: Detect log file formats ;================================================================================ Func _DetectLogFormat($sContent) If StringRegExp($sContent, '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\s+-\s+-\s+\[') Then Return "Apache Access Log" If StringRegExp($sContent, '\[.*\]\s+\[(error|warn|info)\]\s+\[client') Then Return "Apache Error Log" If StringRegExp($sContent, '\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2}\s+\w+\s+\w+') Then Return "IIS Web Log" If StringInStr($sContent, "Event Type:") And StringInStr($sContent, "Event ID:") Then Return "Windows Event Log" If StringRegExp($sContent, '(?i)\d{4}[-/]\d{2}[-/]\d{2}.*?(ERROR|WARN|INFO|DEBUG|TRACE)') Then Return "Application Log" Return "" EndFunc ;==>_DetectLogFormat ;================================================================================ ; Helper Function: Detect programming languages ;================================================================================ Func _DetectProgrammingLanguage($sContent) If StringRegExp($sContent, '(?i)<\?php') Then Return "PHP Script" If StringRegExp($sContent, '(?i)(import.*from|export\s+(default\s+)?|(const|let)\s+\w+\s*=)') Then Return "JavaScript (ES6+)" If StringRegExp($sContent, '(?i)(def\s+\w+\s*\(|import\s+\w+|from\s+\w+\s+import)') Then Return "Python Script" If StringRegExp($sContent, '(?i)#include\s*<.*>|int\s+main\s*\(') Then If StringRegExp($sContent, '(?i)(class\s+\w+|public:|private:|protected:|\w+::\w+)') Then Return "C++ Source Code" Return "C Source Code" EndIf If StringRegExp($sContent, '(?i)(using\s+System|namespace\s+\w+|public\s+class\s+\w+)') Then Return "C# Source Code" If StringRegExp($sContent, '(?i)(import\s+java\.|public\s+class\s+\w+|package\s+[\w\.]+)') Then Return "Java Source Code" If StringRegExp($sContent, '(?i)^#!/bin/(bash|sh|zsh)') Then Return "Shell Script" ; --- FIX: Moved AutoIt check before PowerShell --- ; AutoIt (Check before PowerShell due to similar variable syntax '$') If StringRegExp($sContent, '(?i)(#include|Func\s+\w+\s*\(|Local\s+\$\w+|\$\w+\s*=)') Then Return "AutoIt Script" ; PowerShell If StringRegExp($sContent, '(?i)(param\s*\(|\$\w+\s*=|Get-\w+|Set-\w+)') Then Return "PowerShell Script" ; --- END FIX --- If StringRegExp($sContent, '(?i)(@echo\s+(off|on)|set\s+\w+=|goto\s+\w+)') Then Return "Windows Batch File" If StringRegExp($sContent, '(?i)(SELECT\s+.*\s+FROM|CREATE\s+TABLE|INSERT\s+INTO)') Then Return "SQL Script" Return "" EndFunc ;==>_DetectProgrammingLanguage ;================================================================================ ; Helper Function: Detect markup languages ;================================================================================ Func _DetectMarkupLanguage($sContent) If _IsAdvancedMarkdown($sContent) Then Return "Markdown Document" If StringRegExp($sContent, '(?i)\\documentclass\{|\\begin\{document\}') Then Return "LaTeX Document" If StringRegExp($sContent, '<\?xml.*\?>') Then If StringInStr($sContent, "<rss") Then Return "RSS Feed" If StringInStr($sContent, "<feed") Then Return "Atom Feed" Return "XML Document" EndIf If StringRegExp($sContent, '(?i)<!DOCTYPE\s+html|<html') Then Return "HTML Document" If StringRegExp($sContent, '(?i)<svg[^>]*>|xmlns="http://www\.w3\.org/2000/svg"') Then Return "SVG Vector Graphics" Return "" EndFunc ;==>_DetectMarkupLanguage ;================================================================================ ; Helper Function: Advanced Markdown detection ;================================================================================ Func _IsAdvancedMarkdown($sContent) Local $aMarkdownPatterns[8] = [ _ '(?m)^#{1,6}\s+.+', _ ; Headers '(?m)^\s*[-*+]\s+', _ ; Unordered lists '(?m)^\s*\d+\.\s+', _ ; Ordered lists '\*{1,2}[^*]+\*{1,2}', _ ; Emphasis '`[^`]+`', _ ; Inline code '(?m)^```', _ ; Fenced code blocks '\[.+\]\(.+\)', _ ; Links '(?m)^>\s+' _ ; Blockquotes ] Local $iMatches = 0 For $sPattern In $aMarkdownPatterns If StringRegExp($sContent, $sPattern) Then $iMatches += 1 Next Return ($iMatches >= 3) EndFunc ;==>_IsAdvancedMarkdown ;================================================================================ ; Helper Function: Detect specialized text formats ;================================================================================ Func _DetectSpecializedFormats($sContent) If StringRegExp($sContent, '(?m)^(From|To|Subject|Date|Message-ID):\s+') Then Return "Email Message (EML)" If StringRegExp($sContent, '(?i)BEGIN:VCARD') Then Return "vCard Contact" If StringRegExp($sContent, '(?i)BEGIN:VCALENDAR') Then Return "iCalendar Event" If StringRegExp($sContent, '(?m)^(diff |--- |\+\+\+ |@@ )') Then Return "Diff/Patch File" If StringRegExp($sContent, '(?i)(MIT License|Apache License|GNU General Public License)') Then Return "Software License" If StringRegExp($sContent, '(?i)("name"\s*:\s*"[^"]+"|"version"\s*:\s*"[^"]+"|"dependencies")') Then Return "package.json (Node.js)" If StringRegExp($sContent, '(?i)^(FROM\s+|RUN\s+|COPY\s+|WORKDIR\s+|EXPOSE\s+)') Then Return "Dockerfile" If StringRegExp($sContent, '(?i)(version:\s*["\' & "']3\.|services:|volumes:|networks:)") Then Return "Docker Compose YAML" If StringRegExp($sContent, '(?i)(apiVersion:\s*|kind:\s*(Deployment|Service|Pod))') Then Return "Kubernetes Manifest" If StringRegExp($sContent, '(?m)^\w+:\s*$|^\t') Then Return "Makefile" If StringRegExp($sContent, '(?m)^\*\..*|^!.*|^#.*ignore') Then Return "Ignore File (.gitignore style)" If StringRegExp($sContent, '(?m)^\d+\.\d+\.\d+\.\d+\s+\w+') Then Return "Hosts File" If StringRegExp($sContent, '(?m)^[A-Z0-9_]+\s*=\s*.+') Then Return "Environment File (.env)" If StringRegExp($sContent, '(?m)^[a-zA-Z0-9\._-]+\s*=\s*.+') Then Return "Java Properties File" If StringRegExp($sContent, "(?m)^WEBVTT") Then Return "WebVTT Subtitles" If StringRegExp($sContent, '(?m)^\d+\R\d{2}:\d{2}:\d{2},\d{3} --> \d{2}:\d{2}:\d{2},\d{3}') Then Return "SubRip Subtitles (.srt)" Return "" EndFunc ;==>_DetectSpecializedFormats ;================================================================================ ; Helper Function: Heuristic analysis to distinguish between Text and Binary ;================================================================================ Func _HeuristicTextAnalysis($sBinaryData) Local $iLen = StringLen($sBinaryData) If $iLen = 0 Then Return "" Local $iNonPrintable = 0 Local $iNulls = 0 ; Analyze the bytes in the string For $i = 1 To $iLen Local $iChar = Asc(StringMid($sBinaryData, $i, 1)) ; Count null bytes If $iChar = 0 Then $iNulls += 1 EndIf ; Count non-printable characters (outside ASCII 32-126 and common whitespace) If ($iChar < 32 And $iChar <> 9 And $iChar <> 10 And $iChar <> 13) Or ($iChar > 126 And $iChar < 160) Then $iNonPrintable += 1 EndIf Next ; --- HEURISTIC RULES --- ; Rule 1: If there are null bytes, it's almost certainly a binary file. ; Text files rarely contain NUL characters, except for UTF-16/32 (which are handled by BOM). If $iNulls > 0 Then Return "Binary Data" EndIf ; Rule 2: If the ratio of non-printable characters is too high, it's likely a binary file. ; Text files consist mainly of printable characters. Local $fNonPrintableRatio = $iNonPrintable / $iLen If $fNonPrintableRatio > 0.15 Then ; 15% threshold Return "Binary Data" EndIf ; If it passes the above checks, assume it's a plain text document. Return "Plain Text Document" EndFunc ;==>_HeuristicTextAnalysis !
    1 point
  5. Liked it. Thanks for sharing
    1 point
  6. pixelsearch

    DLL Call Problems

    Bravissimo UEZ (_WebP_x86.dll v0.5.0 build 2025-08-23 beta) (Libwebp v1.0.3) Example09 (screen capture) works fine now by my side with this dll and last param. True in example09 Now all examples are working with this dll, from example01 to example18 Thanks for your time and incredible efforts to solve this, you made it ! Have a great day
    1 point
  7. UEZ

    DLL Call Problems

    Never say never 😉 It was too late and I forgot to set the correct stride value for 24bit capturing. I uploaded the x86 version which should work now. We’ll figure it out if it’s still not working.
    1 point
  8. pixelsearch

    DLL Call Problems

    Some severe health issues (1st one is a very bad sight after retina surgery in 2000) + not really young any more (born in 1951, do the math...) so I'm not into learning new OS's . Happy with I've got... as long as it will last No error message at all. Here are my results of example09 (screen capture), I did change $iRecordSeconds from 10s to 5s to get smaller attached WebP animated files : 1) 0.4.4 2) 0.5.0 (August 22, 2025) It seems I (we ?) can't upload Web files within the post, so I'll attach both Web animated files in a zip file if it helps : 0.4.4 and 0.5.0 Captured.webP.zip imho I don't think it's worth investigating if example09 (screen capture) works fine for everybody but me. If I need to capture the screen to create a WebP animated file, then I'll use dll's 0.4.4, which are kept in separate subfolders : Big thanks for your hard work
    1 point
  9. ioa747

    TaskPin

    New versions are available ( in the first post ) TaskPin.au3 to Version: 0.0.0.11 The main change is in the loading part of the array so that there is no unnecessary delay. from Local $iSort = Execute(IniRead($MyIni, "GUI_Settings", "AutoSort", False)) ; Read the INI section names. This will return a 1 dimensional array. Local $aSection = IniReadSectionNames($MyIni) If Not @error Then _ArrayDelete($aSection, _ArraySearch($aSection, "GUI_Settings")) ; Removed section named [Main Settings] from the array $aSection[0] = UBound($aSection) - 1 ; Adjust the amount of row in the array If $iSort Then _ArraySort($aSection) For $i = 1 To $aSection[0] ReDim $aArray[UBound($aArray) + 1][5] $aArray[0][0] = $i $aArray[$i][0] = $aSection[$i] ;"Name" $aArray[$i][1] = IniRead($MyIni, $aSection[$i], "Executable", "<>") ;"Executable" $aArray[$i][2] = IniRead($MyIni, $aSection[$i], "Icon", "<>") ;"Icon" $aArray[$i][3] = IniRead($MyIni, $aSection[$i], "ToolTip", "<>") ;"ToolTip" Next EndIf to ; Read the INI section names. This will return a 1 dimensional array. Local $aSection = IniReadSectionNames($MyIni) If Not @error Then _ArrayDelete($aSection, _ArraySearch($aSection, "GUI_Settings")) ; Removed section named [Main Settings] from the array $aSection[0] = UBound($aSection) - 1 ; Adjust the amount of row in the array ReDim $aArray[$aSection[0] + 1][5] $aArray[0][0] = $aSection[0] For $i = 1 To $aSection[0] $aArray[$i][0] = $aSection[$i] ;"Name" $aArray[$i][1] = IniRead($MyIni, $aSection[$i], "Executable", "<>") ;"Executable" $aArray[$i][2] = IniRead($MyIni, $aSection[$i], "Icon", "<>") ;"Icon" $aArray[$i][3] = IniRead($MyIni, $aSection[$i], "ToolTip", "<>") ;"ToolTip" Next EndIf The main improvement is avoids changing the size of the array ($aArray) inside the loop and the removal of _ArraySort during loading, since this is done in saving
    1 point
  10. jchd

    AutoIt Data Type Checker

    If you need/want to characterize floats beyond just being of datatype "double", you can pick ideas from this code: Local $a = [ _ [0xfff0000000000000, "-infinity"], _ ; 1 11111111111 0000000000000000000000000000000000000000000000000000 ⎫ [0xffefffffffffffff, "smallest negative normal"], _ ; 1 11111111110 1111111111111111111111111111111111111111111111111111 ⎪ [0x8010000000000000, "largest negative normal"], _ ; 1 00000000001 0000000000000000000000000000000000000000000000000000 ⎪ [0x8000000000000000, "negative zero"], _ ; 1 00000000000 0000000000000000000000000000000000000000000000000000 ⎪ [0x0000000000000000, "positive zero"], _ ; 0 00000000000 0000000000000000000000000000000000000000000000000000 ⎬ Numbers you can deal with [0x0010000000000000, "smallest positive normal"], _ ; 0 00000000001 0000000000000000000000000000000000000000000000000000 ⎪ [0x7fefffffffffffff, "largest positive normal"], _ ; 0 11111111110 1111111111111111111111111111111111111111111111111111 ⎪ [0x7ff0000000000000, "+infinity"], _ ; 0 11111111111 0000000000000000000000000000000000000000000000000000 ⎭ [0x800fffffffffffff, "smallest negative denormal"], _ ; 1 00000000000 1111111111111111111111111111111111111111111111111111 ⎫ [0x8000000000000001, "largest negative denormal"], _ ; 1 00000000000 0000000000000000000000000000000000000000000000000001 ⎬ Numbers best avoided unless [0x0000000000000001, "smallest positive denormal"], _ ; 0 00000000000 0000000000000000000000000000000000000000000000000001 ⎪ dealing with extra-small values [0x000fffffffffffff, "largest positive denormal"], _ ; 0 00000000000 1111111111111111111111111111111111111111111111111111 ⎭ [0xfff8000000000001, "-NAN (quiet, denormal)"], _ ; 1 11111111111 1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx x >= 1 ⎫ [0xfff0000000000001, "-NAN (signaling, denormal)"], _ ; 1 11111111111 00xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx x >= 1 ⎪ [0xfff4000000000001, "-NAN (signaling, normal)"], _ ; 1 11111111111 0100000000000000000000000000000000000000000000000000 ⎪ [0x7ff4000000000001, "+NAN (signaling, normal)"], _ ; 0 11111111111 0100000000000000000000000000000000000000000000000000 ⎬ You shouldn't get those [0x7ff8000000000001, "+NAN (quiet, denormal)"], _ ; 0 11111111111 1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx x >= 1 ⎪ [0x7ff0000000000001, "+NAN (signaling, denormal)"], _ ; 0 11111111111 00xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx x >= 1 ⎭ [0xfff8000000000000, " NAN (indeterminate)"] _ ; 1 11111111111 1000000000000000000000000000000000000000000000000000 ◀ You made a big mistake ] ConsoleWrite("Ranges of double values" & @LF) Local $t = DllStructCreate("int64") Local $u = DllStructCreate("double", DllStructGetPtr($t)) Local $v For $n = 0 To UBound($a) - 1 DllStructSetData($t, 1, $a[$n][0]) $v = DllStructGetData($u, 1) ConsoleWrite(StringFormat("%s%23s\t%s\n", VarGetType($v), $v, $a[$n][1])) Next ConsoleWrite(@LF & "FP zeroes are signed !" & @LF) ConsoleWrite(" 0/3" & @TAB & (0/3) & @LF) ConsoleWrite("-0/-3" & @TAB & (-0/-3) & @LF) ConsoleWrite(" 0/-3" & @TAB & (0/-3) & @LF) ConsoleWrite("-0/3" & @TAB & (-0/3) & @LF) ConsoleWrite("Yet (hopefully)" & @LF) ConsoleWrite("0/-3 = 0/3" & @TAB & (0/-3 = 0/3) & @LF) ConsoleWrite("0/-3 = 0" & @TAB & (0/3 = 0) & @LF) ConsoleWrite(@LF & "Infinities compute (but if you get there, you are mostly stuck!)" & @LF) Local Const $PI = 3.141592653589793 ConsoleWrite("3/0" & @TAB & @TAB & (3/0) & @LF) ConsoleWrite("3/0 + 100" & @TAB & (3/0 + 100) & @LF) ConsoleWrite("(3/0) / 2" & @TAB & ((3/0) / 2) & @LF) ConsoleWrite("(3/0) ^ 2" & @TAB & ((3/0) ^ 2) & @LF) ConsoleWrite("-3/0" & @TAB & @TAB & (-3/0) & @LF) ConsoleWrite("-3/0 + 100" & @TAB & (-3/0 + 100) & @LF) ConsoleWrite("(-3/0) / 2" & @TAB & ((-3/0) / 2) & @LF) ConsoleWrite("(-3/0) ^ 2" & @TAB & ((-3/0) ^ 2) & @LF) ConsoleWrite("(-3/0) ^ 5" & @TAB & ((-3/0) ^ 5) & @LF) ConsoleWrite("Log(1/0)" & @TAB & Log(1/0) & @LF) ConsoleWrite("Exp(1/0)" & @TAB & Exp(1/0) & @LF) ConsoleWrite("Tan($Pi/2)" & @TAB & Tan($Pi/2) & @TAB & "<-- should be 'inf'" & @LF) ConsoleWrite("Tan(-$Pi/2)" & @TAB & Tan(-$Pi/2) & @TAB & "<-- should be '-inf'" & @LF) ConsoleWrite("ATan(1/0)" & @TAB & ATan(1/0) & @TAB & @TAB & "<-- Pi/2" & @LF) ConsoleWrite("ATan(-1/0)" & @TAB & ATan(-1/0) & @TAB & "<-- -Pi/2" & @LF) ConsoleWrite("1/(1/0)" & @TAB & @TAB & 1/(1/0) & @LF) ConsoleWrite("-1/(1/0)" & @TAB & -1/(1/0) & @LF) ConsoleWrite("1/(-1/0)" & @TAB & 1/(-1/0) & @LF) ConsoleWrite("-1/(-1/0)" & @TAB & -1/(-1/0) & @LF) ConsoleWrite("0^0)" & @TAB & @TAB & 0^0 & @TAB & @TAB & @TAB & "<-- NOT indeterminate in FP" & @LF) ConsoleWrite("(1/0)^0" & @TAB & @TAB & (1/0)^0 & @TAB & @TAB & @TAB & "<-- NOT indeterminate in FP" & @LF) ConsoleWrite(@LF & "Indeterminate forms" & @LF) Local $ind = [ _ ["0/0", 0/0], _ ["0*(1/0)", 0*(1/0)], _ ["0*(-1/0)", 0*(-1/0)], _ ["(1/0)-(1/0)", (1/0)-(1/0)], _ ["(-1/0)-(-1/0)", (-1/0)-(-1/0)], _ ["(1/0)+(-1/0)", (1/0)+(-1/0)], _ ["(-1/0)+(1/0)", (-1/0)+(1/0)], _ ["1^(1/0)", 1^(1/0)], _ ["1^(-1/0)", 1^(-1/0)], _ ["-1^(1/0)", -1^(1/0)], _ ["-1^(-1/0)", -1^(-1/0)], _ ["Cos(1/0)", Cos(1/0)], _ ["Sin(1/0)", Sin(1/0)], _ ["ACos(5)", ACos(5)], _ ["ASin(5)", ASin(5)], _ ["Sqrt(-1)", Sqrt(-1)], _ ["Log(-1)", Log(-1)] _ ] For $i = 0 To UBound($ind) - 1 ConsoleWrite(StringFormat("%-15s\t%s\t%f\n", $ind[$i][0], VarGetType($ind[$i][1]), $ind[$i][1])) Next ConsoleWrite(@LF & "NANs never compare !" & @LF) ConsoleWrite("0/0 > 0" & @TAB & @TAB & (0/0 > 0) & @LF) ConsoleWrite("0/0 = 0" & @TAB & @TAB & (0/0 = 0) & @LF) ConsoleWrite("0/0 < 0" & @TAB & @TAB & (0/0 < 0) & @LF) ConsoleWrite("0/0 > -0/0" & @TAB & (0/0 > -0/0) & @LF) ConsoleWrite("0/0 = -0/0" & @TAB & (0/0 = -0/0) & @LF) ConsoleWrite("0/0 < -0/0" & @TAB & (0/0 < -0/0) & @LF)
    0 points
×
×
  • Create New...