Jump to content

strange problem with iniwrite function !!


Recommended Posts

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

  • Developers

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 by Jos

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...