Sign in to follow this  
Followers 0
AuToItItAlIaNlOv3R

Search on .ini file

46 posts in this topic

Hi i've an ini file like this :

[Europe]

[England]
Radioname=streaming link|web site address

[Germany]
Radioname=streaming link|web site address

[/Europe]

[America]

[California]
Radioname=streaming link|web site address

[Florida]
Radioname=streaming link|web site address

[/America]

My ini file is divided like that

[Continent]
[State]
Information about radio
[/Continent]

How i can search my radio station on all states of all continent?...now i can search only a states of only a continent...but i would like to seach about all states and all continent that i have in my "database". This is my code, that find only state in only a continent:

#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>
Local Const $aData = _Stations()
Local $hGUI = GUICreate("Form1", 512, 340, 302, 150)
Local $ListView = GUICtrlCreateListView("Title|Link|Website|Genere", 0, 56, 506, 246, -1, BitOR($WS_EX_CLIENTEDGE, $LVS_EX_FULLROWSELECT))
Local $hListView = GUICtrlGetHandle($ListView)
Local $Combo1 = GUICtrlCreateCombo("America", 64, 8, 145, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL, $WS_HSCROLL, $WS_VSCROLL))
Local $hComboBox = _GUICtrlComboBox_Create($hGUI, "", 272, 8, 121)
GUISetState()

GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND")

Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

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

                Case $CBN_SELCHANGE
                    $iItem = _GUICtrlComboBox_GetCurSel($hComboBox)
                    If $iItem >= 0 Then
                        $I = $iItem + 1
                        _GUICtrlListView_DeleteAllItems($hListView)
                        GUICtrlCreateListViewItem($aData[$I][0] & "|" & $aData[$I][1] & "|" & $aData[$I][1], $ListView)
                    EndIf
            EndSwitch
    EndSwitch

    Return $GUI_RUNDEFMSG
EndFunc   ;==>_WM_COMMAND

Func _UpdateListView($sText)
    Local $sPattern = ""

    _GUICtrlListView_BeginUpdate($hListView)
    _GUICtrlListView_DeleteAllItems($hListView)

    If GUICtrlRead($hComboBox) <> '' Then
        $sPattern &= "(?i)"
    Else
        $sPattern &= "(?i)" & $sText & "(?i)"
    EndIf
    For $I = 1 To $aData[0][0]

        If StringRegExp($aData[$I][0], $sPattern) Then _
                GUICtrlCreateListViewItem($aData[$I][0] & "|" & $aData[$I][1] & "|" & $aData[$I][1], $ListView)
    Next
    _GUICtrlListView_EndUpdate($hListView)
EndFunc   ;==>_UpdateListView

Func _Stations() ; Now i can search only on a states...but if i would like to search in all states of all continent? How i can do that?
    Local $aReturn = IniReadSection(@DesktopDir & "\station.ini", "England")
    Return $aReturn
EndFunc   ;==>_Stations

How i can fix that?...i hope that you are understand me and can help me :x

Sorry for my english :P

Share this post


Link to post
Share on other sites



You won't be able to do that

You can do something like

[Continents]
Europe=England|Germany
America=NewYork|California
Australia=Melbourne|Sydney

[England]
Radioname=streaming link|web site address

[Germany]
Radioname=streaming link|web site address

[Melbourne]
Radioname=streaming link|web site address

Then you can just get all the other listings from the first section.

Share this post


Link to post
Share on other sites

i can't create a sub-section in a ini file? No way to do that with .ini? :x

Hi thank's for help

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

You can just write your own INIReadSection function. You have a custom INI file so you'll probably need to use a custom function to read it :x

Edit to include example with comments:

Here's an incredibly inefficient way to do it, but works.

You'll need #include <File.au3> and #include <String.au3>

Change your _Stations() function to read from "Europe" instead of "England" then changed the function name to _INIReadSection()

