gottygolly Posted May 23, 2014 Share Posted May 23, 2014 I've been working on some different code here and there and I saw a post about double clicking in a GuiCtrlCreateListView(). So I decided to just mess around with it and learn it as good as I can. However the problem I am having is I have a line: GuiCtrlRead(GuiCtrlRead($var)), it can read the $var but it will read it as: Example.exe| and it won't run because of the " | ". Anyone know the error? #include <File.au3> #include<guiconstants.au3> $gui = GUICreate("GUI",300,300,-1,-1) GUIRegisterMsg($WM_NOTIFY,"WM_NOTIFY") $b = GUICtrlCreateButton("Load",10,10,100,20) $list = GUICtrlCreateListView("Swf List",5,40,290,260) Global $DoubleClicked = False GUISetState() While 1 If $DoubleClicked Then double() $DoubleClicked = False EndIf $msg = GUIGetMsg(1) Switch $msg[1] Case $gui Switch $msg[0] Case -3 Exit Case $b GUICtrlCreateListViewItem("notepad.exe",$list) EndSwitch EndSwitch WEnd Func WM_NOTIFY($hWnd, $MsgID, $wParam, $lParam) Local $tagNMHDR, $event, $hwndFrom, $code $tagNMHDR = DllStructCreate("int;int;int", $lParam) If @error Then Return 0 $code = DllStructGetData($tagNMHDR, 3) If $wParam = $list And $code = -3 Then $DoubleClicked = True Return $GUI_RUNDEFMSG EndFunc Func double() $go = GUICtrlRead(GUICtrlRead($list)) ShellExecute($go) EndFunc Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 23, 2014 Moderators Share Posted May 23, 2014 gottygolly,There is no error - GUICtrlRead adds a delimiter at the end of the ListView content. If you add another column to the ListView like this you can see that the same thing happens:expandcollapse popup#include <File.au3> #include<guiconstants.au3> $gui = GUICreate("GUI", 300, 300, -1, -1) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") $b = GUICtrlCreateButton("Load", 10, 10, 100, 20) $list = GUICtrlCreateListView("Swf List| ", 5, 40, 290, 260) Global $DoubleClicked = False GUISetState() While 1 If $DoubleClicked Then double() $DoubleClicked = False EndIf $msg = GUIGetMsg(1) Switch $msg[1] Case $gui Switch $msg[0] Case -3 Exit Case $b GUICtrlCreateListViewItem("notepad.exe|3", $list) EndSwitch EndSwitch WEnd Func WM_NOTIFY($hWnd, $MsgID, $wParam, $lParam) Local $tagNMHDR, $event, $hwndFrom, $code $tagNMHDR = DllStructCreate("int;int;int", $lParam) If @error Then Return 0 $code = DllStructGetData($tagNMHDR, 3) If $wParam = $list And $code = -3 Then $DoubleClicked = True Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func double() $go = GUICtrlRead(GUICtrlRead($list)) ShellExecute($go) EndFunc ;==>doubleSo you need to use StringTrimRight to remove the added delimiter - then you will get what you require. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
gottygolly Posted May 23, 2014 Author Share Posted May 23, 2014 (edited) Thanks for the help Melba. I tried to insert the StringTrimRight() like you said to do but it seems to be doing anything. I might be doing something wrong can you point it out? expandcollapse popup#include <File.au3> #include<guiconstants.au3> $gui = GUICreate("GUI",300,300,-1,-1) GUIRegisterMsg($WM_NOTIFY,"WM_NOTIFY") $b = GUICtrlCreateButton("Load",10,10,100,20) $list = GUICtrlCreateListView("Swf List",5,40,290,260) Global $DoubleClicked = False GUISetState() While 1 If $DoubleClicked Then double() $DoubleClicked = False EndIf $msg = GUIGetMsg(1) Switch $msg[1] Case $gui Switch $msg[0] Case -3 Exit Case $b $fr = StringTrimRight("notepad.exe",0) GuiCtrlCreateListViewItem($fr,$list) EndSwitch EndSwitch WEnd Func WM_NOTIFY($hWnd, $MsgID, $wParam, $lParam) Local $tagNMHDR, $event, $hwndFrom, $code $tagNMHDR = DllStructCreate("int;int;int", $lParam) If @error Then Return 0 $code = DllStructGetData($tagNMHDR, 3) If $wParam = $list And $code = -3 Then $DoubleClicked = True Return $GUI_RUNDEFMSG EndFunc Func double() $go = GUICtrlRead(GUICtrlRead($list)) ShellExecute($go) EndFunc Edited May 23, 2014 by gottygolly Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 23, 2014 Moderators Share Posted May 23, 2014 gottygolly,As it is GUICtrlRead that returns the extra delimiter, it is that string that you need to trim: $go = StringTrimRight(GUICtrlRead(GUICtrlRead($list)), 1)M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Solution gottygolly Posted May 23, 2014 Author Solution Share Posted May 23, 2014 Sweet, works like its suppose to Thanks for the help Melba I just had a bit of a brain fart. 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