Sign in to follow this  
Followers 0
Aces

FileSaveDialog() problems

6 posts in this topic

#1 ·  Posted (edited)

;;;;;;;;;;;; Proxyz Buddy; Version 0.0.1; AutoIt v3

;Presets
#include <GUIConstants.au3>
Opt("TrayIconHide", 1)
Opt("MouseCoordMode", 3)
;Pre Bindables
$GUItitle = "Proxyz Buddy v0.0.1"

;References

;GUI Creation
$Form1 = GUICreate($GUItitle, 208, 329, 321, 125)
$Label1 = GUICtrlCreateLabel("Proxy IP Address", 32, 32, 140, 17)
$Input1 = GUICtrlCreateInput("Enter proxy here...", 32, 48, 137, 21)
$Label2 = GUICtrlCreateLabel("Router IP Address", 32, 80, 140, 17)
$Input2 = GUICtrlCreateInput("Enter router home IP...", 32, 96, 145, 21)
$Radio1 = GUICtrlCreateRadio("Enable Proxy IP", 32, 136, 113, 17)
$Radio2 = GUICtrlCreateRadio("Enable Router IP", 32, 152, 113, 17)
$Button1 = GUICtrlCreateButton("Connect", 8, 192, 81, 41, 0)
$Button2 = GUICtrlCreateButton("Quit PzB", 112, 192, 81, 41, 0)
$Label3 = GUICtrlCreateLabel($GUItitle, 16, 272, 172, 17)
$Label4 = GUICtrlCreateLabel("Copyright: Ace Coding Development", 16, 256, 172, 17)
$MenuItem1 = GUICtrlCreateMenu("File")
$MenuItem5 = GUICtrlCreateMenuItem("Save", $MenuItem1)
$MenuItem4 = GUICtrlCreateMenuItem("Load", $MenuItem1)
$MenuItem6 = GUICtrlCreateMenuItem("Quit PzB", $MenuItem1)
$MenuItem2 = GUICtrlCreateMenu("Settings")
$MenuItem8 = GUICtrlCreateMenuItem("Options", $MenuItem2)
$MenuItem7 = GUICtrlCreateMenuItem("Paths", $MenuItem2)
$MenuItem3 = GUICtrlCreateMenu("Help")
$MenuItem9 = GUICtrlCreateMenuItem("Forums", $MenuItem3)
GUISetBkColor(0xCC9933)
GUISetState(@SW_SHOW)

;Main Script

;HARDCODED TO KEEP WINDOW OPEN!
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE 
            Exit
        Case $msg = $MenuItem5
            $Save = FileSaveDialog("Save INI...", @SCRIPTDIR, "Configuration File (*.ini)|All (*.*)", 16, "PzB_Config")
    EndSelect
WEnd

;Functions

The FileSaveDialog() does not execute just goes back to GUI and continues loop

I want to save some information from the $Input variables and the $Radio variables as well, into the ini specified

Edited by Aces

~~ AutoIt v3 Minion ~~Name: Kevin "Aces-X" MorrisOrganization: A C DevelopmentE-Mail: AcesX91@acecoding.netOS: XP Professional; Vista package~~ Released Software ~~CPU-Mach: Topic at acecoding.net ForumsProxyzBuddy: Beta testing at the moment, private onlyWHSTool: Not released to the public

Share this post


Link to post
Share on other sites



Like this?

;;;;;;;;;;;; Proxyz Buddy; Version 0.0.1; AutoIt v3

;Presets
#include <GUIConstants.au3>
Opt("TrayIconHide", 1)
Opt("MouseCoordMode", 3)
;Pre Bindables
$GUItitle = "Proxyz Buddy v0.0.1"

;References

;GUI Creation
$Form1 = GUICreate($GUItitle, 208, 329, 321, 125)
$Label1 = GUICtrlCreateLabel("Proxy IP Address", 32, 32, 140, 17)
$Input1 = GUICtrlCreateInput("Enter proxy here...", 32, 48, 137, 21)
$Label2 = GUICtrlCreateLabel("Router IP Address", 32, 80, 140, 17)
$Input2 = GUICtrlCreateInput("Enter router home IP...", 32, 96, 145, 21)
$Radio1 = GUICtrlCreateRadio("Enable Proxy IP", 32, 136, 113, 17)
$Radio2 = GUICtrlCreateRadio("Enable Router IP", 32, 152, 113, 17)
$Button1 = GUICtrlCreateButton("Connect", 8, 192, 81, 41, 0)
$Button2 = GUICtrlCreateButton("Quit PzB", 112, 192, 81, 41, 0)
$Label3 = GUICtrlCreateLabel($GUItitle, 16, 272, 172, 17)
$Label4 = GUICtrlCreateLabel("Copyright: Ace Coding Development", 16, 256, 172, 17)
$MenuItem1 = GUICtrlCreateMenu("File")
$MenuItem5 = GUICtrlCreateMenuItem("Save", $MenuItem1)
$MenuItem4 = GUICtrlCreateMenuItem("Load", $MenuItem1)
$MenuItem6 = GUICtrlCreateMenuItem("Quit PzB", $MenuItem1)
$MenuItem2 = GUICtrlCreateMenu("Settings")
$MenuItem8 = GUICtrlCreateMenuItem("Options", $MenuItem2)
$MenuItem7 = GUICtrlCreateMenuItem("Paths", $MenuItem2)
$MenuItem3 = GUICtrlCreateMenu("Help")
$MenuItem9 = GUICtrlCreateMenuItem("Forums", $MenuItem3)
GUISetBkColor(0xCC9933)
GUISetState(@SW_SHOW)

