AlienStar Posted November 17, 2017 Share Posted November 17, 2017 (edited) hello everybody when I paste emoji in "input box' to be saved in an "ini file" it's saved as question marks "?????" although when I paste the emoji in every edited place it's saved properly how to fix please ?? example: π π π π· π€ π€ #include <GUIConstantsEx.au3> Example() Func Example() ; Create a GUI with various controls. Local $hGUI = GUICreate("Example",200,200) Local $hinput = GUICtrlCreateInput("",25,25,150,25) Local $idOK = GUICtrlCreateButton("OK", 75, 100, 50, 25) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop case $idOK $emoji = GUICtrlRead($hinput,1) MsgBox(0,"",$emoji ) IniWrite("emoji.ini","1","key=",$emoji) EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>Example Β Edited November 17, 2017 by AlienStar Link to comment Share on other sites More sharing options...
BrewManNH Posted November 17, 2017 Share Posted November 17, 2017 Pictures aren't text, you can't place a picture in an ini file. 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 Link to comment Share on other sites More sharing options...
AlienStar Posted November 17, 2017 Author Share Posted November 17, 2017 1 minute ago, BrewManNH said: Pictures aren't text, you can't place a picture in an ini file. when I paste it manually in any text file it's saved properly !!! Link to comment Share on other sites More sharing options...
BrewManNH Posted November 17, 2017 Share Posted November 17, 2017 The picture is? 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 Link to comment Share on other sites More sharing options...
AlienStar Posted November 17, 2017 Author Share Posted November 17, 2017 (edited) 3 minutes ago, BrewManNH said: The picture is? no it's not picture but character try to copy emoji from the first post then paste in a text file Edited November 17, 2017 by AlienStar Link to comment Share on other sites More sharing options...
AlienStar Posted November 17, 2017 Author Share Posted November 17, 2017 Link to comment Share on other sites More sharing options...
BrewManNH Posted November 17, 2017 Share Posted November 17, 2017 Ini files are not generic text files, and have VERY specific formatting rules. Random pictures aren't part of that. Use another type of file and don't use IniWrite/IniRead with it. AlienStar 1 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 Link to comment Share on other sites More sharing options...
AlienStar Posted November 17, 2017 Author Share Posted November 17, 2017 I try to save in text file but the same problem !!! although when I send it in MsgBox it's sent properly ! Link to comment Share on other sites More sharing options...
trancexx Posted November 18, 2017 Share Posted November 18, 2017 You have to set proper encoding for the ini before writing to it. Maybe like this: Example() Func Example() ; Set proper encoding for the ini file FileClose(FileOpen("emoji.ini", 32 + 1 + 8)) ; Create a GUI with various controls. Local $hGUI = GUICreate("Example", 200, 200) Local $hinput = GUICtrlCreateInput("", 25, 25, 150, 25) Local $idOK = GUICtrlCreateButton("OK", 75, 100, 50, 25) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case -3 ExitLoop Case $idOK $emoji = GUICtrlRead($hinput, 1) IniWrite("emoji.ini", "1", "emoji", $emoji) MsgBox(0, "", IniRead("emoji.ini", "1", "emoji", "")) EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc Β AlienStar 1 β‘β‘β‘ . eMyvnE Link to comment Share on other sites More sharing options...
AlienStar Posted November 20, 2017 Author Share Posted November 20, 2017 On 11/18/2017 at 7:12 AM, trancexx said: You have to set proper encoding for the ini before writing to it. Maybe like this: Example() Func Example() ; Set proper encoding for the ini file FileClose(FileOpen("emoji.ini", 32 + 1 + 8)) ; Create a GUI with various controls. Local $hGUI = GUICreate("Example", 200, 200) Local $hinput = GUICtrlCreateInput("", 25, 25, 150, 25) Local $idOK = GUICtrlCreateButton("OK", 75, 100, 50, 25) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case -3 ExitLoop Case $idOK $emoji = GUICtrlRead($hinput, 1) IniWrite("emoji.ini", "1", "emoji", $emoji) MsgBox(0, "", IniRead("emoji.ini", "1", "emoji", "")) EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc Β that is the solution, it works fine thanks so much 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