Jump to content

Msgbox does not return value


Recommended Posts

Msgbox returns no value when it comes to a large value

 

example:

Dim $primo = 999999999999999999999999999999999999

MsgBox(0,"",$primo)

 

msgbox returns:  9223372036854775807 

 

this value is not what I put in the variable

 

 

Link to comment
Share on other sites

As you can see: 9223372036854775807 is a number. Lower level languages (for example C) are using special stuffs for storing things. In such language you have to specify the SIZE of a number. AutoIt uses "LONG" type. Have a look at it:
http://www.cplusplus.com/reference/climits/

9223372036854775807  is the maximum of this LONG. Sadly AutoIt can't handle any bigger number.

 

BUT! If you doesn't want to calculate with it, then you can do the following:

Dim $primo = "999999999999999999999999999999999999"

MsgBox(0,"",$primo)

This will store the number as a STRING and not a NUMBER type. This way you can store any big number, but you can't calculate things with it. (like multiplying, divide etc).

Link to comment
Share on other sites

2 hours ago, Unc3nZureD said:

Sadly AutoIt can't handle any bigger number.

 

@Unc3nZureD: Excuse me?:blink: Using doubles, the range for calculations is about 1.7E +/- 308 (15 digits), and if you want to do calculations with really big numbers, there's the BigNum UDF. For 64bit integers, there's czardas's operator64 UDF.

Edited by RTFC
Link to comment
Share on other sites

Oh, well, that's true, didn't think about BigINT :)

Well, in a default manner the maximum INTEGER is what I told.

 

You can actually write

Dim $primo = 999999999999999999999999999999999999.0

But that still won't print 999999999999999999999999999999999999 on the messagebox (which is obviously the intention of the OP).

Link to comment
Share on other sites

As MsgBox expects a string as 3rd parameter I would pass a string as suggested in post #2.
If you pass a number it is converted to a string by AutoIt.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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