Glyph Posted August 1, 2007 Posted August 1, 2007 (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 August 1, 2007 by backstabbed tolle indicium
xcal Posted August 1, 2007 Posted August 1, 2007 Uh...what? $file = FileOpenDialog('', @ScriptDir, 'All Files (*.*)') MsgBox(0, '', $file) How To Ask Questions The Smart Way
Glyph Posted August 1, 2007 Author Posted August 1, 2007 (edited) if $msg = $loadmenu Then $file = FileOpenDialog("Choose file...",@ProgramFilesDir,"All (*.*)") _GUICtrlListViewSetItemText ($listview, 2, 1, $file) EndIf Edited August 1, 2007 by backstabbed tolle indicium
enaiman Posted August 1, 2007 Posted August 1, 2007 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 :)
Glyph Posted August 1, 2007 Author Posted August 1, 2007 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
enaiman Posted August 1, 2007 Posted August 1, 2007 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 :)
xcal Posted August 2, 2007 Posted August 2, 2007 (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 August 2, 2007 by xcal How To Ask Questions The Smart Way
Glyph Posted August 2, 2007 Author Posted August 2, 2007 That's exactly what i mean. ;o Thank you!!! tolle indicium
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