AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Plug'n'Play GUI Settings Editor for your scripts (Version 6)
Goto page 1, 2, 3, 4, 5, 6, 7, 8, 9, 10  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
Rajat



Joined: 28 Mar 2004
Posts: 1717

PostPosted: Mon Jul 24, 2006 11:20 pm    Post subject: Plug'n'Play GUI Settings Editor for your scripts (Version 6) Reply with quote

This function is now a joint effort by me and toralf

Background:
I made a script that was to be used by others. It saved its settings in a .ini file but to configure it I didn't create a GUI (why... coz its too much work, and one might as well use notepad to edit a damn ini file!). But i recd requests from friends that its too geeky to edit settings in notepad and they're having trouble so i should give them a better user interface! (damn!)

So instead of building a simple settings editor in that script I went the loooong waaaay... I made a function that can be just plugged into any script that saves its options in a .ini and you'll get an instant Settings Editor GUI !!

Ok, that was the background... (i know you didn't ask for it, but bear with me)


Back to Current Day:
toralf made wonderful improvements to the original function and took it to newer heights and added many features to it. Then i did some mods to it and then he modded my mod which was originally his mod which in turn was my original script. (blah.. blah)

Anyways, today we have a great working function that can easily be plugged into any script that saves its settings in a .ini file, and it has an instant Settings/Options window (screenshot below). And it doesn't use a single global variable (that was the tricky part for me!), so its completely compatible with any script.

Ini Editor:
Also, toralf made a very nice editor for .ini files (screenshot below), to be used specifically with the above function. Though any .ini can be directly used with the function without any modification, this editor enables you to avail some great features of the function.


Downloads:
(Usage instructions in the function file)
Ini Settings Editor Function Version 6
Ini File Creator Version 8 (requires Anchor 3.3)


Screenshots:

Ini Editor Function


Ini File Creator

_________________


Last edited by Rajat on Sun Sep 03, 2006 9:00 pm; edited 7 times in total
Back to top
View user's profile Send private message
Kerry



Joined: 20 Jul 2006
Posts: 146
Location: Los Angeles

PostPosted: Tue Jul 25, 2006 12:53 am    Post subject: Reply with quote

Wow, that's perfect, I was thinking I might have to do something like this myself, just started to use INI's pretty frequently, and trying to make my programs as simple as possible of the computer illiterate, and this will be perfect! haven't tested it yet but will very shortly!

Thank you,
Kerry
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Kerry



Joined: 20 Jul 2006
Posts: 146
Location: Los Angeles

PostPosted: Tue Jul 25, 2006 1:04 am    Post subject: Error Message Reply with quote

Hey, I got an error while trying to use:

Error: This variable or function name contains an illegal character. The Current Thread Will Exit

IDInstallation Options
ID%CurrSec% := TV_Add(CurrSec)

any suggestions?

EDIT:

The error is that it doesn't like sections with spaces between them, don't know how to fix this myself, nor if you want to go through the trouble to do so.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
toralf



Joined: 31 Jan 2005
Posts: 3842
Location: Bremen, Germany

PostPosted: Tue Jul 25, 2006 6:21 am    Post subject: Reply with quote

Thanks, that is a wonderful idea. I was creating the settings dialog for my GUIs always from scratch. This will make a lot of things easier. I'll take a look at the code later. Thanks for sharing.
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Thalon



Joined: 12 Jul 2005
Posts: 640

PostPosted: Tue Jul 25, 2006 8:46 am    Post subject: Reply with quote

Nice idea!
And yes, I love you ;D

I have only two possible improvement for reliability:

1)
You should use "Gui, Destroy" instead of "Gui, Submit".
The reason why should be clear after this lines of code:
Code:
EditSettings("Rajat", A_ScriptDir . "\test.ini")
msgbox
EditSettings("Rajat", A_ScriptDir . "\test.ini")
This causes a wonderfull new style for your GUI Wink

2)
You could replace
Code:
;a Gui that would probably not exist in parent script
   Gui, 54:Default
by something like this:
Code:
   Loop, 86
   {
      Index := A_Index + 12       ;overjumps the first few normally used GUI-Numbers...
      Gui %Index%:+LastFoundExist
      IfWinNotExist
      {
         Gui, %Index%:Default
         break
      }
   }
But this may also cause problems with later appearing Sub-Windows...

Thalon
_________________
AHK-Icon-Changer
AHK-IRC
deutsches Forum
SacredVault
Back to top
View user's profile Send private message
Rajat



Joined: 28 Mar 2004
Posts: 1717

PostPosted: Tue Jul 25, 2006 11:00 am    Post subject: Reply with quote

