stefionesco Posted April 11, 2017 Share Posted April 11, 2017 I have an INI file that contains some equal sign in the key of one of the section. Something like this: [section] https://www.google.ro/#safe=active&q=test = link_value When I read the value is giving me as a result this "test = link_value". I tried backslash, quotes, but nothing. How can I skip the first equal sign? Thanks Link to comment Share on other sites More sharing options...
water Posted April 11, 2017 Share Posted April 11, 2017 (edited) Wouldn't link_value = https://www.google.ro/#safe=active&q=test be more sensible? Edited April 11, 2017 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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 More sharing options...
Moderators Melba23 Posted April 11, 2017 Moderators Share Posted April 11, 2017 (edited) 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 April 11, 2017 by Melba23 Skysnake 1 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...
stefionesco Posted April 11, 2017 Author Share Posted April 11, 2017 Oh, my God... I never thought about this solution. Yes, indeed... Great minds. Thanks Link to comment Share on other sites More sharing options...
water Posted April 11, 2017 Share Posted April 11, 2017 Hi Melba, I do my very best to - sometimes - be one step ahead of you Skysnake 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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 More sharing options...
FrancescoDiMuro Posted April 14, 2017 Share Posted April 14, 2017 On 11/4/2017 at 4:07 PM, water said: Hi Melba, I do my very best to - sometimes - be one step ahead of you OT: But worth Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Luigi Posted April 14, 2017 Share Posted April 14, 2017 @stefionesco, see this. Visit my repository Link to comment Share on other sites More sharing options...
stefionesco Posted April 17, 2017 Author Share Posted April 17, 2017 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. expandcollapse popup#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 More sharing options...
water Posted April 17, 2017 Share Posted April 17, 2017 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 2024-07-28 - Version 1.6.3.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 (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 More sharing options...
stefionesco Posted April 17, 2017 Author Share Posted April 17, 2017 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 More sharing options...
water Posted April 17, 2017 Share Posted April 17, 2017 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 2024-07-28 - Version 1.6.3.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 (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 More sharing options...
stefionesco Posted April 17, 2017 Author Share Posted April 17, 2017 (edited) You mean this: expandcollapse popup#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 April 17, 2017 by stefionesco Link to comment Share on other sites More sharing options...
stefionesco Posted April 17, 2017 Author Share Posted April 17, 2017 expandcollapse popup#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 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