Sign in to follow this  
Followers 0
Krikov

GUIDataSeparatorChar Probelm

3 posts in this topic

Hello

i am Trying to create a ListView Form A TXT File That i Read to an Array

But i notice that i need to use The Opt("GUIDataSeparatorChar", "|") but i cant figure it up

What am i Doing Wrong Please Help Me

#include <GUIConstants.au3>
#include <array.au3>
#Include <GuiList.au3>
#Include <GuiListView.au3>
#include <file.au3>
Dim $Process
$Form1 = GUICreate("Form1", 622, 441, 192, 125)
$Button1 = GUICtrlCreateButton("Show Process", 280, 45, 85, 25)
GUISetState(@SW_SHOW)
GUISetState ()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
        Case $msg = $Button1; Show Process Name
        $List1 = GUICtrlCreateListView("Process Name|Pid|Pri|Thd|Hnd|Priv|CPU Time|Elapsed Time", 16, 136, 450, 292, -1)
            Opt("GUIDataSeparatorChar",' ')
            _FileReadToArray("C:\Temp\Data\Services.TXT",$Process)
            For $i = 1 to $Process[0]
                GUICtrlCreateListViewItem($Process[$i],$List1)
            Next
            Case Else
    ;;;;;;;
    EndSelect
WEnd
Exit

here is the TXT File

Thanks

Krikov :lmao:


[topic="63488"][font="Arial"]Krikov Tray Quick Menu[/font][/topic]

Share this post


Link to post
Share on other sites



Sorry For Spam The Forum But Here is The TXT File

Services.TXT

Krikov


[topic="63488"][font="Arial"]Krikov Tray Quick Menu[/font][/topic]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Sorry For Spam The Forum But Here is The TXT File

Services.TXT

Krikov

Hi,

is it that what you wanted?

#include <GUIConstants.au3>
#include <file.au3>
#include <array.au3>
Opt("GUIDataSeparatorChar", "|")

Local $MyFile = @ScriptDir & "/Services2.TXT"
Dim $MyData

GUICreate("listview items", 650, 550, 50, 50, -1, $WS_EX_ACCEPTFILES)
GUISetBkColor(0x00E0FFFF); will change background color

$listview = GUICtrlCreateListView("Process Name|Pid|Pri|Thd|Hnd|Priv|CPU Time|Elapsed Time", 10, 10, 500, 450);,$LVS_SORTDESCENDING)
$button = GUICtrlCreateButton("Value?", 10, 470, 70, 20)
GUICtrlSetState(-1, $GUI_DROPACCEPTED); to allow drag and dropping
GUISetState()

_FileReadToArray($MyFile, $MyData)
For $i = 2 To $MyData[0]
    GUICtrlCreateListViewItem($MyData[$i], $listview)
Next

GUISetState(@SW_SHOW)

Do
    $msg = GUIGetMsg()
    
    Select
        Case $msg = $button
            MsgBox(0, "Listview item", GUICtrlRead(GUICtrlRead($listview)), 2)
        Case $msg = $listview
            MsgBox(0, "Listview", "clicked=" & GUICtrlGetState($listview), 2)
    EndSelect
Until $msg = $GUI_EVENT_CLOSE

Exit (0)

Firstly, I prepared the file(services.txt) with the function attached.

So long,

Mega

Edited by th.meger

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

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