NandaS Posted May 28, 2011 Share Posted May 28, 2011 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? Link to comment Share on other sites More sharing options...
sleepydvdr Posted May 28, 2011 Share Posted May 28, 2011 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> Link to comment Share on other sites More sharing options...
sahsanu Posted May 28, 2011 Share Posted May 28, 2011 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. Link to comment Share on other sites More sharing options...
martin Posted May 28, 2011 Share Posted May 28, 2011 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. Link to comment Share on other sites More sharing options...
NandaS Posted May 28, 2011 Author Share Posted May 28, 2011 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. Link to comment Share on other sites More sharing options...
sahsanu Posted May 28, 2011 Share Posted May 28, 2011 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now