Jump to content

Multiple equal sign in INI file


Recommended Posts

Wouldn't

link_value = https://www.google.ro/#safe=active&q=test

be more sensible?

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • Moderators

stefionesco,

When I test I get:

Row |Col 0                           |Col 1
[1] |https://www.google.ro/#safe     active&q=test = link_value

which is what I would expect.

If you create the ini files as part of your script, why not reverse the key/value pairs so as to avoid the problem?

M23

Edit: Hi water - great minds, eh?

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 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

 

Link to comment
Share on other sites

Hi Melba,

I do my very best to - sometimes - be one step ahead of you ;)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Hi, there

I'm trying to make an application that search for subtitle for some movies, on Romanian subtitle site.
It seems to be an error in my script but I can't figure where. I think it's something about the fact that the value in every section contains equal sign.
I put in every section of INI file a link with both, English and Romanian subtitle, and a link that doesn't have none of them. Every search I made result positive with both subtitles in both links.
Where is the error?

Here is the script and the data.ini file.

 

#include <GuiConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiConstants.au3>
#include <WindowsConstants.au3>
#include <AutoItConstants.au3>
#include <file.au3>
#include <FileConstants.au3>
#include <IE.au3>
#include <MsgBoxConstants.au3>

Local $oIE
Local $sSection1;Audrey Hepburn
Local $sSection2;Sean Connery
Local $sSection3;Rita Hayworth
Local $sLanguage
Local $sResult = ("Result.ini")
Local $aSection1 = IniReadSection('data.ini', 'Section1')
Local $aSection2 = IniReadSection('data.ini', 'Section2')
Local $aSection3 = IniReadSection('data.ini', 'Section3')
Local $aLanguage = IniReadSection('data.ini', 'Language')


Opt("GUIOnEventMode", 1)

Global $mainwindow = GuiCreate("SUB Tracker", 220, 180, 100, 100)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Terminate")

Local $idRadio1 = GUICtrlCreateRadio("Audrey Hepburn", 10, 10, 200, 20)
Local $idRadio2 = GUICtrlCreateRadio("Sean Connery", 10, 40, 200, 20)
Local $idRadio3 = GUICtrlCreateRadio("Rita Hayworth", 10, 70, 200, 20)

Local $searchbutton = GUICtrlCreateButton("SEARCH", 60, 100, 100, 25)
Local $resultbutton = GUICtrlCreateButton("SHOW RESULT", 50, 140, 120, 25)

GUICtrlSetOnEvent($resultbutton, "_Result")
GUICtrlSetOnEvent($searchbutton, "_Search")

GUISetState(@SW_SHOW)

While 1
    Sleep(100)
WEnd

Func _Result()
        ShellExecute ("Result.ini")
EndFunc

Func _Search()
            If GUICtrlRead($idRadio1) = $GUI_CHECKED Then
                SplashTextOn("Searching", "Search...", 600, 50)
                    For $i = 1 To $aSection1[0][0]
                        ControlSetText("Searching", "", "Static1", "Searching the SUB for " & $aSection1[$i][0])
                        $oIE = _IECreate($aSection1[$i][1], 1)
                        _IELoadWait($oIE)
                        $sSection1 = _IEBodyReadText($oIE)
                    For $j = 1 To $aLanguage[0][0]
                        If StringInStr($sSection1, $aLanguage[$j][0]) Then
                            IniWrite($sResult, $aSection1[$i][0], $aLanguage[$j][0], $aLanguage[$j][1])
                        EndIf
                    Next
                        _IEQuit($oIE)
                    Next
                        SplashOff()
                    MsgBox($MB_ICONINFORMATION, "SUB Tracker", "Done", 0)
            EndIf

            If GUICtrlRead($idRadio2) = $GUI_CHECKED Then
                SplashTextOn("Searching", "Search...", 600, 50)
                    For $i = 1 To $aSection2[0][0]
                        ControlSetText("Searching", "", "Static1", "Searching the SUB for " & $aSection2[$i][0])
                        $oIE = _IECreate($aSection2[$i][1], 1)
                        _IELoadWait($oIE)
                        $sSection2 = _IEBodyReadText($oIE)
                    For $j = 1 To $aLanguage[0][0]
                        If StringInStr($sSection2, $aLanguage[$j][0]) Then
                            IniWrite($sResult, $aSection2[$i][0], $aLanguage[$j][0], $aLanguage[$j][1])
                        EndIf
                    Next
                        _IEQuit($oIE)
                    Next
                        SplashOff()
                    MsgBox($MB_ICONINFORMATION, "SUB Tracker", "Done", 0)
            EndIf

            If GUICtrlRead($idRadio3) = $GUI_CHECKED Then
                SplashTextOn("Searching", "Search...", 600, 50)
                    For $i = 1 To $aSection3[0][0]
                        ControlSetText("Searching", "", "Static1", "Searching the SUB for " & $aSection3[$i][0])
                        $oIE = _IECreate($aSection3[$i][1], 1)
                        _IELoadWait($oIE)
                        $sSection3 = _IEBodyReadText($oIE)
                    For $j = 1 To $aLanguage[0][0]
                        If StringInStr($sSection3, $aLanguage[$j][0]) Then
                            IniWrite($sResult, $aSection3[$i][0], $aLanguage[$j][0], $aLanguage[$j][1])
                        EndIf
                    Next
                        _IEQuit($oIE)
                    Next
                        SplashOff()
                    MsgBox($MB_ICONINFORMATION, "SUB Tracker", "Done", 0)
            EndIf

