Jump to content
Sign in to follow this  

Write array to same line

Recommended Posts


How do I write an entire array to the same line of a file? Since I've posted this I've gotten the below code to work, but this doesn't seem like the right way to do this.

;$file is a file containing multiple xml entries containing <genre>

$genre = _StringBetween($file, "<genre>", "</genre>"
$array = Ubound($genre)
$i = 0  
FileWriteLine("genres.xml", "<genres>")
    $file = FileOpen("genres.xml")
    $read = FileReadLine($file, 1)
    _FileWriteToLine("genres.xml", 1, $read & $genre[$i] & " / ",1)
    $i = $i + 1
Until $i = $array
Edited by mud409

Share this post

Link to post
Share on other sites

Try FileWrite instead of FileWriteLine. Something like this:

#include <File.au3>

Local $aArray[5]
    $aArray[0] = "Jim"
    $aArray[1] = "Joe"
    $aArray[2] = "Bob"
    $aArray[3] = "Nancy"
    $aArray[4] = "Martha"

For $element in $aArray
    FileWrite(@DesktopDir & "\Test.txt", $element & " ")

√-1 2^3 ∑ π, and it was delicious!

Share this post

Link to post
Share on other sites

_ArrayToString could work also, but it's the same deal :)...(not the writing, but the loop)

Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

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.