Sign in to follow this  
Followers 0
alien13

ComboBox, help needed!

7 posts in this topic

Hello,

I was wondering if it is possible to make a Profile Selector using the ComboBox?

What I mean by Profile Selector is, I want users to be able to make different profiles eg: Gaming, General, etc. and using the ComboBox load these profiles.

Here is my program so you know what my program actually is (Source Included)

Basically:

Users go to Setup, choose their programs and click save, it then asks what to save the .ini file as (Under the Profiles Folder).

When they do this, the .ini file (eg. Gaming.ini), is added to the ComboBox list with the name it was saved as.

When they want to use a different profile, they go to profiles, select one and click set and it reads from that .ini file.

If this is possible, I have a few questions:

How do I make the save button open a save dialog to save the .ini file?

How would I make the ComboBox list read the .ini files?

I think I know how to make it read the selected profile .ini file, but a hint would be good =)

I'm not asking for someone to do all this for me but rather just point me in the right direction for the above questions. I'd rather learn then have someone do it all for me and not know how it was done :)

Thanks for any replies, and let me know if the aboves is confusing and I'll try to re-word it =)

Thanks alien13 :whistle:


Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Well

IniRead

IniWrite

FileOpenDialog

And some dir-listning.. cant remember what to use here...

And I would not let the user choose the saving folder.. have a basic folder to all your ini files... (would be easier)

Edited by Shevilie

Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hey,

Sorry for the very late reply. I have been busy with my school work.. essays, assignments, etc. =(

Thanks for the help. I have a few questions.

How do I make it so users can only save under the profiles folder?

Right now the code for the saving feature is

FileSaveDialog("Please select a name for your profile.", @ScriptDir & "\Launcher Files\Profiles\","ini Files (*.ini)", 1 + 2)

At the moment I'm thinking this is going to be a little bit too complicated for me, but I'll just wait and see =)

Thanks for the help.

Alien13 =)

Edited by alien13

Share this post


Link to post
Share on other sites

Well if they must save in a specifik folder then make a while loop like this

