oapjr Posted February 2, 2015 Posted February 2, 2015 (edited) Hi! I'm having problem with IniWrite function The problem is that if the returned string from _FileListToArrayRec contain something like "3D-graphics1440x900" the string that is written on the ini file is "3D-graphics1440?900". Does anyone know what I'm doing wrong? Edit: I know that if I rename the folder the functions work properly #include <File.au3> Local $iReturn Local $sPath, $sFile Local $aList $sPath = @UserProfileDir & '\Pictures' $iReturn = $FLTAR_FILES + $FLTAR_NOHIDDEN + $FLTAR_NOSYSTEM + $FLTAR_NOLINK $aList = _FileListToArrayRec($sPath, "*jpg;*.png||", $iReturn, $FLTAR_RECUR, $FLTAR_NOSORT, $FLTAR_FULLPATH) $sFile = $aList[Random(1, $aList[0], 1)] IniWrite('test.ini','test','test',$sFile) Edited February 2, 2015 by oapjr
JohnOne Posted February 2, 2015 Posted February 2, 2015 No point in writing "something like", give some exact examples. Is your inifile set to ansi? Is your language US? Etc... AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
oapjr Posted February 2, 2015 Author Posted February 2, 2015 My language is US and I didn't setup the inifile The exact example is that "3D-graphics1440x900" was written as "3D-graphics1440?900"
SadBunny Posted February 2, 2015 Posted February 2, 2015 Where does that ini file come from, and could it be the case that that x is not a default letter x (plain old Ascii char 120) but some unicode character representing a mathematical multiplication symbol that just looks like an x? Roses are FF0000, violets are 0000FF... All my base are belong to you.
TheSaint Posted February 2, 2015 Posted February 2, 2015 (edited) I believe, that what SadBunny says is correct. Your x is not a standard ASCII x, and is being substituted by a ? (question mark). You need to code your own replacement. It is possibly the extended ASCII character 215. See the Appendix in the Help file. Edited February 2, 2015 by TheSaint Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)
SadBunny Posted February 2, 2015 Posted February 2, 2015 I'd put my money on unicode character u02715, like in: 10✕10=100. Roses are FF0000, violets are 0000FF... All my base are belong to you.
oapjr Posted February 2, 2015 Author Posted February 2, 2015 (edited) I google the "х" from 1440х900 and I got this on Wikipedia: Character Х х Unicode name CYRILLIC CAPITAL LETTER HA CYRILLIC SMALL LETTER HA Encodings decimal hex decimal hex Unicode 1061 U+0425 1093 U+0445 UTF-8 208 165 D0 A5 209 133 D1 85 Numeric character reference Х Х х х KOI8-R and KOI8-U 232 E8 200 C8 Code page 855 182 B6 181 B5 Code page 866 149 95 229 E5 Windows-1251 213 D5 245 F5 ISO-8859-5 197 C5 229 E5 Macintosh Cyrillic 149 95 245 F5 ps: the file contain a bunch of wallpaper I downloaded on the internet and the ini I created on autoit Edited February 2, 2015 by oapjr
Solution BrewManNH Posted February 2, 2015 Solution Posted February 2, 2015 By design, INI files are not Unicode aware. You can make your INI file able to save Unicode characters by doing a FileOpen using a Unicode file write mode, and then use FileClose to close it. Do this before using the INI file for the first time. See the Help file for IniWrite. 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
oapjr Posted February 2, 2015 Author Posted February 2, 2015 By design, INI files are not Unicode aware. You can make your INI file able to save Unicode characters by doing a FileOpen using a Unicode file write mode, and then use FileClose to close it. Do this before using the INI file for the first time. See the Help file for IniWrite. It worked! Thank you everyone!
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