Func _Stations() ; Now i can search only on a states...but if i would like to search in all states of all continent? How i can do that?
    Local $aReturn = _IniReadSection("H:\temp\station.ini", "Europe")
    Return $aReturn
EndFunc   ;==>_Stations

Then a new _INIReadSection function:

Func _IniReadSection($sFileName, $sSectionName)
    Local $sTempFile = _TempFile(Default, Default, "ini")   ;Create a temporary INI file
    Local $aTempText[1], $sTempText, $aReturn
    $sTempText = FileRead($sFileName)   ;Read original INI file into temp text string
    $aTempText = _StringBetween($sTempText, "[" & $sSectionName & "]", "[/" & $sSectionName & "]")  ;Get everything between $sSectionName and /$sSectionName
    $sTempText = $aTempText[0]  ;Replace contents of temp text string with result of above
    $sTempText = StringRegExpReplace($sTempText, "\[.*\]", "")  ;Replace all the section names [blahblabh] with nothing in same temp text string
    $sTempText = "[" & $sSectionName & "]" & @CRLF & $sTempText ;Add a section name at the top: [$sSectionName] of the temp text string
    FileWrite($sTempFile, $sTempText)   ;Write contents of temp text string to temporary INI file
    $aReturn = IniReadSection($sTempFile, $sSectionName)    ;Use built-in INIReadSection() function to read the new file so the rest of your script works
    FileDelete($sTempFile)  ;Delete temporary INI file that was created
    Return $aReturn
EndFunc
Edited by MrMitchell

Share this post


Link to post
Share on other sites

Thank's for help, but i don't want that :x...my question is too much simple :P...i would like to search a radio station in allcontinent...for example...if i would seach "BBC Radio" now i can search it only in "england" becouse i can search only one state...i would like to entroduce a search in all statates of all continent :shifty:...Have u understand me? :nuke:

Thank's for your help...and merry christmas to you and your family :lol:

Share this post


Link to post
Share on other sites

Thank's for help, but i don't want that :x...my question is too much simple :P...i would like to search a radio station in allcontinent...for example...if i would seach "BBC Radio" now i can search it only in "england" becouse i can search only one state...i would like to entroduce a search in all statates of all continent :shifty:...Have u understand me? :nuke:

Thank's for your help...and merry christmas to you and your family :lol:

You could load all the ini entries into an array, and search through that.

But a better way might be to change the approach and store your data in an SQLite file, which will give you much more flexible search functionality.

Look at the SQLite management section in the help files [under UDFs].

William

Share this post


Link to post
Share on other sites

AuToItItAlIaNlOv3R,

ZacUSNYR has already given you a good solution which uses the normal AutoIt Ini* functions.

If you were to construct your ini file as he suggested above, you would start by reading the value of the selected continent with IniRead - in his example reading "Europe" would get you "England|Germany". Use StringSplit to break that into the separate avlaues and then loop through those values to read the contents of each section with IniReadSection. You woudl end up with the contents of all the countries in each continent. :x

Give it a go yourself - you know where we are if you run into difficulties. :P

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

mmm...i don't want read only a continent...i would have a search in all my radio station that i have...a search for radio in all continent...for example i would find "Example Radio" in all my radio station that i have in my file.ini...how i can do that with IniReadSection function...if that function accept only a section?...

Thank's :x

Share this post


Link to post
Share on other sites

AuToItItAlIaNlOv3R,

If you want to search the whole file for a particular station, then read it into an array with _FileReadToArray and use _ArraySearch to find it within that array. :x

M23

P.S. Do not forget to set the $iPartial parameter when you search the array. :P


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Omg, now i was very confusing...can you explian me how to apply this change?... My code now is that :