While 1
   $savename = FileSaveDialog("Please select a name for your profile.", @ScriptDir & "\Launcher Files\Profiles\","ini Files (*.ini)",  2)
   If StringInStr($savename, @ScriptDir & "\Launcher Files\Profiles\") Then
      ExitLoop
   Else
      MsgBox(0,0,"You have to save in: " & @ScriptDir & "\Launcher Files\Profiles\")
   EndIf
WEnd

Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Thanks for the reply =)

I'm wondering If I am going to be able to do this. It seems like alot of work to do I have to do the following:

When the user saves a profile I have to make it write a new ini file. My original code with the added save dialog is:

Func OKButton()
While 7
   $savename = FileSaveDialog("Please choose a name for your profile.", @ScriptDir & "\Launcher Files\Profiles\","ini Files (*.ini)",  2)
   If StringInStr($savename, @ScriptDir & "\Launcher Files\Profiles\") Then
      ExitLoop
   Else
      MsgBox(0,0,"Please save in: " & @ScriptDir & "\Launcher Files\Profiles\")
   EndIf
WEnd
    IniWrite(@ScriptDir & [b]"\Launcher Files\Profiles\Config.ini"[/b], "Launch", "1", GUICtrlRead($Browser))
    Iniwrite(@ScriptDir & "\Launcher Files\Profiles\Config.ini", "Launch", "2", GUICtrlRead($Program_1))
    IniWrite(@ScriptDir & "\Launcher Files\Profiles\Config.ini", "Launch", "3", GUICtrlRead($Program_2))
    IniWrite(@ScriptDir & "\Launcher Files\Profiles\Config.ini", "Launch", "4", GUICtrlRead($Program_3))
    IniWrite(@ScriptDir & "\Launcher Files\Profiles\Config.ini", "Launch", "5", GUICtrlRead($Program_4))
    IniWrite(@ScriptDir & "\Launcher Files\Profiles\Config.ini", "Launch", "6", GUICtrlRead($Program_5))
    IniWrite(@ScriptDir & "\Launcher Files\Profiles\Config.ini", "Label", "1", GUICtrlRead($Label_1a))
    IniWrite(@ScriptDir & "\Launcher Files\Profiles\Config.ini", "Label", "2", GUICtrlRead($Label_2a))
    IniWrite(@ScriptDir & "\Launcher Files\Profiles\Config.ini", "Label", "3", GUICtrlRead($Label_3a))
    IniWrite(@ScriptDir & "\Launcher Files\Profiles\Config.ini", "Label", "4", GUICtrlRead($Label_4a))
    IniWrite(@ScriptDir & "\Launcher Files\Profiles\Config.ini", "Label", "5", GUICtrlRead($Label_5a))
    GUICtrlSetData ($Labels1, GUICtrlRead ($Label_1a))
    GUICtrlSetData ($Labels2, GUICtrlRead ($Label_2a))
    GUICtrlSetData ($Labels3, GUICtrlRead ($Label_3a))
    GUICtrlSetData ($Labels4, GUICtrlRead ($Label_4a))
    GUICtrlSetData ($Labels5, GUICtrlRead ($Label_5a))
    MsgBox(64, "Setup", "Setup is complete. Please restart for changes to take effect.")
EndFunc ;==>OKButton

Right now I can't think of a way to make it read the newly saved files name so It can write the information to the ini file. (The section with the bold signs need to be set so it reads the saved files name, which I'm unsure of at the moment)

I need it to make the setup window read the correct profile, make the combobox list the ini files in the "profiles" folder, and make the program read the right profile.

I think Ill try again tomorrow once I'm rested =)

Once again thanks for the reply shevilie!

alien13

Edited by alien13

Share this post


Link to post
Share on other sites

Well on startup, the user should have a opendialog to choose his settings (i guess it is)


Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Ahh, yeah. Thats a good idea. Thanks :whistle:

[EDIT] Yeah, the profiles are basically program setups that the has user made.

EG:

General could include : bittorrent, CCleaner, notepad, AutoIt and mIRC

Gaming could be: WoW, GW, Oblivion, SW:G and Pac Man.

This saves them the trouble of changing the programs all the time, instead they just select that ini file and it loads those settings.

[EDIT] Is there a way to get the file name (*.ini) from the FileSaveDialog?

Here is the code:

While 7
   $savename = FileSaveDialog("Please choose a name for your profile.", @ScriptDir & "\Launcher Files\Profiles\","ini Files (*.ini)",  2)
   If StringInStr($savename, @ScriptDir & "\Launcher Files\Profiles\") Then
      ExitLoop
   Else
      MsgBox(0,0,"Please save in: " & @ScriptDir & "\Launcher Files\Profiles\")
   EndIf
WEnd

    IniWrite(@ScriptDir & "\Launcher Files\Profiles\Config.ini", "Launch", "1", GUICtrlRead($Browser))
    Iniwrite(@ScriptDir & "\Launcher Files\Profiles\Config.ini", "Launch", "2", GUICtrlRead($Program_1))
    IniWrite(@ScriptDir & "\Launcher Files\Profiles\Config.ini", "Launch", "3", GUICtrlRead($Program_2))
    IniWrite(@ScriptDir & "\Launcher Files\Profiles\Config.ini", "Launch", "4", GUICtrlRead($Program_3))
    IniWrite(@ScriptDir & "\Launcher Files\Profiles\Config.ini", "Launch", "5", GUICtrlRead($Program_4))
    IniWrite(@ScriptDir & "\Launcher Files\Profiles\Config.ini", "Launch", "6", GUICtrlRead($Program_5))
    IniWrite(@ScriptDir & "\Launcher Files\Profiles\Config.ini", "Label", "1", GUICtrlRead($Label_1a))
    IniWrite(@ScriptDir & "\Launcher Files\Profiles\Config.ini", "Label", "2", GUICtrlRead($Label_2a))
    IniWrite(@ScriptDir & "\Launcher Files\Profiles\Config.ini", "Label", "3", GUICtrlRead($Label_3a))
    IniWrite(@ScriptDir & "\Launcher Files\Profiles\Config.ini", "Label", "4", GUICtrlRead($Label_4a))
    IniWrite(@ScriptDir & "\Launcher Files\Profiles\Config.ini", "Label", "5", GUICtrlRead($Label_5a))
    GUICtrlSetData ($Labels1, GUICtrlRead ($Label_1a))
    GUICtrlSetData ($Labels2, GUICtrlRead ($Label_2a))
    GUICtrlSetData ($Labels3, GUICtrlRead ($Label_3a))
    GUICtrlSetData ($Labels4, GUICtrlRead ($Label_4a))
    GUICtrlSetData ($Labels5, GUICtrlRead ($Label_5a))
    MsgBox(64, "Setup", "Setup is complete. Please restart for changes to take effect.")
EndFunc ;==>OKButton

So what I want to do is get the name of the .ini file the user has saved and place it here: (In red)

CODE

IniWrite(@ScriptDir & $iniSaveName, "Launch", "1", GUICtrlRead($Browser))

Iniwrite(@ScriptDir & $iniSaveName, "Launch", "2", GUICtrlRead($Program_1))

IniWrite(@ScriptDir & $iniSaveName, "Launch", "3", GUICtrlRead($Program_2))

IniWrite(@ScriptDir & $iniSaveName, "Launch", "4", GUICtrlRead($Program_3))

IniWrite(@ScriptDir & $iniSaveName, "Launch", "5", GUICtrlRead($Program_4))

IniWrite(@ScriptDir & $iniSaveName, "Launch", "6", GUICtrlRead($Program_5))

IniWrite(@ScriptDir & $iniSaveName, "Label", "1", GUICtrlRead($Label_1a))

IniWrite(@ScriptDir & $iniSaveName, "Label", "2", GUICtrlRead($Label_2a))

IniWrite(@ScriptDir & $iniSaveName, "Label", "3", GUICtrlRead($Label_3a))

IniWrite(@ScriptDir & $iniSaveName, "Label", "4", GUICtrlRead($Label_4a))

IniWrite(@ScriptDir & $iniSaveName, "Label", "5", GUICtrlRead($Label_5a))

Edited by alien13

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