Sign in to follow this  
Followers 0
Glyph

Fileopen into a variable?

8 posts in this topic

#1 ·  Posted (edited)

if $msg = $loadmenu Then $file = FileOpenDialog("Choose file...",@ProgramFilesDir,"All (*.*)")
            
            _GUICtrlListViewSetItemText ($listview, 2, 1, $file)

How would i get the file opened into a variable?

i've looked up a few commands but they dont relate to my trouble...

they only open the atual program.. i want it in a variable...

Edited by backstabbed

tolle indicium

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

if $msg = $loadmenu Then 
            $file = FileOpenDialog("Choose file...",@ProgramFilesDir,"All (*.*)")
            _GUICtrlListViewSetItemText ($listview, 2, 1, $file)
            EndIf

Edited by backstabbed

tolle indicium

Share this post


Link to post
Share on other sites

The $file variable contains only the file name (with the path attached).

I suppose that you want the file CONTENT to be stored into a variable. In this case you might want to use _FileReadToArray (included in File.au3 UDF) - that will read the content of your file into an array and you can manipulate that information any way you want.

This is only a supposition ... if it is not true - try to explain better what do you want to do.


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

Ok what i want is the file that was opened eg: "c:\test.exe" to be updartes in my list view after they click open


tolle indicium

Share this post


Link to post
Share on other sites

Still not clear enough :)

What is supposed to do your Test.exe?


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

You mean something like this?

#include <GUIConstants.au3>
#include <GUIListView.au3>

GUICreate('Some GUI', 300, 200)

$btn = GUICtrlCreateButton('Add File', 10, 10, 60, 26)

$lv = GUICtrlCreateListView('Files', 10, 46, 280, 144, -1, $LVS_EX_GRIDLINES)
_GUICtrlListViewSetColumnWidth($lv, 0, 276)

GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $btn
            $file = FileOpenDialog('Select a file', 'c:\', 'All Files (*.*)')
            If Not @error Then _GUICtrlListViewInsertItem($lv, 0, $file) ; edit - change 0 to -1 to append
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd
Edited by xcal

Share this post


Link to post
Share on other sites

That's exactly what i mean. ;o Thank you!!!


tolle indicium

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