santaryan Posted April 24, 2011 Share Posted April 24, 2011 (edited) This is my first time making a GUI and I'm very inexperienced in AutoIt (just started actually using it), so sorry if this isn't the information you need to help me.I have a script that is asking to input (GUICtrlCreateInput) a path and filename and then write that given information into an .ini file (IniWrite). You have the option of doing this 3 different ways:drag and drop ($WS_EX_ACCEPTFILES, and $GUI_DROPACCEPTED)type directly into the input boxfile open prompt (FileOpenDialog) by clicking on a button (GUICtrlCreateButton)The first 2 ways work fine (Drag and Drop and Direct Typing), but the last one (File Open Prompt) disables the ability to write to the .ini.How my code functions for the file open prompt:You click on a button (GUICtrlCreateButton)You select an item from the dialog (FileOpenDialog)When you hit ok, it writes the return value to the input box (GUICtrlSetData)You then click another button which performs the actual writing (GUICtrlRead and IniWrite)It DOES write the information back into the input box properly, and I can verify this by a MsgBox (using GUICtrlRead just as I do on the IniWrite), but it fails to write to the ini. Another problem is that after using the File Open Dialog prompt, it entirely disables the ability to write to an ini. So even re-editing the input box by typing directly, or by dragging and dropping, won't make it work again.Anybody mind telling me what the problem is??I have attached the script with the exit ability of the "Save And Exit" button disabled, the secondary input box ini writing disabled, and instead of just writing to the file with no verification, it will open a msgbox as well to verify the input box text.It is dirty scripting and doesn't have the variables declared at the top. If this is the problem then please let me know. I declare variables at the top only after I have finished writing the script.Lastly, I will reupload the file with detailed documentation if you cannot understand it.TestCFGRead.au3 Edited April 24, 2011 by santaryan Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted April 24, 2011 Share Posted April 24, 2011 (edited) Hi and Welcome to the forums!!Anybody mind telling me what the problem is??Sure, it's that you didn't read the remarks section in the helpfile.Open helpfile > FileOpenDialog@WorkingDir is changed on successful return.So the ini is written relative to the folder you selected. To fix do a FileChangeDir() after the FileOpenDialog() and change things back to how you want them. Or provide full paths to your file-related functions (look at @ScriptDir). Edited April 24, 2011 by AdmiralAlkex .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
santaryan Posted April 24, 2011 Author Share Posted April 24, 2011 Sure, it's that you didn't read the remarks section in the helpfile.Open helpfile > FileOpenDialogSo the ini is written relative to the folder you selected. To fix do a FileChangeDir() after the FileOpenDialog() and change things back to how you want them. Or provide full paths to your file-related functions (look at @ScriptDir).Ah... knew it was something silly like that.. Sorry for the trouble. I'm surprised that to function doesn't save the current working directory before it opens the dialog and then reapplies the working directory after the script is finished. Oh well, guess theres reasoning behind it that I don't fully know about at the current moment. xPThank you for your quick reply. Link to comment Share on other sites More sharing options...
GEOSoft Posted April 24, 2011 Share Posted April 24, 2011 FileOpenDialog() just uses the standard Windows dialog as defined in cmndlg32.dll so it's behavior is really governed by Windows more-so than AutoIt. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" 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