Developers Jos Posted December 24, 2010 Developers Share Posted December 24, 2010 ...only a question...now if i write for example England...it give me also the name of the section [England] how i can exclude that result?... Not for me. When I change BBC to England, nothing is shown... as it should. Show how you have integrated my code in your script. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
AuToItItAlIaNlOv3R Posted December 24, 2010 Author Share Posted December 24, 2010 (edited) Unfurtnately i don't know why but now your script dont work...scite five me this error with this code... expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <GuiListView.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GUIComboBox.au3> ; Read INI into a single array Global $AllIniSec = IniReadSectionNames("station.ini") Dim $AllStations[100][3] $AllStationsCount = 0 If @error Then MsgBox(4096, "", "Error occurred, probably no INI file.") Else For $s = 1 To $AllIniSec[0] $var = IniReadSection("station.ini", $AllIniSec[$s]) If @error Then MsgBox(4096, "", "Error occurred, probably no INI file.") Else For $i = 1 To $var[0][0] $AllStations[$AllStationsCount][0] = $AllIniSec[$s] ; Country $AllStations[$AllStationsCount][1] = $var[$i][0] ; Key $AllStations[$AllStationsCount][2] = $var[$i][1] ; Value $AllStationsCount += 1 Next EndIf Next EndIf ; Print all stations containing BBC For $x = 0 To $AllStationsCount - 1 If StringInstr($AllStations[$x][1],"BBC") Then ConsoleWrite("Country=") ConsoleWrite($AllStations[$x][0]) ConsoleWrite(" Radioname=") ConsoleWrite($AllStations[$x][1]) ConsoleWrite(" Link info=") ConsoleWrite($AllStations[$x][2]) ConsoleWrite(@CRLF) EndIf Next This is the error : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: $AllStations[$AllStationsCount][0] = $AllIniSec[$s] Why? Another question why you put this array to 100? Dim $AllStations[100][3] @EDIT I fix it, i've increased this Dim $AllStations[100][3]...how i can set this variable with the right numer of radio station...because the radio station are increasing whit the time and there is a possible error to have a range exceed Edited December 24, 2010 by AuToItItAlIaNlOv3R Link to comment Share on other sites More sharing options...
AuToItItAlIaNlOv3R Posted December 26, 2010 Author Share Posted December 26, 2010 (edited) Ok i write the script, there are only other 2 problems ...Your help was very precious. I've this code : expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <GuiListView.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GUIComboBox.au3> #Region //GUI Local $hGUI = GUICreate("Form2", 581, 348, 275, 147) Local $hComboBox = _GUICtrlComboBox_Create($hGUI, "", 152, 8, 185, 25) $Label1 = GUICtrlCreateLabel("Search your preferite radio:", 8, 8, 131, 17) Local $ListView = GUICtrlCreateListView("Name|Streaming|Web Site|Genere", 0, 32, 577, 313) Local $hListView = GUICtrlGetHandle($ListView) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 150) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 150) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 150) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 3, 120) GUISetState(@SW_SHOW) #EndRegion //GUI GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") Global $AllIniSec = IniReadSectionNames("station.ini") Dim $AllStations[5000][3] $AllStationsCount = 0 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) Local $hWndFrom, $iIDFrom, $iCode, $sText, $iItem $hWndFrom = $ilParam $iIDFrom = BitAND($iwParam, 0xFFFF) $iCode = BitShift($iwParam, 16) Switch $hWndFrom Case $hComboBox Switch $iCode Case $CBN_EDITCHANGE $sText = _GUICtrlComboBox_GetEditText($hComboBox) If $sText <> "" Then _UpdateListView($sText) Else _GUICtrlListView_DeleteAllItems($hListView) EndIf EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>_WM_COMMAND Func _UpdateListView($sText) _GUICtrlListView_BeginUpdate($hListView) _GUICtrlListView_DeleteAllItems($hListView) For $s = 1 To $AllIniSec[0] $var = IniReadSection("station.ini", $AllIniSec[$s]) If @error Then MsgBox(4096, "", "Error occurred, probably no INI file.") Else For $i = 1 To $var[0][0] $AllStations[$AllStationsCount][0] = $AllIniSec[$s] ; Country $AllStations[$AllStationsCount][1] = $var[$i][0] ; Key $AllStations[$AllStationsCount][2] = $var[$i][1] ; Value $AllStationsCount += 1 Next EndIf Next For $x = 0 To $AllStationsCount - 1 If StringInStr($AllStations[$x][1], $sText) Then GUICtrlCreateListViewItem($AllStations[$x][1] & "|" & $AllStations[$x][1] & "|" & $AllStations[$x][1] & "|" & $AllStations[$x][1], $ListView) EndIf Next _GUICtrlListView_EndUpdate($hListView) EndFunc ;==>_UpdateListView The script work only if i insert in combobox only one letter, if i want insert for example this string "bbc" it give me this error: Array variable has incorrect number of subscripts or subscript dimension range exceeded.: $AllStations[$AllStationsCount][0] = $AllIniSec[$s] I think that was a problem in func "_UpdateListView", but i dont know where is the error and how to fix that. And other question...now i've thos array where are all link of searched radio: $AllStations[$x][2], this contain straming link and web site link. I try to split it without succes...how i can split that for inserct the right data in listview?...becouse how u can wath in list view now show only name of radio in all listview column. Thank's for help Edited December 26, 2010 by AuToItItAlIaNlOv3R Link to comment Share on other sites More sharing options...
AuToItItAlIaNlOv3R Posted December 27, 2010 Author Share Posted December 27, 2010 up Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 27, 2010 Moderators Share Posted December 27, 2010 AuToItItAlIaNlOv3R,Your code does not error for me, but I can see why it might. You are continually adding found radio stations to your array, which could therefore fill pretty quickly. You need to reset the array count as well as empty the ListView each time you refill it - see the code below. As to splitting the data - I showed you how to do that on the previous page. You do look at what we post I hope! This amended _UpdateListView function should do the trick: Func _UpdateListView($sText) _GUICtrlListView_BeginUpdate($hListView) _GUICtrlListView_DeleteAllItems($hListView) $AllStationsCount = 0 ; Reset the count each time <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< For $s = 1 To $AllIniSec[0] $var = IniReadSection("station.ini", $AllIniSec[$s]) If @error Then MsgBox(4096, "", "Error occurred, probably no INI file.") Else For $i = 1 To $var[0][0] $AllStations[$AllStationsCount][0] = $AllIniSec[$s] ; Country $AllStations[$AllStationsCount][1] = $var[$i][0] ; Key $AllStations[$AllStationsCount][2] = $var[$i][1] ; Value $AllStationsCount += 1 Next EndIf Next For $x = 0 To $AllStationsCount - 1 If StringInStr($AllStations[$x][1], $sText) Then $aData = StringSplit($AllStations[$x][2], "|") ; Split the value on the delimiter <<<<<<<<<<<<<<<<<<<<< $sItemText = $AllStations[$x][1] For $a = 1 To $aData[0] $sItemText &= "|" & $aData[$a] ; Add the items to the Item text <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Next GUICtrlCreateListViewItem($sItemText, $ListView) EndIf Next _GUICtrlListView_EndUpdate($hListView) EndFunc ;==>_UpdateListViewThe <<<<<<<<<<<<< lines show where I have amended the code.All clear? 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...
AuToItItAlIaNlOv3R Posted December 27, 2010 Author Share Posted December 27, 2010 (edited) @MelbaThank's a lot Melba23 your function work very well, but it's slow The ultimate bug to fix...i've added a control to reproduce the selected radio...but now with this function the search function give me a "fake result":Now it's my code :expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <GuiListView.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GUIComboBox.au3> #Region //GUI Local $hGUI = GUICreate("Form2", 581, 348, 275, 147) Local $hComboBox = _GUICtrlComboBox_Create($hGUI, "", 152, 8, 185, 25) $Label1 = GUICtrlCreateLabel("Search your preferite radio:", 8, 8, 131, 17) Local $ListView = GUICtrlCreateListView("Name|Streaming|Web Site|Genere", 0, 32, 577, 313) Local $hListView = GUICtrlGetHandle($ListView) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 150) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 150) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 150) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 3, 120) GUISetState(@SW_SHOW) #EndRegion //GUI GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") $gMediaObject = _CreateWMPlayer() Global $AllIniSec = IniReadSectionNames("station.ini") Dim $AllStations[5000][3] $AllStationsCount = 0 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) Local $hWndFrom, $iIDFrom, $iCode, $sText, $iItem $hWndFrom = $ilParam $iIDFrom = BitAND($iwParam, 0xFFFF) $iCode = BitShift($iwParam, 16) Switch $hWndFrom Case $hComboBox Switch $iCode Case $CBN_EDITCHANGE $sText = _GUICtrlComboBox_GetEditText($hComboBox) If $sText <> "" Then _UpdateListView($sText) Else _GUICtrlListView_DeleteAllItems($hListView) EndIf EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>_WM_COMMAND Func _UpdateListView($sText) _GUICtrlListView_BeginUpdate($hListView) _GUICtrlListView_DeleteAllItems($hListView) $AllStationsCount = 0 ; Reset the count each time <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< For $s = 1 To $AllIniSec[0] $var = IniReadSection("station.ini", $AllIniSec[$s]) If @error Then MsgBox(4096, "", "Error occurred, probably no INI file.") Else For $i = 1 To $var[0][0] $AllStations[$AllStationsCount][0] = $AllIniSec[$s] ; Country $AllStations[$AllStationsCount][1] = $var[$i][0] ; Key $AllStations[$AllStationsCount][2] = $var[$i][1] ; Value $AllStationsCount += 1 Next EndIf Next For $x = 0 To $AllStationsCount - 1 If StringInStr($AllStations[$x][1], $sText) Then $aData = StringSplit($AllStations[$x][2], "|") ; Split the value on the delimiter <<<<<<<<<<<<<<<<<<<<< $sItemText = $AllStations[$x][1] For $a = 1 To $aData[0] $sItemText &= "|" & $aData[$a] ; Add the items to the Item text <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Next GUICtrlCreateListViewItem($sItemText, $ListView) EndIf Next _GUICtrlListView_EndUpdate($hListView) EndFunc ;==>_UpdateListView Func _WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $I Global $hWndFrom, $iCode, $tNMHDR, $hWndListView, $lParam $hWndListView = $ListView $hWnd1 = $hGUI If Not IsHWnd($ListView) Then $hWndListView = GUICtrlGetHandle($ListView) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $LVN_ITEMACTIVATE Local $nmia = DllStructCreate($tagNMITEMACTIVATE, $lParam) $I = DllStructGetData($nmia, "Index") $SomeVariablex = _GUICtrlListView_GetItemTextArray($ListView) $gMediaObject.URL = $SomeVariablex[2] EndSwitch EndSwitch Return $__LISTVIEWCONSTANT_GUI_RUNDEFMSG EndFunc ;==>_WM_NOTIFY Func _CreateWMPlayer() $Object = ObjCreate("WMPlayer.OCX.7") $Object.URL = "" Return $Object EndFunc ;==>_CreateWMPlayerHow you can see i've added the "_WM_NOTIFY" function...this function work, it give me the correct selected item and reproduce the selected radio, but now the result of search give me a fake result ...see this picture for example You know how to fix that?...Thank's for all Happt new year Edited December 27, 2010 by AuToItItAlIaNlOv3R Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 27, 2010 Moderators Share Posted December 27, 2010 AuToItItAlIaNlOv3R, As far as I can tell everything is working correctly. Please post the file you are using so I can test on that. 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...
AuToItItAlIaNlOv3R Posted December 27, 2010 Author Share Posted December 27, 2010 The error with "_WM_NOTIFY" function active seems to be when the .ini (~600Kb) file is big...with a tiny station.ini file all work with well. But all work good if i don't include "_WM_NOTIFY". This is my code with "_WM_NOTIFY"...and if i include this function i've this error...it give me fake result as you can see on the image that i've posted. This is my code expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <GuiListView.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GUIComboBox.au3> #Region //GUI Local $hGUI = GUICreate("Form2", 581, 348, 275, 147) Local $hComboBox = _GUICtrlComboBox_Create($hGUI, "", 152, 8, 185, 25) $Label1 = GUICtrlCreateLabel("Search your preferite radio:", 8, 8, 131, 17) Local $ListView = GUICtrlCreateListView("Name|Streaming|Web Site|Genere", 0, 32, 577, 313) Local $hListView = GUICtrlGetHandle($ListView) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 150) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 150) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 150) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 3, 120) GUISetState(@SW_SHOW) #EndRegion //GUI GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") $gMediaObject = _CreateWMPlayer() Global $AllIniSec = IniReadSectionNames("station.ini") Dim $AllStations[5000][3] $AllStationsCount = 0 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) Local $hWndFrom, $iIDFrom, $iCode, $sText, $iItem $hWndFrom = $ilParam $iIDFrom = BitAND($iwParam, 0xFFFF) $iCode = BitShift($iwParam, 16) Switch $hWndFrom Case $hComboBox Switch $iCode Case $CBN_EDITCHANGE $sText = _GUICtrlComboBox_GetEditText($hComboBox) If $sText <> "" Then _UpdateListView($sText) Else _GUICtrlListView_DeleteAllItems($hListView) EndIf EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>_WM_COMMAND Func _UpdateListView($sText) _GUICtrlListView_BeginUpdate($hListView) _GUICtrlListView_DeleteAllItems($hListView) $AllStationsCount = 0 ; Reset the count each time <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< For $s = 1 To $AllIniSec[0] $var = IniReadSection("station.ini", $AllIniSec[$s]) If @error Then MsgBox(4096, "", "Error occurred, probably no INI file.") Else For $i = 1 To $var[0][0] $AllStations[$AllStationsCount][0] = $AllIniSec[$s] ; Country $AllStations[$AllStationsCount][1] = $var[$i][0] ; Key $AllStations[$AllStationsCount][2] = $var[$i][1] ; Value $AllStationsCount += 1 Next EndIf Next For $x = 0 To $AllStationsCount - 1 If StringInStr($AllStations[$x][1], $sText) Then $aData = StringSplit($AllStations[$x][2], "|") ; Split the value on the delimiter <<<<<<<<<<<<<<<<<<<<< $sItemText = $AllStations[$x][1] For $a = 1 To $aData[0] $sItemText &= "|" & $aData[$a] ; Add the items to the Item text <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Next GUICtrlCreateListViewItem($sItemText, $ListView) EndIf Next _GUICtrlListView_EndUpdate($hListView) EndFunc ;==>_UpdateListView Func _WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $I Global $hWndFrom, $iCode, $tNMHDR, $hWndListView, $lParam $hWndListView = $ListView $hWnd1 = $hGUI If Not IsHWnd($ListView) Then $hWndListView = GUICtrlGetHandle($ListView) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $LVN_ITEMACTIVATE Local $nmia = DllStructCreate($tagNMITEMACTIVATE, $lParam) $I = DllStructGetData($nmia, "Index") $SomeVariablex = _GUICtrlListView_GetItemTextArray($ListView) $gMediaObject.URL = $SomeVariablex[2] EndSwitch EndSwitch Return $__LISTVIEWCONSTANT_GUI_RUNDEFMSG EndFunc ;==>_WM_NOTIFY Func _CreateWMPlayer() $Object = ObjCreate("WMPlayer.OCX.7") $Object.URL = "" Return $Object EndFunc ;==>_CreateWMPlayer My real radio file is very big...i can't send you that ...it's "_WM_NOTIFY" func the problem...becouse without that all work good even on large .ini files. Hi and thank's to help Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 27, 2010 Moderators Share Posted December 27, 2010 AuToItItAlIaNlOv3R, As I said before, it all works for me with the small ini file you posted above. If you do not post a larger version which gives the error so that I can test it and reproduce the problem, then I cannot really help further. It is only a text file - what size does it reduce to if you zip it? 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...
AuToItItAlIaNlOv3R Posted December 27, 2010 Author Share Posted December 27, 2010 This is a part of my station.ini...you can donwload it here...with this code try to search for example "asd":expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <GuiListView.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GUIComboBox.au3> #Region //GUI Local $hGUI = GUICreate("Form2", 581, 348, 275, 147) Local $hComboBox = _GUICtrlComboBox_Create($hGUI, "", 152, 8, 185, 25) $Label1 = GUICtrlCreateLabel("Search your preferite radio:", 8, 8, 131, 17) Local $ListView = GUICtrlCreateListView("Name|Streaming|Web Site|Genere", 0, 32, 577, 313) Local $hListView = GUICtrlGetHandle($ListView) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 150) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 150) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 150) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 3, 120) GUISetState(@SW_SHOW) #EndRegion //GUI GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") $gMediaObject = _CreateWMPlayer() Global $AllIniSec = IniReadSectionNames("station.ini") Dim $AllStations[5000][3] $AllStationsCount = 0 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) Local $hWndFrom, $iIDFrom, $iCode, $sText, $iItem $hWndFrom = $ilParam $iIDFrom = BitAND($iwParam, 0xFFFF) $iCode = BitShift($iwParam, 16) Switch $hWndFrom Case $hComboBox Switch $iCode Case $CBN_EDITCHANGE $sText = _GUICtrlComboBox_GetEditText($hComboBox) If $sText <> "" Then _UpdateListView($sText) Else _GUICtrlListView_DeleteAllItems($hListView) EndIf EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>_WM_COMMAND Func _UpdateListView($sText) _GUICtrlListView_BeginUpdate($hListView) _GUICtrlListView_DeleteAllItems($hListView) $AllStationsCount = 0 ; Reset the count each time <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< For $s = 1 To $AllIniSec[0] $var = IniReadSection("station.ini", $AllIniSec[$s]) If @error Then MsgBox(4096, "", "Error occurred, probably no INI file.") Else For $i = 1 To $var[0][0] $AllStations[$AllStationsCount][0] = $AllIniSec[$s] ; Country $AllStations[$AllStationsCount][1] = $var[$i][0] ; Key $AllStations[$AllStationsCount][2] = $var[$i][1] ; Value $AllStationsCount += 1 Next EndIf Next For $x = 0 To $AllStationsCount - 1 If StringInStr($AllStations[$x][1], $sText) Then $aData = StringSplit($AllStations[$x][2], "|") ; Split the value on the delimiter <<<<<<<<<<<<<<<<<<<<< $sItemText = $AllStations[$x][1] For $a = 1 To $aData[0] $sItemText &= "|" & $aData[$a] ; Add the items to the Item text <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Next GUICtrlCreateListViewItem($sItemText, $ListView) EndIf Next _GUICtrlListView_EndUpdate($hListView) EndFunc ;==>_UpdateListView Func _WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $I Global $hWndFrom, $iCode, $tNMHDR, $hWndListView, $lParam $hWndListView = $ListView $hWnd1 = $hGUI If Not IsHWnd($ListView) Then $hWndListView = GUICtrlGetHandle($ListView) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $LVN_ITEMACTIVATE Local $nmia = DllStructCreate($tagNMITEMACTIVATE, $lParam) $I = DllStructGetData($nmia, "Index") $SomeVariablex = _GUICtrlListView_GetItemTextArray($ListView) $gMediaObject.URL = $SomeVariablex[2] EndSwitch EndSwitch Return $__LISTVIEWCONSTANT_GUI_RUNDEFMSG EndFunc ;==>_WM_NOTIFY Func _CreateWMPlayer() $Object = ObjCreate("WMPlayer.OCX.7") $Object.URL = "" Return $Object EndFunc ;==>_CreateWMPlayerHow u can see it give a fake result...try to disable wm_notify function and all work fine...why?...how i can fix that?Thank's Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 27, 2010 Moderators Share Posted December 27, 2010 AuToItItAlIaNlOv3R,Using the code you have just posted and the full downloaded ini file I am afraid that I cannot reproduce your problem. I get just the 5 valid entries you highlighted in the ListView when I search for "asd" - whether the _WM_NOTIFY handler is enabled or disabled.As I said earlier, I do not see anything in the code which would cause the search function to return invalid files - your problem must lie elsewhere. 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...
AuToItItAlIaNlOv3R Posted December 27, 2010 Author Share Posted December 27, 2010 (edited) It's a mistake...what os you use?...i'm uploading a demostration video EDIT:You can donwload the file video hereAny suggestion?...why do that only on my pc? O.O...it's the same code with the same file ini! Help Thank's Edited December 27, 2010 by AuToItItAlIaNlOv3R Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 27, 2010 Moderators Share Posted December 27, 2010 AuToItItAlIaNlOv3R,It's a mistakeNo, it is what happens when I run the code. There is no need for a video, I believe you when you say you get an error - but you also have to believe me when I say I do not. I am running Vista HP SP2 - but I do not think that it is the OS that is causing the problem. Perhaps someone else can try the code and see if they can reproduce your problem. 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...
AuToItItAlIaNlOv3R Posted December 27, 2010 Author Share Posted December 27, 2010 There are anyway to do enable the play of streaming of radio with double mouse click on listview element?...without using wm_notify?... this function is the problem, without it work well ...any suggestion?... P.S. see the video...it's very funny...real mistake now Thank's Link to comment Share on other sites More sharing options...
guinness Posted December 27, 2010 Share Posted December 27, 2010 Windows 7 x64 and I get the same result as in the picture, but when I comment out GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") (Line 27) it works as expected. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
AuToItItAlIaNlOv3R Posted December 27, 2010 Author Share Posted December 27, 2010 Windows 7 x64 and I get the same result as in the picture, but when I comment out GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") (Line 27) it works as expected.Thank's for your tests...i don't know why the program do that...and it's incredible how the Melba23's pc run it well (I believe you, don't worry )...any person with Windows Vista can test it?...Any possible soluction?, I want to solve this mystery x)Hi and thank's autoit community! Link to comment Share on other sites More sharing options...
guinness Posted December 27, 2010 Share Posted December 27, 2010 I have had a look and can't see any reason why it would be doing this. I even resorted to this...Func _WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) ; Blank EndFunc ;==>_WM_NOTIFYand for some reason it still creates the problem. But the INI File is huge , don't forget that with IniReadSectionNames() - Only the first 32767 chars are taken in account in an section due to Win9x compatibility. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
JohnOne Posted December 27, 2010 Share Posted December 27, 2010 Win 7 32 get the same fault here. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 28, 2010 Moderators Share Posted December 28, 2010 Deathbringer, Melba23 [...] seems to never be able to reproduce anyone's errorsRather uncalled for in my opinion. Particularly as I have reproduced the error and can offer a couple of solutions. AuToItItAlIaNlOv3R, Firstly, an explanation of why the error was occurring. I could reproduce it by entering the "asd" characters into the combo faster than the ListView was updating - if I waited until the update was complete before entering the next character the list appeared as it should. When the characters were entered very quickly, the WM_COMMAND handler was firing the update function again before the previous update was complete and this led to the false finds as the updates competed in filling the ListView. This is one reason why I try never to run longish functions within message handlers. Quite why the WM_NOTIFY seemed to interfere I have no idea. Now, how to fix it? Possibility 1: (My preferred solution) Use a flag within the WM_COMMAND handler and action the update within the main loop like this: expandcollapse popupGlobal $fComboChange = False ; Declare the flag <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch If $fComboChange Then ; If the flag is set, run the update <<<<<<<<<<<<<<<<<<<<<<<<<< $fComboChange = False ; Reset the flag so we can detect the next change <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $sText = _GUICtrlComboBox_GetEditText($hComboBox) If $sText <> "" Then _UpdateListView($sText) Else _GUICtrlListView_DeleteAllItems($hListView) EndIf EndIf WEnd Func _WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) Local $hWndFrom, $iIDFrom, $iCode, $sText, $iItem $hWndFrom = $ilParam $iIDFrom = BitAND($iwParam, 0xFFFF) $iCode = BitShift($iwParam, 16) Switch $hWndFrom Case $hComboBox Switch $iCode Case $CBN_EDITCHANGE $fComboChange = True ; Set the flag here <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>_WM_COMMAND This way the update function will end before any subsequent setting of the flag and so there will not be competing updates. In fact if you do enter the characters fast, you often skip an update as you only search for the most recent combination and so skip any intermediate steps - try adding a ConsoleWrite($sText & @CRLF) after reading the combo edit text to see what I mean. Possibility 2: Just read the combo directly and do not use a WM_COMMAND handler at all: $sCurrCombo = "" ; Initial combo state <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch If _GUICtrlComboBox_GetEditText($hComboBox) <> $sCurrCombo Then ; Has combo state changed <<<<<<<<<<<<<<<<<<<<<<<<< $sText = _GUICtrlComboBox_GetEditText($hComboBox) If $sText <> "" Then _UpdateListView($sText) Else _GUICtrlListView_DeleteAllItems($hListView) EndIf $sCurrCombo = $sText ; Set new combo state <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< EndIf WEnd Both of those work for me without problem regardless of the speed with which I enter the characters into the combo. Moral of the story: Do NOT use longish functions within message handlers. The help file says "the return to the system should be as fast as possible !!!" for a good reason. 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...
JohnOne Posted December 28, 2010 Share Posted December 28, 2010 M23 to the rescue again. Just to confirm that both of your methods work fine here, as did not entering the keys quickly. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. 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