Jump to content
Sign in to follow this  
AlmarM

Why does it returns '0' ?

Recommended Posts

AlmarM

Hi,

Why does my var returns '0'?

$a = Number(00000000)
MsgBox(0, "", $a)

$b = 00000000
MsgBox(0, "", $B)

$c = ClipPut(00000000)
MsgBox(0, "", ClipGet())

I want it to return '00000000'.

AlmarM

Edited by AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites
oMBRa

$a = Number(00000000)
MsgBox(0, "", $a)

$b = 00000000
MsgBox(0, "", $b)

$c = ClipPut('00000000')
MsgBox(0, "", ClipGet())

Share this post


Link to post
Share on other sites
Richard Robertson

000000 = 0.

"000000" = "000000"

Numbers don't save superfluous zeros.

Share this post


Link to post
Share on other sites
AlmarM

Arg >.<...

I need 00000000 then +1 (00000001) etc. Until 99999999

AlmarM


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites
DaleHohm

$x = 1

$c = ClipPut(StringFormat("%08s\n", $x))

MsgBox(0, "", ClipGet())

Edited by DaleHohm

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites
AlmarM

Whahaha, I fixed it with an other way.

AlmarM

Edited by AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites
AlmarM

I did it this way:

(FileWrite is because the example)

$i = 0

While 1
    _Check($i)
    FileWrite(@DesktopDir & "\Test.txt", $i & @CRLF)
    $i += 1
    If $i = 99999999 Then
        Msgbox(0, "", "Done!")
        Exit
    EndIf
WEnd

Func _Check($i)
    If StringLen($i) = 2 Then
        FileWrite(@DesktopDir & "\Test.txt", "000000")
    ElseIf StringLen($i) = 3 Then
        FileWrite(@DesktopDir & "\Test.txt", "00000")
    ElseIf StringLen($i) = 4 Then
        FileWrite(@DesktopDir & "\Test.txt", "0000")
    ElseIf StringLen($i) = 5 Then
        FileWrite(@DesktopDir & "\Test.txt", "000")
    ElseIf StringLen($i) = 6 Then
        FileWrite(@DesktopDir & "\Test.txt", "00")
    ElseIf StringLen($i) = 7 Then
        FileWrite(@DesktopDir & "\Test.txt", "0")
    ElseIf StringLen($i) = 8 Then
        FileWrite(@DesktopDir & "\Test.txt", "")
    Else
        FileWrite(@DesktopDir & "\Test.txt", "0000000")
    EndIf
EndFunc

AlmarM


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites
youknowwho4eva

wouldn't a for or do loop be easier?


Giggity

Share this post


Link to post
Share on other sites
Nevin

I only used While loops for a couple years. I understood how they worked and the other ones scared me. :mellow: More work, but if it gets the job done, whatever.

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.