AutoHotkey Community

It is currently May 27th, 2012, 8:52 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 146 posts ]  Go to page 1, 2, 3, 4, 5 ... 10  Next
Author Message
PostPosted: July 24th, 2006, 11:20 pm 
Offline

Joined: March 28th, 2004, 3:53 pm
Posts: 1870
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
Image

Ini File Creator
Image

_________________
Image


Last edited by Rajat on September 3rd, 2006, 9:00 pm, edited 7 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 25th, 2006, 12:53 am 
Offline

Joined: July 20th, 2006, 6:41 pm
Posts: 144
Location: Los Angeles
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Error Message
PostPosted: July 25th, 2006, 1:04 am 
Offline

Joined: July 20th, 2006, 6:41 pm
Posts: 144
Location: Los Angeles
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 25th, 2006, 6:21 am 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
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
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 25th, 2006, 8:46 am 
Offline

Joined: July 12th, 2005, 1:21 pm
Posts: 633
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 ;)

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 25th, 2006, 11:00 am 
Offline

Joined: March 28th, 2004, 3:53 pm
Posts: 1870
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! :)

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! :)

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 25th, 2006, 1:23 pm 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
I created a mod. And over time it evolved.

See Rajat's first post for our joint work.

_________________
Ciao
toralf
Image


Last edited by toralf on July 31st, 2006, 9:16 pm, edited 14 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 25th, 2006, 8:37 pm 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
Added key types "file" and "folder", with functionality
Added key types "Float" and "Integer", with consistancy check

to the above script.

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 25th, 2006, 9:13 pm 
Offline

Joined: March 28th, 2004, 3:53 pm
Posts: 1870
wow toralf! you've greatly improved the function! (and made it too complicated for me to understand! ;) )

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

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 25th, 2006, 9:18 pm 
Offline

Joined: March 28th, 2004, 3:53 pm
Posts: 1870
by the way i've updated my function above to accept all chars including spaces too... though toralf has already beaten me to it! :)

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 25th, 2006, 9:22 pm 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
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
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 25th, 2006, 9:46 pm 
Offline

Joined: March 28th, 2004, 3:53 pm
Posts: 1870
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.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 25th, 2006, 9:50 pm 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
Added key types "DateTime" and "Hotkey" with their own controls
in above script

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 25th, 2006, 10:02 pm 
Offline

Joined: March 28th, 2004, 3:53 pm
Posts: 1870
man u're fast!

next request:
- a button, when pressed gives me 100 bucks

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 25th, 2006, 11:29 pm 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
Code:
BtnRajat:
  MsgBox, Paypal wires you 100 Bucks
Return
Something like this?

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 146 posts ]  Go to page 1, 2, 3, 4, 5 ... 10  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: tomoe_uehara, Xx7 and 10 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group