Jump to content

Simple Search question


Recommended Posts

Sorry again. Tought my question is similar enough not to open anther topic and thanks alot. Works like a charm. I looked through sqlite documentation and LIKE statement was nowhere to be found.

Link to comment
Share on other sites

It's listed under "expression". Scroll down to: The LIKE and GLOB operators

I'll grant you there are not many helpful examples on that site, but it works like just about any other SQL LIKE expression.

:blink:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

  • 3 months later...

Now i've write this script, finally work done, but now i dont now how to grab link of selected radio station.

Posted Image

I would like to reproduce selected radio, this is my code:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Form1", 484, 303, 192, 124)
$Lista = GUICtrlCreateListView("Titolo|Link|Sito Web|Genere", 0, 0, 482, 246)
$Button1 = GUICtrlCreateButton("Button1", 208, 264, 75, 25, $WS_GROUP)
$Risultato = IniReadSection (@DesktopDir & "\station.ini","Albania")
$Button1 = GUICtrlCreateButton("Exit", 408, 256, 75, 25, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Play!", 8, 256, 75, 25, $WS_GROUP)
For $i=1 To $Risultato[0][0]
    GUICtrlCreateListViewItem($Risultato[$i][0] & "|" & $Risultato[$i][1] & "|" & $Risultato[$i][1],$Lista)
Next
    GUISetState(@SW_SHOW)
    $gMediaObject = _CreateWMPlayer()
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button2
            ;Now i would like to reproduce selected radio station
            $gMediaObject.URL = ;Link of selected radio station

    EndSwitch
WEnd


Func _CreateWMPlayer()
    $Object = ObjCreate("WMPlayer.OCX.7")
    $Object.URL = ""
    Return $Object
EndFunc   ;==>_CreateWMPlayer

This is my file station.ini:

[Albania]
Radio Tirana 1=http://radiotirana.fly-dns.com/listen.pls|http://www.rtsh.al/|News/Talk/Features
Radio Tirana 3=http://radiotirana.funkhaus.info:8000/listen.pls|http://www.rtsh.al/|Foreign service

How i can grab selected radio station? Thanks!

Link to comment
Share on other sites

To read the selected item in a listview use this command $ReadItem = GUICtrlRead(GUICtrlRead($Lista)) for your listview item. This will read in the whole line that is selected. You would then need to use $SomeVariable = StringSplit($ReadItem, "|") which will create an array from your selected item with each column in the array, starting from $SomeVariable[1] for column 0, up to $SomeVariable[4] for the last column.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

To read the selected item in a listview use this command $ReadItem = GUICtrlRead(GUICtrlRead($Lista)) for your listview item. This will read in the whole line that is selected. You would then need to use $SomeVariable = StringSplit($ReadItem, "|") which will create an array from your selected item with each column in the array, starting from $SomeVariable[1] for column 0, up to $SomeVariable[4] for the last column.

Or use _GUICtrlListView_GetItemText or _GUICtrlListView_GetItemTextArray...
Link to comment
Share on other sites

Or use _GUICtrlListView_GetItemText or _GUICtrlListView_GetItemTextArray...

It looks like someone already coded that into the GuiListview.au3 include, oh well, same thing as I did just uses one line instead of my 2. ;)

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Dont work for me:

I've this code:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
Global $lv
$Form1 = GUICreate("Form1", 484, 303, 192, 124)
$lv = GUICtrlCreateListView("Titolo|Link|Sito Web|Genere", 0, 0, 482, 246)
$Button1 = GUICtrlCreateButton("Button1", 208, 264, 75, 25, $WS_GROUP)
$Risultato = IniReadSection (@DesktopDir & "\station.ini","Albania")
$Button1 = GUICtrlCreateButton("Exit", 408, 256, 75, 25, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Play!", 8, 256, 75, 25, $WS_GROUP)

For $i=1 To $Risultato[0][0]
    GUICtrlCreateListViewItem($Risultato[$i][0] & "|" & $Risultato[$i][1] & "|" & $Risultato[$i][1],$lv)
Next
GUISetState(@SW_SHOW)
    $gMediaObject = _CreateWMPlayer()
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button2
            $ReadItem = GUICtrlRead(GUICtrlRead($lv))
            $SomeVariable = StringSplit($ReadItem, "|")
            MsgBox (0,"",_ArrayToString($SomeVariable[1]))

    EndSwitch
WEnd


Func _CreateWMPlayer()
    $Object = ObjCreate("WMPlayer.OCX.7")
    $Object.URL = ""
    Return $Object
EndFunc   ;==>_CreateWMPlayer

But he dont gibe nothing, msgbox is empty ;)

