Sign in to follow this  
Followers 0
NandaS

Reading a exactly number position

6 posts in this topic

Hi to everyone!!

I'm with some trouble in a script that needs to read a specific number position into a for. I don't know if exists some function to do that...

Exemple:

$a = 0

$b = 0

$c = 0

$d = 0

$e = 0

$f = 0

$read = 0

for $read = 0 to 999999

$read = StringFormat("%06d",$read); needs to be in that way (000000 for first)

$a = first number of $read

$b = second number of $read...

Than it will be returned in some place like that:

MsgBox(0, "", " The number now is: " & $a & $b & $c & $d & $e & $f)

Next

Is that possible?

Share this post


Link to post
Share on other sites



What are you trying to accomplish? What you are trying to do is complicated and involves nesting six loops.

A better way may be to create an array of values and formatting them to be six digits no matter what the number is.


#include <ByteMe.au3>

Share this post


Link to post
Share on other sites

I'm with some trouble in a script that needs to read a specific number position into a for. I don't know if exists some function to do that...

[...]

Is that possible?

Global $a = 0 , $b = 0, $c = 0, $d = 0, $e = 0, $f = 0, $read = 0

For $read = 0 To 999999
    $read = StringFormat("%06d",$read); needs to be in that way (000000 for first)
    $array=StringSplit($read,"")
    $a = $array[1]
    $b = $array[2]
    $c = $array[3]
    $d = $array[4]
    $e = $array[5]
    $f = $array[6]
    MsgBox(0, "", " The number now is: " & $a & $b & $c & $d & $e & $f)
Next

Anyway, as sleepydvdr said, what are you trying to do?, I'm pretty sure there are other ways to accomplish that.

Share this post


Link to post
Share on other sites

Global $a = 0 , $b = 0, $c = 0, $d = 0, $e = 0, $f = 0, $read = 0

For $read = 0 To 999999
    $read = StringFormat("%06d",$read); needs to be in that way (000000 for first)
    $array=StringSplit($read,"")
    $a = $array[1]
    $b = $array[2]
    $c = $array[3]
    $d = $array[4]
    $e = $array[5]
    $f = $array[6]
    MsgBox(0, "", " The number now is: " & $a & $b & $c & $d & $e & $f)
Next

Anyway, as sleepydvdr said, what are you trying to do?, I'm pretty sure there are other ways to accomplish that.

Or maybe

$Number = Number($a & $b & $c....)

Or $Number = $a * 10^6 + $b * 10^5 .....


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Global $a = 0 , $b = 0, $c = 0, $d = 0, $e = 0, $f = 0, $read = 0

For $read = 0 To 999999
    $read = StringFormat("%06d",$read); needs to be in that way (000000 for first)
    $array=StringSplit($read,"")
    $a = $array[1]
    $b = $array[2]
    $c = $array[3]
    $d = $array[4]
    $e = $array[5]
    $f = $array[6]
    MsgBox(0, "", " The number now is: " & $a & $b & $c & $d & $e & $f)
Next

Anyway, as sleepydvdr said, what are you trying to do?, I'm pretty sure there are other ways to accomplish that.

That's what i'm looking for, worked perfectly. Thanks a lot!

It's to snd a packet to a program, but the packtet has a size and needs to be in that size. With this script posted worked fine.

Share this post


Link to post
Share on other sites

That's what i'm looking for, worked perfectly. Thanks a lot!

It's to snd a packet to a program, but the packtet has a size and needs to be in that size. With this script posted worked fine.

If this works for you... you are welcome :huh2:

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  
Followers 0