EndFunc

Func _Terminate()
    Exit
EndFunc

Respect

Stef Ionesco

data.ini

Link to comment
Share on other sites

There is absolutely no error checking in your script. Example: When data.ini is not available your script crashes.
Add error checking after each function call and your script will show where you hit an error.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

But data.ini is always available. 

Only the results is:

Quote

[My Fair Lady (1964)]
Romana=Romanian
Engleza=English
[Sauce Tartare (1949)]
Romana=Romanian
Engleza=English


and should be only this:

Quote

[My Fair Lady (1964)]
Romana=Romanian
Engleza=English

 

 

Link to comment
Share on other sites

That was just an example. I wanted to tell you that if an error occurs it goes unnoticed.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

You mean this:

#include <GuiConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiConstants.au3>
#include <WindowsConstants.au3>
#include <AutoItConstants.au3>
#include <file.au3>
#include <FileConstants.au3>
#include <IE.au3>
#include <MsgBoxConstants.au3>

Local $oIE
Local $sSection1;Audrey Hepburn
Local $sSection2;Sean Connery
Local $sSection3;Rita Hayworth
Local $sLanguage
Local $sResult = ("Result.ini")
Local $aSection1 = IniReadSection('data.ini', 'Section1')
Local $aSection2 = IniReadSection('data.ini', 'Section2')
Local $aSection3 = IniReadSection('data.ini', 'Section3')
Local $aLanguage = IniReadSection('data.ini', 'Language')


Opt("GUIOnEventMode", 1)

Global $mainwindow = GuiCreate("SUB Tracker", 220, 180, 100, 100)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Terminate")

Local $idRadio1 = GUICtrlCreateRadio("Audrey Hepburn", 10, 10, 200, 20)
Local $idRadio2 = GUICtrlCreateRadio("Sean Connery", 10, 40, 200, 20)
Local $idRadio3 = GUICtrlCreateRadio("Rita Hayworth", 10, 70, 200, 20)

Local $searchbutton = GUICtrlCreateButton("SEARCH", 60, 100, 100, 25)
Local $resultbutton = GUICtrlCreateButton("SHOW RESULT", 50, 140, 120, 25)

GUICtrlSetOnEvent($resultbutton, "_Result")
GUICtrlSetOnEvent($searchbutton, "_Search")

GUISetState(@SW_SHOW)

While 1
    Sleep(100)
WEnd

Func _Result()
        ShellExecute ("Result.ini")
EndFunc

