Jump to content
Sign in to follow this  
Damein

Ini / OpenDialog Bug or fail?

Recommended Posts

Damein

Using this code, I've noticed something. Maybe I set it up wrong, but I can't see how, but it won't write to the Ini file if a FileOpenDialog has been recently used.

Opt("GUIOnEventMode", 1)
#include <GUIConstantsEx.au3>

GuiCreate("Test", 400,400)
$Button1 = GuiCtrlCreateButton("Test", 40,20)
GUICtrlSetOnEvent(-1, "_Browse")
$Button2 = GuiCtrlCreateButton("Test2",40,60)
GUICtrlSetOnEvent(-1, "_Apply")
GuiSetState()

Func _Browse()
    $ShortcutToSave = FileOpenDialog("Choose shortcut", @DesktopDir, "All (*.*)")
    If @error Then
        MsgBox(48, "Error", "No file selected, please select a file or press cancel!")
    EndIf
;~  $ShortcutInfo = '"' & $ShortcutToSave & '"'
EndFunc

Func _Apply()
    IniWrite("KeyMaps.ini", "Maps", "Up", "Test1")
EndFunc

While 1
    Sleep(10)
WEnd

So run the script, and just press the "Test2" button. If you open the ini you'll notice the change in it.

Now close the script, change what the value will be and then run again.

This time click "Test" button, select a random file.

Then try and click "Test2" and check the ini. Nothing will write to it.

Now, I'm sure I'm just doing something wrong or over looking something.. but I can't see it.

Thanks in advance!

Edited by Damein

MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

Share this post


Link to post
Share on other sites
Jos

It will write to the INI file, but likely the WorkDIr is changed due to to use of FileOpenDialog(), so the INI file is created somewhere else.

Just use a file path to your ini file like:

IniWrite(@scriptdir & "\KeyMaps.ini", "Maps", "Up", "Test1")

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Damein

Ah, I figured it was something I was missing.

Works like a charm now, thanks!


MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.