nacerbaaziz Posted June 8, 2019 Posted June 8, 2019 hello sirs, i have searched allot about an function that can read the INI file as a string i mean function to read the ini files from string and not from the file directly. i finally found an UDF that do what i want but unfortunately all the functions work, but the function that i want it not working. this is the udf the function that i need is _IniReadFromString this is the function Func _IniReadFromString($szInput, $szSection, $szKey, $Default) $szInput = StringStripCR($szInput) Local $aRegMl = StringRegExp($szInput, "\[" & __StringEscapeRegExp($szSection) & "\]\n+(?:[^\[].*?=.*\n)*" & __StringEscapeRegExp($szKey) & "=(.*)\n?(", 3) If @error Then Return SetError(1, 0, $Default) ; key not found Return $aRegMl[0] EndFunc;==>_IniReadFromString i hope that any one can help me thank you in advance iniex.au3
BrewManNH Posted June 8, 2019 Posted June 8, 2019 32 minutes ago, nacerbaaziz said: but unfortunately all the functions work, but the function that i want it not working. Might be a good idea to tell everyone what's not working, and how. 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 GudeHow 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
nacerbaaziz Posted June 8, 2019 Author Posted June 8, 2019 hello sir @BrewManNH i gave you the function that not working it always return an Empty string
TheXman Posted June 8, 2019 Posted June 8, 2019 What is wrong with the INI functions built into AutoIt, such as IniRead()? CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman
nacerbaaziz Posted June 8, 2019 Author Posted June 8, 2019 5 minutes ago, TheXman said: What is wrong with the INI functions built into AutoIt, such as IniRead()? I WANT TO READ AN INI SECTION FROM MY WEB SITE, AND I DON't want to create an ini file into the user PCS because the their is an some web site information such as the ftp password, for that i want to read the section with out the creation of the ini file.
nacerbaaziz Posted June 9, 2019 Author Posted June 9, 2019 Can you help me to correct this error please
TheXman Posted June 10, 2019 Posted June 10, 2019 There is an error in the function's regular expression. Right before the last double quote, there is an erroneous right paren ("("). The corrected function below has the original line commented out and the corrected line right below it. Func _IniReadFromString($szInput, $szSection, $szKey, $Default) $szInput = StringStripCR($szInput) ;~ Local $aRegMl = StringRegExp($szInput, "\[" & __StringEscapeRegExp($szSection) & "\]\n+(?:[^\[].*?=.*\n)*" & __StringEscapeRegExp($szKey) & "=(.*)\n?(", 3) Local $aRegMl = StringRegExp($szInput, "\[" & __StringEscapeRegExp($szSection) & "\]\n+(?:[^\[].*?=.*\n)*" & __StringEscapeRegExp($szKey) & "=(.*)\n?", 3) If @error Then Return SetError(1, 0, $Default) ; key not found Return $aRegMl[0] EndFunc ;==>_IniReadFromString By the way, think twice before replying in all caps when someone is trying to help you. The next time you do it, don't be surprised if you get no replies. FrancescoDiMuro 1 CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman
nacerbaaziz Posted June 10, 2019 Author Posted June 10, 2019 now it work with me. thank you all for your help accept my greetings
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