#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>
Local Const $aData = _Stations()
Local $hGUI = GUICreate("Form1", 512, 340, 302, 150)
Local $ListView = GUICtrlCreateListView("Title|Link|Website|Genere", 0, 56, 506, 246, -1, BitOR($WS_EX_CLIENTEDGE, $LVS_EX_FULLROWSELECT))
Local $hListView = GUICtrlGetHandle($ListView)
Local $Combo1 = GUICtrlCreateCombo("America", 64, 8, 145, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL, $WS_HSCROLL, $WS_VSCROLL))
Local $hComboBox = _GUICtrlComboBox_Create($hGUI, "", 272, 8, 121)
GUISetState()

GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND")

Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

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

                Case $CBN_SELCHANGE
                    $iItem = _GUICtrlComboBox_GetCurSel($hComboBox)
                    If $iItem >= 0 Then
                        $I = $iItem + 1
                        _GUICtrlListView_DeleteAllItems($hListView)
                        GUICtrlCreateListViewItem($aData[$I][0] & "|" & $aData[$I][1] & "|" & $aData[$I][1], $ListView)
                    EndIf
            EndSwitch
    EndSwitch

    Return $GUI_RUNDEFMSG
EndFunc   ;==>_WM_COMMAND

Func _UpdateListView($sText)
    Local $sPattern = ""

    _GUICtrlListView_BeginUpdate($hListView)
    _GUICtrlListView_DeleteAllItems($hListView)

    If GUICtrlRead($hComboBox) <> '' Then
        $sPattern &= "(?i)"
    Else
        $sPattern &= "(?i)" & $sText & "(?i)"
    EndIf
    For $I = 1 To $aData[0][0]

        If StringRegExp($aData[$I][0], $sPattern) Then _
                GUICtrlCreateListViewItem($aData[$I][0] & "|" & $aData[$I][1] & "|" & $aData[$I][1], $ListView)
    Next
    _GUICtrlListView_EndUpdate($hListView)
EndFunc   ;==>_UpdateListView

Func _Stations() ; Now i can search only on a states...but if i would like to search in all states of all continent? How i can do that?
    Local $aReturn = IniReadSection(@DesktopDir & "\station.ini", "England") <---How i can add all states?
    Return $aReturn
EndFunc   ;==>_Stations

I only would search a name of radio, in all states that i have...a general search :x...can u explain me where i have to add this code...and what i have to do?...i'm so sorry but i dont have understand what you want do :shifty:

Thank's for your help, and sorry...

hi :P

Share this post


Link to post
Share on other sites

AuToItItAlIaNlOv3R,

Not a lot of code for me to work on there - I think you need to do a lot more coding yourself first or I will end up doing the whole thing. :P

But to show you what I meant - make an ini file like this and save it as "radios.ini" in the same folder as your script:

[Continents]
Europe=England|Germany
America=NewYork|California
Australia=Melbourne|Sydney

[England]
Radioname_1=Streaming link_1|web site address_1

[Germany]
Radioname_2=Streaming link_3|web site address_2

[Melbourne]
Radioname_3=streaming link_3|web site address_3

Then run this code in SciTE - just put in the name of the radio station you want to find and you will get the streaming and web site data returned:

#include <GUIConstantsEx.au3>
#include <Array.au3>
#include <File.au3>

; Read the file into an array
Global $aArray
_FileReadToArray(@ScriptDir & "\radios .ini", $aArray)

; This is just so you can see it
_ArrayDisplay($aArray)

$hGUI = GUICreate("Test", 500, 500)

$hInput = GUICtrlCreateInput("", 10, 10, 200, 20)

$hButton = GUICtrlCreateButton("Search", 10, 50, 80, 30)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hButton
            ; Read the input
            $sRadio = GUICtrlRead($hInput)
            ; Search the array
            $iIndex = _ArraySearch($aArray, $sRadio, 0, 0, 0, 1) ; Note the $iPartial parameter set
            If $iIndex = -1 Then
                ; Nothing found
                MsgBox(0, "Error", "Station not found")
            Else
                ; Found it so split on the "=" sign
                $aFound = StringSplit($aArray[$iIndex], "=")
                ; And again on the "|"
                $aFound = StringSplit($aFound[2], "|")
                ; And display the results
                MsgBox(0, "Found", $sRadio & @CRLF & @CRLF & "Streaming: " & $aFound[1] & @CRLF & "web site: " &  $aFound[1])
            EndIf
    EndSwitch

