Jump to content

reading csv Fields


Recommended Posts

Hi,

is it possible to read a Field in a *.csv table (:D and then

copy that field to clipboard?

Example:

C:\test.csv

Field1;Field2;Field3

Msgbox

Line 1: this is Field2, copy Field2 to clipboad....do something

Line 1: this is Field3, copy Field2 to clipboad....do something

next

Line 2: this is Field3, copy Field2 to clipboad....do something

I tried many things...and houres

$input = FileOpen("c:\test.csv",0)

but I don't know how to solve this Problem!

THANKS for help

Link to comment
Share on other sites

Lookup StrinSplit in the help file.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

thank you

I had an older Version and this code worked...

Loop, Read, FileName.csv,

{

Loop, Parse, A_LoopReadLine, `;

{

if A_Index = 3

{

Field3 = %A_LoopField%

msgbox %Field3%

}

}

}

Could you help me with Version 3.1 it is total different! :D

Link to comment
Share on other sites

HI,

#include <file.au3>
#include <GUICONSTANTS.au3>

Global $a_cvs
$s_Path = FileOpenDialog("Select CVS File", @ScriptDir, "comma seperated values (*.csv)")
If @error Then
    MsgBox(4096, "", "No File(s) chosen")
    Exit
Else
    _FileReadToArray($s_Path, $a_cvs)
    GUICreate("CVS Listview", 620, 250, -1, -1)
    $listview = GUICtrlCreateListView(StringReplace($a_cvs[1],";","|"), 10, 10, 600, 210)
    GuiSetState()
    For $i = 2 To UBound($a_cvs) - 1
        $s_temp = StringReplace($a_cvs[$i], ";", "|")
        GUICtrlCreateListViewItem($s_temp, $listview)
    Next
EndIf
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    EndSelect
WEnd
Exit

So long,

Mega

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

Link to comment
Share on other sites

thanks you,

it is a really big code!!!

Is there no other possibility to read the csv fields and do an action?

The Problem is

take from First line Field 2

copy to clipboard

do something...

Link to comment
Share on other sites

Hi,

your solution shows the csv table great!

But the problem I have is to get field-entries

Example:

Line 1 Field 1 = Fred

Copy Fred to Clipboard? If yes then do something....

Line 2 Field 2 = Paris

How can I react?

I mean ...do something....with Line1 Field2;Field3, Line2 Field2;Field3

thanks for help

Uwe

:D

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...