BlueScreen Posted February 19, 2006 Posted February 19, 2006 (edited) Take a look at this code #include <GUIConstants.au3> #include <Array.au3> #include <Core.au3> Dim $INIarray [3][3] Global $Done Global $Browse DrawGui () While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $Browse $fileInput = FileOpenDialog("", "c:\", "txt (*.txt)", 1+4) Case $msg = $Done $INIarray=IniReadSection ("x.ini", "y") $Num=$INIarray[0][0] exit EndSelect WEnd Func DrawGui () GUICreate("",350,270) $Browse=GUICtrlCreateButton ("Browse",137,155,75,25) $Done=GUICtrlCreateButton ("Done",137,195,75,25) GUISetState () EndFunc When I choose “Browse” and then I choose a txt file NOT from c:\, after pressing “Done”, I get an error message. Why? Edited February 19, 2006 by BlueScreen
Valik Posted February 19, 2006 Posted February 19, 2006 FileOpenDialog() changes the working copy. When you subsequently try to open "x.ini", it's being searched for at @WorkingDir\x.ini when what you really mean is @ScriptDir\x.ini. The solution is to use @ScriptDir & "\x.ini" explicitly.
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