AlienStar Posted August 15, 2020 Share Posted August 15, 2020 hello everybody I need to save a key in main section in ini db Global $Pblshd_db = "Pblshd_db.ini" while 1 Global $GUIMsg = GUIGetMsg() Select Case $GUIMsg = $GUI_EVENT_CLOSE Exit ;==================================== Case $GUIMsg = $IMGADD_BTN Global $sMessage = "add an image" Global $Img_loc = FileOpenDialog($sMessage, @DesktopDir & "\", "Images (*.jpg)", $FD_FILEMUSTEXIST) If @error Then ; Display the error message. MsgBox($MB_SYSTEMMODAL, "error", "no image selected") Else ; Replace instances of "|" with @CRLF in the string returned by FileOpenDialog. $Img_loc = StringReplace($Img_loc, "|", @CRLF) ;--------------------------------------------------- Local $Data_img = "IMG =" & $Img_loc IniWriteSection($Pblsh_db,"Pending",$Data_img) ShellExecute($Pblsh_db) ;--------------------------------------------------- EndIf ;==================================== EndSelect wend when I open $Pblsh_db manually I don't see any changes! even the image location I put in, there is nothing ! So I do ShellExecute($Pblsh_db) to know if it writes a key or not Then after the ini file open , it shows that it saved the new key "image location" but also when I return to ini file and open manually it shows nothing please help Link to comment Share on other sites More sharing options...
AlienStar Posted August 15, 2020 Author Share Posted August 15, 2020 I put this line in the first code when it runs IniWriteSection($Pblsh_db,"Pending", "IMG = C:\Users\me\Pictures\3.jpg") and it writes a section but not when the button is pressed ! what does happen please ? Link to comment Share on other sites More sharing options...
Developers Jos Posted August 15, 2020 Developers Share Posted August 15, 2020 (edited) Change this line to: Global $Pblshd_db = @ScriptDir & "\Pblshd_db.ini" Because the FileOpenDialog() will change the working directory, so the INIWrite will write a new INI file in the selected dorectory. Jos Edited August 15, 2020 by Jos AlienStar 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
AlienStar Posted August 15, 2020 Author Share Posted August 15, 2020 7 minutes ago, Jos said: Change this line to: Global $Pblshd_db = @ScriptDir & "\Pblshd_db.ini" Because the FileOpenDialog() will change the working directory, so the INIWrite will write a new INI file in the selected dorectory. Jos it's working 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