Jump to content
Sign in to follow this  
qwertylol

combined file name - saving $var

Recommended Posts

qwertylol

this is a loop

loop

{

save txt file in a file named file + $var + .txt with content of $data , which contains a string.

$var = $var + 1

}

how do I do this?

Share this post


Link to post
Share on other sites
Paulie

Use arrays?

Edited by Paulie

Share this post


Link to post
Share on other sites
qwertylol

I want to save txt string $data to a .txt file , how do I do it?

I want the .txt files to be named as 1.txt, 2.txt, 3.txt, 4.txt, 5.txt,

how do I do it?

Share this post


Link to post
Share on other sites
smashly

Not tested as the pc I'm currently on doesn't have autoit or scite, but it's something like this.

$HowManyFiles = 5

$Data = "My Text File"

For $i = 1 To $HowManyFiles
   $FO = FileOpen(@ScriptDir & "\" & $Data & $i & ".txt", 1)
   FileWrite($FO, $Data & $i)
   FileClose($FO)
NextoÝ÷ ØêÚºÚ"µÍÌÍÒÝÓX[Q[ÈH
BÌÍÑ]HH  ][ÝÓ^H^[I][ÝÂÌÍÚHHB    ÌÍÑÈH[SÜ[ØÜ  [È ][ÝÉÌLÉ][ÝÈ   [È ÌÍÑ]H    [È ÌÍÚH [È ][ÝË  ][ÝËJB[UÜ]J  ÌÍÑË    ÌÍÑ]H    [È ÌÍÚJB[PÛÜÙJ   ÌÍÑÊB   ÌÍÚH
ÏHB[[  ÌÍÚHH    ÌÍÒÝÓX[Q[oÝ÷ ØêÚºÚ"µÍÌÍÒÝÓX[Q[ÈH
BÌÍÑ]HH  ][ÝÓ^H^[I][ÝÂÌÍÚHHBÚ[H
    ÌÍÚH ÏH ÌÍÒÝÓX[Q[ÊB   ÌÍÑÈH[[ØÜ  [È ][ÝÉÌLÉ][ÝÈ   [È ÌÍÑ]H    [È ÌÍÚH [È ][ÝË  ][ÝËJB[]J  ÌÍÑË    ÌÍÑ]H    [È ÌÍÚJB[PÛÜÙJ   ÌÍÑÊB   ÌÍÚH
ÏHHÑ[

Cheers

Edit: typo's

Edited by smashly

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.