Iznogoud Posted September 25, 2005 Share Posted September 25, 2005 If you got a program wich generates key like: 12345-12345-12345-12345-12345 How can you select the first 5 and put them in a variable and the next 5 numbers/characters and so on. So you leave the "-" alone. Wich funtion do i need for this or how can i do this the best way? Link to comment Share on other sites More sharing options...
Valuater Posted September 25, 2005 Share Posted September 25, 2005 (edited) $var = stringsplit("12345-12345-12345-12345-12345", "-") For $x = 1 to $var[0] msgbox(0,"test", $var[$x]) endif that will do the trick 8) EDIT thx MSLx Fanboy Edited September 25, 2005 by Valuater Link to comment Share on other sites More sharing options...
MSLx Fanboy Posted September 25, 2005 Share Posted September 25, 2005 Valuater, you forgot to encapsulate the string in quotesThen it will work Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate()) Link to comment Share on other sites More sharing options...
Iznogoud Posted September 25, 2005 Author Share Posted September 25, 2005 $var = stringsplit("12345-12345-12345-12345-12345", "-")For $x = 1 to $var[0]msgbox(0,"test", $var[$x])endifthat will do the trick8)EDITthx MSLx FanboyMaybe i am stupid But i am readying a line of text 12345-12345-12345-12345-12345 wich is an output of a program. But how do i get that in the stringsplit?Is it enough to put the output in $output and make the code:$var = stringsplit($output, "-")For $x = 1 to $var[0]msgbox(0,"test", $var[$x])endifSorry i am a beginner to this so don't be hard on me Link to comment Share on other sites More sharing options...
Valuater Posted September 25, 2005 Share Posted September 25, 2005 $output = file read line............ ;;;;;;;;;;;;thus $output = "12345-12345-12345-12345-12345 " $var = stringsplit($output, "-") For $x = 1 to $var[0] msgbox(0,"test", $var[$x]) endif 8) Link to comment Share on other sites More sharing options...
Iznogoud Posted September 28, 2005 Author Share Posted September 28, 2005 $output = file read line............;;;;;;;;;;;;thus $output = "12345-12345-12345-12345-12345 "$var = stringsplit($output, "-")For $x = 1 to $var[0]msgbox(0,"test", $var[$x])endif8)Just need a little help I have this code:$output = FileReadLine($file)$var = stringsplit($output, "-")FOR $x = 1 to $var[0]msgbox(0,"test", $var[$x])EndIFProblem is now, i get an error wich is: "if" statements must have a "Then" keyword.Did i make a typing error or did you forget something?I know you got more programming skills so i think i am doing something wrong but what? Link to comment Share on other sites More sharing options...
drak Posted September 28, 2005 Share Posted September 28, 2005 replace the "EndIF" with "Next" 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