Func _Search()
            If GUICtrlRead($idRadio1) = $GUI_CHECKED Then
                SplashTextOn("Searching", "Search...", 600, 50)
                    For $i = 1 To $aSection1[0][0]
                        ControlSetText("Searching", "", "Static1", "Searching the SUB for " & $aSection1[$i][0])
                        $oIE = _IECreate($aSection1[$i][1], 1)
                        _IELoadWait($oIE)
                        $sSection1 = _IEBodyReadText($oIE)
                    For $j = 1 To $aLanguage[0][0]
                        If StringInStr($sSection1, $aLanguage[$j][0]) Then
                            IniWrite($sResult, $aSection1[$i][0], $aLanguage[$j][0], $aLanguage[$j][1])
                        EndIf

                    Next
                        _IEQuit($oIE)
                    Next
                        SplashOff()
                        If @error Then
                            msgbox(0,"failed",@error)
                        Else
                        MsgBox($MB_ICONINFORMATION, "SUB Tracker", "Done", 0)
                        EndIf

            EndIf

            If GUICtrlRead($idRadio2) = $GUI_CHECKED Then
                SplashTextOn("Searching", "Search...", 600, 50)
                    For $i = 1 To $aSection2[0][0]
                        ControlSetText("Searching", "", "Static1", "Searching the SUB for " & $aSection2[$i][0])
                        $oIE = _IECreate($aSection2[$i][1], 1)
                        _IELoadWait($oIE)
                        $sSection2 = _IEBodyReadText($oIE)
                    For $j = 1 To $aLanguage[0][0]
                        If StringInStr($sSection2, $aLanguage[$j][0]) Then
                            IniWrite($sResult, $aSection2[$i][0], $aLanguage[$j][0], $aLanguage[$j][1])
                        EndIf
                    Next
                        _IEQuit($oIE)
                    Next
                        SplashOff()
                        If @error Then
                            msgbox(0,"failed",@error)
                        Else
                        MsgBox($MB_ICONINFORMATION, "SUB Tracker", "Done", 0)
                        EndIf
            EndIf

            If GUICtrlRead($idRadio3) = $GUI_CHECKED Then
                SplashTextOn("Searching", "Search...", 600, 50)
                    For $i = 1 To $aSection3[0][0]
                        ControlSetText("Searching", "", "Static1", "Searching the SUB for " & $aSection3[$i][0])
                        $oIE = _IECreate($aSection3[$i][1], 1)
                        _IELoadWait($oIE)
                        $sSection3 = _IEBodyReadText($oIE)
                    For $j = 1 To $aLanguage[0][0]
                        If StringInStr($sSection3, $aLanguage[$j][0]) Then
                            IniWrite($sResult, $aSection3[$i][0], $aLanguage[$j][0], $aLanguage[$j][1])
                        EndIf
                    Next
                        _IEQuit($oIE)
                    Next
                        SplashOff()
                        If @error Then
                            msgbox(0,"failed",@error)
                        Else
                        MsgBox($MB_ICONINFORMATION, "SUB Tracker", "Done", 0)
                        EndIf
            EndIf

EndFunc

Func _Terminate()
    Exit
EndFunc

Anyhow, the results is the same, as I said before. It marks me in the Result file ALL the links, not only the links which satisfied the condition.

The example I made before is for the first section (Radio1 - Audrey Hepburn) but didn't work well for any of the other sections.

Edit: And I don't get any error message.

Edited by stefionesco
Link to comment
Share on other sites

#include <GuiConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiConstants.au3>
#include <WindowsConstants.au3>
#include <AutoItConstants.au3>
#include <file.au3>
#include <FileConstants.au3>
#include <IE.au3>
#include <MsgBoxConstants.au3>

Local $oIE
Local $sSection1;Audrey Hepburn
Local $sSection2;Sean Connery
Local $sSection3;Rita Hayworth
Local $sLanguage
Local $sResult = ("Result.ini")
Local $aSection1 = IniReadSection('data.ini', 'Section1')
Local $aSection2 = IniReadSection('data.ini', 'Section2')
Local $aSection3 = IniReadSection('data.ini', 'Section3')
Local $aLanguage = IniReadSection('data.ini', 'Language')

Opt("GUIOnEventMode", 1)

Global $mainwindow = GuiCreate("SUB Tracker", 220, 180, 100, 100)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Terminate")

