jjohn Posted January 26, 2006 Share Posted January 26, 2006 just wondering how to get GUICtrlCreateListViewItem to get the selected lines when the window is minimized, i got the following code, when i have the line to minimize the script, the expected result will not show in the text file, but i need to run the script in the background, please help expandcollapse popup#include <GuiConstants.au3> #include <GuiListView.au3> Opt ('MustDeclareVars', 1) Dim $listview, $Btn_GetSelected, $Btn_Exit, $msg, $Status, $ret, $ret2, $iter GUICreate("ListView Get Item Text", 392, 322) $listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149,$LVS_SHOWSELALWAYS,BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_REGIONAL)) GUICtrlCreateListViewItem("line1|data1|more1", $listview) GUICtrlCreateListViewItem("line2|data2|more2", $listview) GUICtrlCreateListViewItem("line3|data3|more3", $listview) GUICtrlCreateListViewItem("line4|data4|more4", $listview) GUICtrlCreateListViewItem("line5|data5|more5", $listview) $Btn_GetSelected = GUICtrlCreateButton("Get Selected", 200, 200, 90, 40) $Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30) $Status = GUICtrlCreateLabel("", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER)) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit ExitLoop Case $msg = $Btn_GetSelected GUICtrlSetData($Status, "") $ret2 = _GUICtrlListViewGetSelectedIndices ($listview, 1) $ret = _GUICtrlListViewGetItemText ($listview) If ($ret <> $LV_ERR) Then ;currently need to take out next line to get result WinSetState ( "ListView Get Item Text", "", @SW_MINIMIZE ) For $iter = 1 To $ret2[0] $ret = _GUICtrlListViewGetItemText ($listview, $iter, 0) FileWriteLine(@ScriptDir & "\selectln.txt", $ret) Next Else GUICtrlSetData($Status, "Nothing Selected") EndIf EndSelect WEnd Exit Link to comment Share on other sites More sharing options...
GaryFrost Posted January 27, 2006 Share Posted January 27, 2006 expandcollapse popup#include <GuiConstants.au3> #include <GuiListView.au3> Opt ('MustDeclareVars', 1) Dim $listview, $Btn_GetSelected, $Btn_Exit, $msg, $Status, $ret, $ret2, $iter, $gui $gui = GUICreate("ListView Get Item Text", 392, 322) $listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149,$LVS_SHOWSELALWAYS,BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_REGIONAL)) GUICtrlCreateListViewItem("line1|data1|more1", $listview) GUICtrlCreateListViewItem("line2|data2|more2", $listview) GUICtrlCreateListViewItem("line3|data3|more3", $listview) GUICtrlCreateListViewItem("line4|data4|more4", $listview) GUICtrlCreateListViewItem("line5|data5|more5", $listview) $Btn_GetSelected = GUICtrlCreateButton("Get Selected", 200, 200, 90, 40) $Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30) $Status = GUICtrlCreateLabel("", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER)) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit ExitLoop Case $msg = $Btn_GetSelected GUICtrlSetData($Status, "") $ret2 = _GUICtrlListViewGetSelectedIndices ($listview, 1) $ret = _GUICtrlListViewGetItemText ($listview) If ($ret <> $LV_ERR) Then ;currently need to take out next line to get result WinSetState ( "ListView Get Item Text", "", @SW_MINIMIZE ) For $iter = 1 To $ret2[0] $ret = _GUICtrlListViewGetItemText ($listview, $iter, 0,$gui) FileWriteLine(@ScriptDir & "\selectln.txt", $ret) Next Else GUICtrlSetData($Status, "Nothing Selected") EndIf EndSelect WEnd Exit SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
jjohn Posted January 27, 2006 Author Share Posted January 27, 2006 Thanks, this a really wonderful, i thought i need a lot of change on it, but it turn out to be so great. Link to comment Share on other sites More sharing options...
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