;Main Script

;HARDCODED TO KEEP WINDOW OPEN!
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $MenuItem5
            $Save = FileSaveDialog("Save INI...", @SCRIPTDIR, "Configuration File (*.ini)|All (*.*)", 16, "PzB_Config")
            IniWrite($Save, "Controls", "Input1", GUICtrlRead ( $Input1 ))
            IniWrite($Save, "Controls", "Input2", GUICtrlRead ( $Input2 ))
            IniWrite($Save, "Controls", "Radio1", GUICtrlRead ( $Radio1))
            IniWrite($Save, "Controls", "Radio2", GUICtrlRead ( $Radio2))
    EndSelect
WEnd

;Functions

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

And a bit more for fun (not tested)

Edit - Just tested. 12:22 AM EST

;;;;;;;;;;;; Proxyz Buddy; Version 0.0.1; AutoIt v3

;Presets
#include <GUIConstants.au3>
Opt("TrayIconHide", 1)
Opt("MouseCoordMode", 3)
;Pre Bindables
$GUItitle = "Proxyz Buddy v0.0.1"

;References

;GUI Creation
$Form1 = GUICreate($GUItitle, 208, 329, 321, 125)
$Label1 = GUICtrlCreateLabel("Proxy IP Address", 32, 32, 140, 17)
$Input1 = GUICtrlCreateInput("Enter proxy here...", 32, 48, 137, 21)
$Label2 = GUICtrlCreateLabel("Router IP Address", 32, 80, 140, 17)
$Input2 = GUICtrlCreateInput("Enter router home IP...", 32, 96, 145, 21)
$Radio1 = GUICtrlCreateRadio("Enable Proxy IP", 32, 136, 113, 17)
$Radio2 = GUICtrlCreateRadio("Enable Router IP", 32, 152, 113, 17)
$Button1 = GUICtrlCreateButton("Connect", 8, 192, 81, 41, 0)
$Button2 = GUICtrlCreateButton("Quit PzB", 112, 192, 81, 41, 0)
$Label3 = GUICtrlCreateLabel($GUItitle, 16, 272, 172, 17)
$Label4 = GUICtrlCreateLabel("Copyright: Ace Coding Development", 16, 256, 172, 17)
$MenuItem1 = GUICtrlCreateMenu("File")
$MenuItem5 = GUICtrlCreateMenuItem("Save", $MenuItem1)
$MenuItem4 = GUICtrlCreateMenuItem("Load", $MenuItem1)
$MenuItem6 = GUICtrlCreateMenuItem("Quit PzB", $MenuItem1)
$MenuItem2 = GUICtrlCreateMenu("Settings")
$MenuItem8 = GUICtrlCreateMenuItem("Options", $MenuItem2)
$MenuItem7 = GUICtrlCreateMenuItem("Paths", $MenuItem2)
$MenuItem3 = GUICtrlCreateMenu("Help")
$MenuItem9 = GUICtrlCreateMenuItem("Forums", $MenuItem3)
GUISetBkColor(0xCC9933)
GUISetState(@SW_SHOW)

;Main Script

;HARDCODED TO KEEP WINDOW OPEN!
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $MenuItem5
            $Save = FileSaveDialog("Save INI...", @SCRIPTDIR, "Configuration File (*.ini)|All (*.*)", 16, "PzB_Config.ini")
            IniWrite($Save, "Controls", "Input1", GUICtrlRead ( $Input1 ))
            IniWrite($Save, "Controls", "Input2", GUICtrlRead ( $Input2 ))
            IniWrite($Save, "Controls", "Radio1", GUICtrlRead ( $Radio1))
            IniWrite($Save, "Controls", "Radio2", GUICtrlRead ( $Radio2))
        
        Case $msg = $MenuItem4
            $LOAD = FileOpenDialog("Load Settings", "C:\", "Settings (*.ini)", 3 )
            GUICtrlSetData ( $Input1, IniRead ( $LOAD, "Controls", "Input1", "" ))
            GUICtrlSetData ( $Input2, IniRead ( $LOAD, "Controls", "Input2", "" ))
            GUICtrlSetData ( $Radio1, IniRead ( $LOAD, "Controls", "Radio1", "" ))
            GUICtrlSetData ( $Radio2, IniRead ( $LOAD, "Controls", "Radio2", "" ))
    EndSelect
WEnd

;Functions
Edited by weaponx

Share this post


Link to post
Share on other sites

Hello. I tried using this as an example for my program, but while using your program, I press the "save" button, and it brings up the FileSaveDialog, and even though it is supposed to save as .ini it only saves as .file unless i actually rename the file to a .ini. Is there anyway that it can automatically save as a .INI file?

Share this post


Link to post
Share on other sites

You do realize this topic is nearly 4 years old right?

I would suggest starting a new topic and explaining your problem in that rather than resurrecting such an old topic. Your question really has nothing to do with this topic other than the fact you used the example in it.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

I thought using an existing thread was better than making a new one. I used the search feature. :unsure:

Plus this is the problem I am having. It saves as .file instead of .ini. I need it to save as .ini always. :>

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  
Followers 0