FrancescoDiMuro

Write n strings to file, then @CRLF

7 posts in this topic

#1 ·  Posted (edited)

Hi guys! Little question...
How can I write in a file a sequence of 5 strings and then, go @CRFL?
The strings are generated in a For...Next loop:
 

For $i = 0 To $iListLenght - 1
    If _GUICtrlListView_GetItemChecked($listview_Lista, $i) Then
        $sRiga = '"' & _GUICtrlListView_GetItemText($listview_Lista, $i, 1) & '.F_CV"' & ';' & '"0,1"'
    EndIf
Next

How can I write to a file this line after 5 times a loop generated them?

I thought something like put the row in an array, and then, reached the 5 times that it has been generated, write to a file...
In synthesis, I need to make a group of 5 generated data, and then, go @CRLF.
Can someone suggest me something, please? 
Thanks :) 

Edited by FrancescoDiMuro
Forgot a '

Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

Share this post


Link to post
Share on other sites



47 minutes ago, j0kky said:

You could concatenate strings through &= operator, add the final @CRLF and then write to a file with FileWrite...

Hey, dear!
Yeah, something like that... I need to proceed with For...Next loop in each case... 
Thanks :) 


Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

Share this post


Link to post
Share on other sites

One way that comes to mind:

#include <File.au3>

$aFileList = _FileListToArray("c:\windows")

$outputFile = FileOpen("c:\tmp\test.txt", $FO_OVERWRITE)

For $fileId = 1 To $aFileList[0]
    FileWrite($outputFile, $aFileList[$fileId] & ((Mod($fileId, 5) == 0 Or $fileId == $aFileList[0]) ? @CRLF : "|"))
Next

FileClose($outputFile)

ShellExecute("c:\tmp\test.txt")

 


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites
3 minutes ago, SadBunny said:

One way that comes to mind:

#include <File.au3>

$aFileList = _FileListToArray("c:\windows")

$outputFile = FileOpen("c:\tmp\test.txt", $FO_OVERWRITE)

For $fileId = 1 To $aFileList[0]
    FileWrite($outputFile, $aFileList[$fileId] & ((Mod($fileId, 5) == 0 Or $fileId == $aFileList[0]) ? @CRLF : "|"))
Next

FileClose($outputFile)

ShellExecute("c:\tmp\test.txt")

 

Hey Bunny! 
I managed to with a pair of If... Thanks for the reply! :) An interesting thing... If I managed to get paid for the work I'm doing, I could donate a percentage of the payment to this fantastic language :D Would be nice... 


Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

Share this post


Link to post
Share on other sites
8 minutes ago, FrancescoDiMuro said:

Hey Bunny! 
I managed to with a pair of If... Thanks for the reply! :) An interesting thing... If I managed to get paid for the work I'm doing, I could donate a percentage of the payment to this fantastic language :D Would be nice... 

I'm sure that would be very welcome.


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites
Just now, SadBunny said:

I'm sure that would be very welcome.

Ahahahah, I now right Bu[dd][nn]y :D
When I'll develop something for work, using the tools I made either with your help, If the customer pay us for the use of my tools, I'll be pretty sure I'm going to donate everytime I develop an application :D


Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

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