Local $idRadio1 = GUICtrlCreateRadio("Audrey Hepburn", 10, 10, 200, 20)
Local $idRadio2 = GUICtrlCreateRadio("Sean Connery", 10, 40, 200, 20)
Local $idRadio3 = GUICtrlCreateRadio("Rita Hayworth", 10, 70, 200, 20)

Local $searchbutton = GUICtrlCreateButton("SEARCH", 60, 100, 100, 25)
Local $resultbutton = GUICtrlCreateButton("SHOW RESULT", 50, 140, 120, 25)

GUICtrlSetOnEvent($resultbutton, "_Result")
GUICtrlSetOnEvent($searchbutton, "_Search")

GUISetState(@SW_SHOW)

While 1
    Sleep(100)
WEnd

Func _Result()
        ShellExecute ("Result.ini")
EndFunc

Func _Search()

            If GUICtrlRead($idRadio1) = $GUI_CHECKED Then
                SplashTextOn("Searching", "Search...", 600, 50)
                    For $i = 1 To $aSection1[0][0]
                        ControlSetText("Searching", "", "Static1", "Searching the SUB for " & $aSection1[$i][0])
                        $oIE = _IECreate($aSection1[$i][1], 1)
                        _IELoadWait($oIE)
                        $sSection1 = _IEBodyReadText($oIE)
                    For $j = 1 To $aLanguage[0][0]
                        If StringInStr($sSection1, $aLanguage[$j][0]) Then
                            IniWrite($sResult, $aSection1[$i][0], "", $aLanguage[$j][1])
                        EndIf
                    Next
                        _IEQuit($oIE)
                    Next
                        SplashOff()
                        MsgBox($MB_ICONINFORMATION, "SUB Tracker", "Done", 0)
            EndIf

            If GUICtrlRead($idRadio2) = $GUI_CHECKED Then
                SplashTextOn("Searching", "Search...", 600, 50)
                    For $i = 1 To $aSection2[0][0]
                        ControlSetText("Searching", "", "Static1", "Searching the SUB for " & $aSection2[$i][0])
                        $oIE = _IECreate($aSection2[$i][1], 1)
                        _IELoadWait($oIE)
                        $sSection2 = _IEBodyReadText($oIE)
                    For $j = 1 To $aLanguage[0][0]
                        If StringInStr($sSection2, $aLanguage[$j][0]) Then
                            IniWrite($sResult, $aSection2[$i][0], "", $aLanguage[$j][1])
                        EndIf
                    Next
                        _IEQuit($oIE)
                    Next
                        SplashOff()
                        MsgBox($MB_ICONINFORMATION, "SUB Tracker", "Done", 0)
            EndIf

            If GUICtrlRead($idRadio3) = $GUI_CHECKED Then
                SplashTextOn("Searching", "Search...", 600, 50)
                    For $i = 1 To $aSection3[0][0]
                        ControlSetText("Searching", "", "Static1", "Searching the SUB for " & $aSection3[$i][0])
                        $oIE = _IECreate($aSection3[$i][1], 1)
                        _IELoadWait($oIE)
                        $sSection3 = _IEBodyReadText($oIE)
                    For $j = 1 To $aLanguage[0][0]
                        If StringInStr($sSection3, $aLanguage[$j][0]) Then
                            IniWrite($sResult, $aSection3[$i][0], "", $aLanguage[$j][1])
                        EndIf
                    Next
                        _IEQuit($oIE)
                    Next
                        SplashOff()
                        MsgBox($MB_ICONINFORMATION, "SUB Tracker", "Done", 0)
            EndIf

EndFunc

Func _Terminate()
    Exit
EndFunc

I found the error. As Water said:

12 hours ago, water said:

There is absolutely no error

Every link open a page that contain a drop-down menu that contains the word I've search, so the result was always positive. I change with some other word and now work just fine.

Now I'm thinking if it is possible to unify in some way all the "if"s in one unique "If", using something like Radio-X where X=1, or 2, or 3? The same for the Section-X. 

This example I use here have only 3 Radio buttons, but the final script will have about 40 radio buttons and I'm trying to minimize the script. Do you think it's possible?

Thanks.

 

Stef Ionesco

data.ini

Link to comment
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
 Share

  • Recently Browsing   0 members

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