Sign in to follow this  
Followers 0
walle

Help with Arrays, and seperating data

4 posts in this topic

I would like some help with seperating, or read the data between "|", so I

easily could insert the data into labels using, GUICtrlCreateLabel.

Here is an example of output "4.37 GB|100.0 %|Seeding|0 (282)|1 (22)|0.1 kB/s|47.3 kB/s|1d 16h|85.5 MB¶"

#include <IE.au3>

$rows = ControlListView("µTorrent 1.7.5", "", "SysListView321", "GetItemCount", "")
$columns = ControlListView("µTorrent 1.7.5", "", "SysListView321", "GetSubItemCount", "")
$file = FileOpen( @HomeDrive & "\Temp\IMG" & "\temptorrent.ini", 2 )
For $i = 0 To $rows -1
    $data = ""
    For $r = 1 To 10
        If $r <> 1 Then
            If $r = 10 Then
                $data = ControlListView("µTorrent 1.7.5", "", "SysListView321", "GetText", $i, $r)
                If $data = "" Then $data = "N/A"
                If $data = "8" Then $data = "Forever"
            Else
                $data = ControlListView("µTorrent 1.7.5", "", "SysListView321", "GetText", $i, $r) & "|"
                If $data = "|" Then $data = "N/A"
                If $data = "8|" Then $data = "Forever|"
            EndIf
            FileWrite( $file, $data )
        EndIf
    Next
    FileWriteLine( $file, "¶" )
Next
FileClose( $file )
ConsoleWrite(FileRead( @HomeDrive & "\Temp\IMG" & "\temptorrent.ini" ) )
ConsoleWrite( @CRLF & StringLen( FileRead( @HomeDrive & "\Temp\IMG" & "\temptorrent.ini" ) ) )

4.37 GB|100.0 %|Seeding|0 (282)|1 (22)|0.1 kB/s|47.3 kB/s|1d 16h|85.5 MB¶
62.2 MB|100.0 %|Seeding|0 (13)|0 (3)|N/AN/A8|0.0 kB¶
40.1 MB|100.0 %|Seeding|0 (7)|0 (0)|N/AN/A8|0.0 kB¶
88.2 MB|100.0 %|Seeding|0 (46)|0 (11)|N/AN/A8|10.1 MB¶
97.9 MB|100.0 %|Seeding|0 (43)|0 (10)|N/AN/A8|9.71 MB¶
4.40 GB|100.0 %|Seeding|0 (717)|0 (9)|N/AN/A8|378 MB¶
774 MB|100.0 %|Seeding|0 (118)|3 (22)|0.1 kB/s|10.3 kB/s|1d 1h|240 MB¶
4.40 GB|100.0 %|Seeding|0 (773)|2 (76)|0.3 kB/s|0.2 kB/s|8|152 MB¶
3.71 GB|100.0 %|Finished|0 (0)|0 (0)|N/AN/A8|88.3 MB¶
69.0 MB|100.0 %|Seeding|0 (9)|0 (1)|N/AN/A8|0.0 kB¶
4.46 GB|0.1 %|Stopped|0 (0)|0 (0)|N/AN/A8|0.0 kB¶
4.39 GB|33.9 %|Stopped|0 (0)|0 (0)|N/AN/A8|32.0 kB¶

Share this post


Link to post
Share on other sites



Use a StringSplit($Array, "|")

Share this post


Link to post
Share on other sites

$myData = "4.37 GB|100.0 %|Seeding|0 (282)|1 (22)|0.1 kB/s|47.3 kB/s|1d 16h|85.5 MB¶"

$myArray = StringSplit($myData, "|")

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

$myData = "4.37 GB|100.0 %|Seeding|0 (282)|1 (22)|0.1 kB/s|47.3 kB/s|1d 16h|85.5 MB¶"

$myArray = StringSplit($myData, "|")

ofc, thank you!

Edited by walle

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  
Followers 0