Sign in to follow this  
Followers 0
maurocav

FileOpenDialog,FileOpen

4 posts in this topic

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

Share this post


Link to post
Share on other sites



_FileReadToArray() uses FileOpen within the UDF so all you need to provide is a file path, not a handle returned from FileOpen().

:whistle:

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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

:whistle:

Edit:

Typo

Edited by MHz

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