WEnd

I hope that helps. :x

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Thank's for help...but i think that it dont work well...for example i've a lot of "BBC" radio in my ini. But he found only 1 radio and it dont contain the string bbc :shifty: Fix?...randomly it give me the name of nation instead of website address and streaming link :P

Hi and thank's a lot

P.S. my file .ini is right...not error of ini structure :x

Edited by AuToItItAlIaNlOv3R

Share this post


Link to post
Share on other sites

What about providing some more exact information like posting the example BBC INI file you tested with and giving problems?

Your whole problem definition has been pretty vague till now which makes this thread go the direction it has been going in.


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

This is a part of my file ini :

Europe=England|Spain
America=Texas|California

[England]
BBC Radio 1=http://bbc.co.uk/radio/listen/live/r1.ram|http://www.bbc.co.uk/radio1/|Top 40/Dance
BBC Radio 2=http://bbc.co.uk/radio/listen/live/r2.ram|http://www.bbc.co.uk/radio2/|Adult Contemporary
BBC Radio 3=http://bbc.co.uk/radio/listen/live/r3.ram|http://www.bbc.co.uk/radio3/|Classical
BBC Radio 4=http://bbc.co.uk/radio/listen/live/r4.ram|http://www.bbc.co.uk/radio4/|News/Feature programming
Example1=Example1.m3u|Example1.com|Example
[Spain]
Cadena Elite Casas de Benitez=http://www.cadenaelite.com/music/elitebenitez.m3u|http://www.cadenaelite.com/|Pop
Cadena Elite Granada=http://94.23.82.247:8000/listen.pls|http://www.cadenaelite.com/|Pop
Cadena Elite Malaga=http://www.cadenaelite.com/music/Elite%20Malaga.m3u|http://www.cadenaelite.com/|Pop
Cadena Elite Manresa=http://www.cadenaelite.com/music/manresa.m3u|http://www.cadenaelite.com/|Pop
Cadena Elite Marina Alta=http://www.cadenaelite.com/music/elitealicante.m3u|http://www.cadenaelite.com/|Pop
Exampl21=Example2.m3u|Example2.com|Example
[Texas]
KAAM=http://wmc1.den.liquidcompass.net/KAAMAM|http://www.kaamradio.com/|Adult Standards
KCDD - Power 103=http://live.cumulusstreaming.com/kcdd-fm|http://www.power103.com/|Top 40
Example3=Example3.m3u|Example3.com|Example
[California]
KDFC=http://provisioning.streamtheworld.com/pls/KDFCFM.pls|http://www.kdfc.com/|Classical
KDIA=http://stream2.nwrnetwork.com/KDIA|http://www.kdia.com/|Christian Talk
Example4=Example4.m3u|Example4.com|Example

Now i've this code force search radio, but i can search radio name only in one nation (for example i can search the radio name only in England):

#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>
Local Const $aData = _Stations()
Local $hGUI = GUICreate("Form1", 512, 340, 302, 150)
Local $ListView = GUICtrlCreateListView("Title|Link|Website|Genere", 0, 56, 506, 246, -1, BitOR($WS_EX_CLIENTEDGE, $LVS_EX_FULLROWSELECT))
Local $hListView = GUICtrlGetHandle($ListView)
Local $Combo1 = GUICtrlCreateCombo("America", 64, 8, 145, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL, $WS_HSCROLL, $WS_VSCROLL))
Local $hComboBox = _GUICtrlComboBox_Create($hGUI, "", 272, 8, 121)
GUISetState()

GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND")

Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

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

                Case $CBN_SELCHANGE
                    $iItem = _GUICtrlComboBox_GetCurSel($hComboBox)
                    If $iItem >= 0 Then
                        $I = $iItem + 1
                        _GUICtrlListView_DeleteAllItems($hListView)
                        GUICtrlCreateListViewItem($aData[$I][0] & "|" & $aData[$I][1] & "|" & $aData[$I][1], $ListView)
                    EndIf
            EndSwitch
    EndSwitch

    Return $GUI_RUNDEFMSG
EndFunc   ;==>_WM_COMMAND

Func _UpdateListView($sText)
    Local $sPattern = ""

    _GUICtrlListView_BeginUpdate($hListView)
    _GUICtrlListView_DeleteAllItems($hListView)

    If GUICtrlRead($hComboBox) <> '' Then
        $sPattern &= "(?i)"
    Else
        $sPattern &= "(?i)" & $sText & "(?i)"
    EndIf
    For $I = 1 To $aData[0][0]

        If StringRegExp($aData[$I][0], $sPattern) Then _
                GUICtrlCreateListViewItem($aData[$I][0] & "|" & $aData[$I][1] & "|" & $aData[$I][1], $ListView)
    Next
    _GUICtrlListView_EndUpdate($hListView)
EndFunc   ;==>_UpdateListView

Func _Stations() ; Now i can search only on a states...but if i would like to search in all states of all continent? How i can do that?
    Local $aReturn = IniReadSection(@DesktopDir & "\station.ini", "England") <---Only England
    Return $aReturn
EndFunc   ;==>_Stations

How u can see,i can now only search radio only in one nation, in that casa England...but if i want do a global search in all nation? How i can do that?...I would like that it display me in listview the result of global search and not with a single nation search. I hope that you understand me now. Another example for you...

I want search if in my database there are a radio named "example"...in that case it give me only Example 1 radio, how u can see in .ini section England. But i would like that disply me all Example radio that i have in my "database" like as: example 2, example 3...

Thank's :x

Edited by AuToItItAlIaNlOv3R

Share this post


Link to post
Share on other sites

AuToItItAlIaNlOv3R,

The script I posted above has a small typo - there is a space in the ini filename. Sorry about that - just change this line:

_FileReadToArray(@ScriptDir & "\radios.ini", $aArray) ; use this line instead

When that change is made and I save your ini file as "radios.ini" the search works perfectly. I hope it does for you too - then you can integrate it into your script. :x

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

I've already look time ago the "space"...but it don't work for me... He give a fake result :x Like that :

Posted Image

And if i search example, it give me only 1 radio name, but file contain 4 example radio :P

Hi Thank's

Edited by AuToItItAlIaNlOv3R

Share this post


Link to post
Share on other sites

What about you read the ini into an Array which would allow you to easily search any of the 3 keys... just some proof of concept:

; Read INI into a single array
Global $AllIniSec = IniReadSectionNames("radio.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("radio.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
For $x = 0 To $AllStationsCount - 1
    ConsoleWrite("Country=")
    ConsoleWrite($AllStations[$x][0])
    ConsoleWrite("   Radioname=")
    ConsoleWrite($AllStations[$x][1])
    ConsoleWrite("   Link info=")
    ConsoleWrite($AllStations[$x][2])
    ConsoleWrite(@CRLF)
Next

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

@Jos

Your script give me all radio station, but i would like to display only found station, example i search "bbc" and it give me all radio station that have named "bbc" :P

Thank's :x

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

@Jos

Your script give me all radio station, but i would like to display only found station, example i search "bbc" and it give me all radio station that have named "bbc" :P

Thank's :x

I understand and the idea is that you also understand the code written.

I gave you an option of reading the total ini file into a ARRAY and to list the total array.

This should make it pretty easy for you to use this code and change it such that the print loop is used to test one of the 3 values in the array with a StringInstr() functions and add the correct items to your list.

So to give a litle push in the right direction:

; 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

Now its your turn...

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Thank's Jos...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?...

Thank's a lot Jos :x...happy christmas for you and your family :P

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0