Jump to content

Recommended Posts

Posted

Func checkstring ()

$Stringinput = InputBox ( "ID Code box", "Paste activation key you got from the email here to run program", "code goes here" )

Sleep(100)

$String = String(101022091284894346834758934)

If NOT $Stringinput = $string Then

MsgBox(0,"","Activation key invalid")

Exit

Else

If $Stringinput = $string Then

MsgBox(0,"","Activation key valid")

Main ()

EndIf

EndIf

EndFunc

ok the message box pops up and thats 100% EPIC but when i enter the correct key it does nothing but if i just press cancle or ok with out any text it will say wrong key when there is no key input ;)

I need it to check for the correct string of numbers if its wrong string = exit

if correct just run the main () function

If you were twice as smart, you'd still be stupid.

Posted (edited)

When i try like this it works ! Posted Image

_checkstring ()


Func _checkstring ()
    $Stringinput = InputBox ( "ID Code box", "Paste activation key you got from the email here to run program", "code goes here" )
    Sleep(100)
    $String = "101022091284894346834758934"
    If NOT $Stringinput = $string Then
        MsgBox(0,"","Activation key invalid")
        Exit
    Else
        If $Stringinput = $string Then
            MsgBox(0,"","Activation key valid")
            ;Main ()
        EndIf
    EndIf
EndFunc

use autoit tag for post code.

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Posted (edited)

The second if doesn't make much sense:

_checkstring ()

Func _checkstring ()
    $Stringinput = InputBox ( "ID Code box", "Paste activation key you got from the email here to run program", "code goes here" )
    $String = "101022091284894346834758934"
    If StringCompare($Stringinput, $string) <> 0 Then ;solves trouble with variable types.
        MsgBox(0,"","Activation key invalid")
        Exit
    Else
        ;the key will always be valid if this line is reached. No need to check again.
        MsgBox(0,"","Activation key valid")
    EndIf
EndFunc

edit: used stringcompare

Edited by Tvern
Posted (edited)

This is why it didn't work !

$String = String(101022091284894346834758934)
ConsoleWrite ( "$String : " & $String & @Crlf )

It return $String = 9223372036854775807

I don't see a limitation for 27 characters in the string function in help file...

( Remarks Maximum length is 2147483647 characters (but keep in mind that no line in an AutoIt script can exceed 4095 characters.) )

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Posted (edited)

You're right, but i don't understand why string function return this ! Posted Image

Think about this:

$var = 101022091284894346834758934
ConsoleWrite ( VarGetType($var) & " : " & $var & @Crlf )

Edit:

The largest integer AutoIt can hold is a 64-bit signed integer. 64 bits can be used to represent 2^64 (18,446,744,073,709,551,616) unique numbers.

Half those numbers are negative so that makes the range -9,223,372,036,854,775,807 to +9,223,372,036,854,775,807 as the range includes 0 (and I would think -0 too?)

Disclaimer:

I don't know how a signed Int64 stores it's data, so don't make any assumptions based on my edit. It could:

Count from the lowest (negative) number to the highest (positive) in order (as assumed by the first edit line, but that means there is a missing number)

Use 63 bits to store a number and the remaining one bit to specify +, or - (as assumed by the 2nd edit line, but I can't seem to set -0, which would exist in this case)

Something else?

Edited by Tvern
Posted (edited)

Zero = Zero. Its special, and is neither negative nor positive. Or it has no sign, as it is ... nothing.

Signed range is -(2^63) to (2^63)-1. The -1 here is of course to account for the zero (which, as a valid value/item, is stored on the positive side -> signed byte value range.)

Signed Int64 numbers and unsigned Int64 numbers are stored in the same way when it comes to there value bytes.

values based on bytes.

BytesHex: 0x00* .. 0x0F*.. 0xF0* .. 0xFF*

unsigned: 0 .. (2^63)-1 .. (2^63) .. (2^64)-1

signed..: 0 .. (2^63)-1 .. -(2^63) to -1

Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...