Jump to content

Amount of lines set in $var


Recommended Posts

Ok this ones a bit hard to explain, I have a $var that will be set to a number by iniread. I need to have it so that if that number is 1 it will add 1 line, if that number is 2 it will add 2 lines, 3 add 3 lines, ect.

example:

if it says Lines=1 then have it

$line1 = blah

if it says Lines=2 then have it

$lines1 = blah

$lines2 = blahblah

Lines=3 then

$lines1 = blah

$lines2 = blahblah

$lines3 = blahblahblah

What I'm attempting to do is make it so that the script can update itself from the setup.ini file so i need it to be able to insert the $lines# itself too. if anybody has a different way of doing this I'm open to suggestions.

Edited by AcidCorps
Link to comment
Share on other sites

Like this?

it will give a compile error because the var's have not been created yet, but it works if you continue

$var = 3
$filler = "blah"
For $i = 1 To $var
    $string = ""
    For $x = 1 To $i
        $string &= $filler
    Next
    Assign("line" & $i, $string)
Next
MsgBox(4096,"", $line1 & @CRLF & $line2 & @CRLF & $line3)
Edited by SpookMeister

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Link to comment
Share on other sites

I tried it and it works perfectly, no errors.

wierd... well I might be using an older version. Need to fix that :)

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

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...