Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/13/2021 in all areas

  1. Quite strange, when checking if a number is a number
    1 point
  2. ConsoleWrite(IsNumber(Number("")) & @CRLF) ; = 1 ConsoleWrite(IsNumber(Number("1")) & @CRLF) ; = 1 ConsoleWrite(IsNumber(Number("0")) & @CRLF) ; = 1 ConsoleWrite(IsNumber(Number("a")) & @CRLF & @CRLF) ; = 1 It all return one Global $aArray[4] = ["0", "1", "a", ""] For $v = 0 To 3 ; it's only true with the "1", so it does what you need, hence, good =) ConsoleWrite( (IsNumber(Number($aArray[$v])) And Number($aArray[$v]) <= 10 And Number($aArray[$v]) <> 0) & @CRLF) Next Exit But you're looking for an int greater than zero, so it's all good == School time == Number: Returns the numeric representation of an expression IsNumber: Checks if a variable's base type is numeric. So, Number returns a 0 or a 1, both integers. And you ask is IsNumber(), and that is what Number() returns, so, this logic goes nowhere fast. But then you ask: are you less than ten and not a zero ? and the answer is what you expected. What @mikell presented: Global $aArray[4] = ["0", "1", "a", ""] For $v = 0 To 3 ; it's only true with the "1", so it does what you need, hence, good =) ;~ ConsoleWrite( (IsNumber(Number($aArray[$v])) And Number($aArray[$v]) <= 10 And Number($aArray[$v]) <> 0) & @CRLF) ConsoleWrite( ( $aArray[$v] > 0 And $aArray[$v] <= 10 ) & @CRLF) ; @mikell Next is what you need.
    1 point
  3. ConsoleWrite(@ScriptLineNumber & @TAB & IsComfortablyNumber("-1.5") & @TAB & @extended & @CRLF) ; Return @extended = yes/real ConsoleWrite(@ScriptLineNumber & @TAB & Number("-1.5") & @CRLF) ConsoleWrite(@ScriptLineNumber & @TAB & IsNumber("-1.5") & @CRLF & @CRLF) ConsoleWrite(@ScriptLineNumber & @TAB & IsComfortablyNumber("0") & @TAB & @extended & @CRLF) ; Return @extended = yes/integer ConsoleWrite(@ScriptLineNumber & @TAB & Number("0") & @CRLF) ConsoleWrite(@ScriptLineNumber & @TAB & IsNumber("0") & @CRLF & @CRLF) ConsoleWrite(@ScriptLineNumber & @TAB & IsComfortablyNumber("a") & @TAB & @extended & @CRLF) ; Return @extended = no ConsoleWrite(@ScriptLineNumber & @TAB & Number("a") & @CRLF) ConsoleWrite(@ScriptLineNumber & @TAB & IsNumber("a") & @CRLF & @CRLF) Func IsComfortablyNumber($string) ; reference https://www.youtube.com/watch?v=_FrOQC-zEog If Number($string) == Int($string) And Number($string) == $string Then Return SetError(0, 2, Int($string)) ; is Integer If Number($string) == $string Then Return SetError(0, 1, Number($string)) ; is Real Return SetError(0, 0, $string) EndFunc the OP is happy with the solution but, ...I believe that what I presented is more real. I mean, zero is a number
    1 point
  4. Func IsComfortablyNumber($string) ; reference https://www.youtube.com/watch?v=_FrOQC-zEog If Number($string) == Int($string) And Number($string) == $string Then Return SetError(0, 2, Int($string)) ; is Integer If Number($string) == $string Then Return SetError(0, 1, Number($string)) ; is Real Return SetError(0, 0, $string) EndFunc I have not seen the file you read, so, would this work ?.
    1 point
  5. I was about to give you a funny, but they say it’s bad luck to break trip sixes. I owe you one...
    1 point
  6. Welcome to Autoit and the forum! Did you try the AutoIt Window Info tool? If it returns the ID for the control you can query the value.
    1 point
  7. @MaxWilko welcome to the forum. Please post the code you have tried already, even if it is not doing what you want it to do. We will then be happy to assist.
    1 point
  8. Example: You define a global COM error handler to grab all COM errors occurring in the main script. A local COM error handler grabs all COM errors occurring inside a function. When the function ends the local COM error handler is dropped and the global COM error handler is active again. Global $oGlobalCOMErrorHandler = ObjEvent("AutoIt.Error", "_ErrFuncGlobal") ; Global COM error handler Global $oIE = ObjCreate("InternetExplorer.Application") $oIE.xyz FunctionLocal() $oIE.xyz Exit Func FunctionLocal() Local $oLocalCOMErrorHandler = ObjEvent("AutoIt.Error", "_ErrFuncLocal") ; Local COM error handler $oIE.xyz EndFunc ; Global COM error handler Func _ErrFuncGlobal($oError) ; Do anything here. ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> Global COM error handler - COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc ;==>_ErrFunc ; Local COM error handler Func _ErrFuncLocal($oError) ; Do anything here. ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> Local COM error handler - COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc ;==>_ErrFunc
    1 point
  9. Have you tried @exitCode or @exitMethod?
    1 point
×
×
  • Create New...