Search the Community
Showing results for tags 'getselected'.
-
Hi Guys, I am writing a script that will check a set of folders to populate a list with available data. Here is how i create the liveview: $listview = GUICtrlCreateListView("", 10, 30, 330, 250) _GUICtrlListView_InsertColumn($listview, 0, "Client Name", 160) _GUICtrlListView_InsertColumn($listview, 1, "Available P11D Data", 160) If FileExists($Location & "2005-2006\P11DDATA.MDB") Then GUICtrlCreateListViewItem($Client & "|2005-2006", $listview) EndIf If FileExists($Location & "2006-2007\P11DDATA.MDB") Then GUICtrlCreateListViewItem($Client & "|2006-2007", $listview) EndIf Next here i want to select one of the list view items and when i click open it will run the relevant command. GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUISetState() Do $msg = GUIGetMsg() If $msg = $open Then $iSelect = ControlListView($hGUI, "", $listview, "GetSelected") If $iSelect = "" Then MsgBox(0, "ERROR!", "No data selected, the program will now exit.") Exit EndIf If $iSelect = 0 Then Run('"C:\Program Files\Microsoft Office\Office14\MSACCESS.EXE" /runtime /wrkgrp "' & $Location & '2005-2006\P11D.mdw" "' & $Location & '2005-2006\P11DSys.mdb"') EndIf If $iSelect = 1 Then MsgBox(0, "Pretend Run", "2006-2007") EndIf The problem i am having is with this line: $iSelect = ControlListView($hGUI, "", $listview, "GetSelected") Depending on which item is seleted it flags it using a 0, 1, 2 onwards where as i want it to get the text from the list view because if all the data doesnt exists the numbers are not in the correct order so it will run the wrong command. I have tried GetText but either i dont understand the syntax so am doing it wrong or it just doesnt work (most likely the first :-() Can anyone help? Thank you P.S. If anyone can identify why this line doesnt work properly that would be appreciated: If $iSelect = "" Then MsgBox(0, "ERROR!", "No data selected, the program will now exit.") Exit EndIf If i dont have the "Exit" command it automatically launches the next command down which it shouldnt as that isnt selected!