maurocav Posted March 22, 2007 Posted March 22, 2007 Why it work with FileOpenDialog and not with FileOpen? Tank #include <file.au3> #include <GUICONSTANTS.au3> Global $a_csv ;$s_Path = FileOpenDialog("Select csv File", @ScriptDir, "csv (*.csv)") $s_Path = FileOpen("test.csv", 0) If @error Then MsgBox(4096, "", "No File(s) chosen") Exit Else _FileReadToArray($s_Path, $a_csv) GUICreate("csv Listview", 220, 250, -1, -1) $listview = GUICtrlCreateListView("Col1 |Col2 ", 10, 10, 200, 210) GuiSetState() For $i = 1 To UBound($a_csv) - 1 $s_temp = StringReplace($a_csv[$i], ",", "|") GUICtrlCreateListViewItem($s_temp, $listview) Next EndIf While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd Exit
MHz Posted March 22, 2007 Posted March 22, 2007 _FileReadToArray() uses FileOpen within the UDF so all you need to provide is a file path, not a handle returned from FileOpen().
davidp Posted March 22, 2007 Posted March 22, 2007 Hello, I'm also new to Autoit. Can someone explain to me what a UDF is and how to put it to use? Thanks in advance.
MHz Posted March 22, 2007 Posted March 22, 2007 (edited) davidp said: Hello, I'm also new to Autoit. Can someone explain to me what a UDF is and how to put it to use? Thanks in advance.Welcome, A UDF is a User Defined Function which you can create yourself that can behave just like a builtin function of AutoIt. The code between the Func and EndFunc keywords contains the code to execute and every UDF has a name so you can call it. Parameters are passable by using variables that can store your values and pass them through the UDF for processing. Example ; Calling a User Defined Function that I made _UserDefinedFunction('Text that I can sent to the UDF') Func _UserDefinedFunction($text) ; This is a User Defined Function that I made MsgBox(0, 'Msgbox in UDF', $text) EndFunc Edit: Typo Edited March 22, 2007 by MHz
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now