Kerry,
spaces did occur to me while making this but i only thought about keys, and they probably don't support spaces so i thought no problem... but thanks for bringing this to my notice. i first thought of useing my Hex2Asc / Asc2Hex to fix spaces but now i've thought of a better approach that just might work... keep watching ths space! Smile

Thalon,
hey that Gui Destory thing is really good, thanks for that! and about the other tip, it might (as u've already mentioned) mess with future GUIs in script so i guess i'll be sticking with Gui, 54! Smile
_________________
Back to top
View user's profile Send private message
toralf



Joined: 31 Jan 2005
Posts: 3842
Location: Bremen, Germany

PostPosted: Tue Jul 25, 2006 1:23 pm    Post subject: Reply with quote

I created a mod. And over time it evolved.

See Rajat's first post for our joint work.
_________________
Ciao
toralf


Last edited by toralf on Mon Jul 31, 2006 9:16 pm; edited 14 times in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
toralf



Joined: 31 Jan 2005
Posts: 3842
Location: Bremen, Germany

PostPosted: Tue Jul 25, 2006 8:37 pm    Post subject: Reply with quote

Added key types "file" and "folder", with functionality
Added key types "Float" and "Integer", with consistancy check

to the above script.
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Rajat



Joined: 28 Mar 2004
Posts: 1717

PostPosted: Tue Jul 25, 2006 9:13 pm    Post subject: Reply with quote

wow toralf! you've greatly improved the function! (and made it too complicated for me to understand! Wink )

for supporting spaces i'd also thought of using IDs instead of names to make variable names. i've not yet seen what've u used to replace the 0.5s sleep.

by the way for future enhancements:
- i don't think editing desc/key/section is reqd, as i've not yet seen an app that allows to 'ADD' options to it, instead of modifying them.
- adding support for date and hotkey controls could be useful
_________________
Back to top
View user's profile Send private message
Rajat



Joined: 28 Mar 2004
Posts: 1717

PostPosted: Tue Jul 25, 2006 9:18 pm    Post subject: Reply with quote

by the way i've updated my function above to accept all chars including spaces too... though toralf has already beaten me to it! Smile
_________________
Back to top
View user's profile Send private message
toralf



Joined: 31 Jan 2005
Posts: 3842
Location: Bremen, Germany

PostPosted: Tue Jul 25, 2006 9:22 pm    Post subject: Reply with quote

Rajat wrote:
wow toralf! you've greatly improved the function! (and made it too complicated for me to understand! ;) )
Common Rajat, you started this, I had to digest your code first. And it is as always excellent. You'll get it, I'm sure.

Rajat wrote:
for supporting spaces i'd also thought of using IDs instead of names to make variable names. i've not yet seen what've u used to replace the 0.5s sleep.
It is only the order when the code breaks the loop if the GUI is closed. Your code left the loop before the sleep. By accident I closed the GUI during the sleep, the next lines tried to get the value which was nothing since the GUI was closed and wrote an empty value to the ini. No the loop is left after the sleep.

Rajat wrote:
by the way for future enhancements:
- i don't think editing desc/key/section is reqd, as i've not yet seen an app that allows to 'ADD' options to it, instead of modifying them.
- adding support for date and hotkey controls could be useful
I agree. I was thinking to be able to build an ini with this during coding. But it will make the code much more complex. I guess the INI was to be written by hand or with a mod of Titans VisualIni script.

The date and hotkey key parameters are a good idea, but how to do a consitancy check? Maybe replace the Edit control with a date and hotkey control?!?
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Rajat



Joined: 28 Mar 2004
Posts: 1717

PostPosted: Tue Jul 25, 2006 9:46 pm    Post subject: Reply with quote

yeah the edit control can be hidden for these value types and the hotkey and calender controls can be un-hidden just like the Browse button.
_________________
Back to top
View user's profile Send private message
toralf



Joined: 31 Jan 2005
Posts: 3842
Location: Bremen, Germany

PostPosted: Tue Jul 25, 2006 9:50 pm    Post subject: Reply with quote

Added key types "DateTime" and "Hotkey" with their own controls
in above script
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Rajat



Joined: 28 Mar 2004
Posts: 1717

PostPosted: Tue Jul 25, 2006 10:02 pm    Post subject: Reply with quote

man u're fast!

next request:
- a button, when pressed gives me 100 bucks
_________________
Back to top
View user's profile Send private message
toralf



Joined: 31 Jan 2005
Posts: 3842
Location: Bremen, Germany

PostPosted: Tue Jul 25, 2006 11:29 pm    Post subject: Reply with quote

Code:
BtnRajat:
  MsgBox, Paypal wires you 100 Bucks
Return
Something like this?
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page 1, 2, 3, 4, 5, 6, 7, 8, 9, 10  Next
Page 1 of 10

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group