hi!

Link to comment
Share on other sites

Dont work for me:

I've this code:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
Global $lv
$Form1 = GUICreate("Form1", 484, 303, 192, 124)
$lv = GUICtrlCreateListView("Titolo|Link|Sito Web|Genere", 0, 0, 482, 246)
$Button1 = GUICtrlCreateButton("Button1", 208, 264, 75, 25, $WS_GROUP)
$Risultato = IniReadSection (@DesktopDir & "\station.ini","Albania")
$Button1 = GUICtrlCreateButton("Exit", 408, 256, 75, 25, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Play!", 8, 256, 75, 25, $WS_GROUP)

For $i=1 To $Risultato[0][0]
    GUICtrlCreateListViewItem($Risultato[$i][0] & "|" & $Risultato[$i][1] & "|" & $Risultato[$i][1],$lv)
Next
GUISetState(@SW_SHOW)
    $gMediaObject = _CreateWMPlayer()
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button2
            $ReadItem = GUICtrlRead(GUICtrlRead($lv))
            $SomeVariable = StringSplit($ReadItem, "|")
;~          MsgBox (0,"",_ArrayToString($SomeVariable[1])) <<<<<<<< Change this line 
            MsgBox (0,"",$SomeVariable[1]) ;<<<<<<<<<<<<<<<<<<< To this
    EndSwitch
WEnd


Func _CreateWMPlayer()
    $Object = ObjCreate("WMPlayer.OCX.7")
    $Object.URL = ""
    Return $Object
EndFunc   ;==>_CreateWMPlayer

See the changes to the MsgBox line above, and see if you get the result you're looking for.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Try this instead, it works for me.

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <GuiListView.au3> ;~       Add this line
Global $lv
$Form1 = GUICreate("Form1", 484, 303, 192, 124)
$lv = GUICtrlCreateListView("Titolo|Link|Sito Web|Genere", 0, 0, 482, 246, Default, $LVS_EX_FULLROWSELECT)
$Button1 = GUICtrlCreateButton("Button1", 208, 264, 75, 25, $WS_GROUP)
$Risultato = IniReadSection(@DesktopDir & "\station.ini", "Albania")
$Button1 = GUICtrlCreateButton("Exit", 408, 256, 75, 25, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Play!", 8, 256, 75, 25, $WS_GROUP)
For $i = 1 To $Risultato[0][0]
    GUICtrlCreateListViewItem($Risultato[$i][0] & "|" & $Risultato[$i][1] & "|" & $Risultato[$i][1], $lv)
Next
GUISetState(@SW_SHOW)
$gMediaObject = _CreateWMPlayer()
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button2
            $SomeVariable = _GUICtrlListView_GetItemTextArray($LV) ;~ <<<<<<<<<< use this command
            MsgBox(0, "", $SomeVariable[1]) ;<<<<<<<<<<<<<<<<<<< Keep this line as it is
    EndSwitch
WEnd

Func _CreateWMPlayer()
    $Object = ObjCreate("WMPlayer.OCX.7")
    $Object.URL = ""
    Return $Object
EndFunc   ;==>_CreateWMPlayer

I'm not sure why it didn't work the way I had it before, but the UDF command works fine, so use that instead.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

  • 2 weeks later...

Thanks a lot, now work done ;). I have only two question :)...I would like to read selected item, without click button "Play"...but i would like to read it when user do two right click of mouse on it. Sorry for my english ;)...and for last...how i can entroduce a radio search?

Use this code so that you can double click (primary button, not right click) on a listview line and have it run your play function

GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") ;~ <<<<< Add this line to your script near the top of it.

Func _WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg, $iwParam
    Local $I
    Global $hWndFrom, $iCode, $tNMHDR, $hWndListView, $lParam
    $hWndListView = $ListView   ;~ <<<<< Change $Listview to the name for your listview here and in lines below
    $hWnd1 = $Form1
    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")
                    Play() ;~ <<<<<<<<<<<<<<< insert your play function here 
            EndSwitch
    EndSwitch
    Return $__LISTVIEWCONSTANT_GUI_RUNDEFMSG
EndFunc

Unfortunately I don't know how to include the radio search.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...