AutoHotkey Community

It is currently May 27th, 2012, 1:04 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 

Do you really want this on AHK?
Obviously yes
Bah no
i dont care
Its not obvious? YES!!
That idea sucks
You may select 1 option

View results
Author Message
PostPosted: December 28th, 2011, 9:25 pm 
Offline

Joined: December 2nd, 2011, 4:41 pm
Posts: 57
Why no adding a new loop: ini-reading loop. for example:
Code:
[Section1]
Key1=New key
Key2=Other key
[Section2]
Key1=Another key
Key2=And other more


so with loop (ini reading) do, for example:
Code:
Loop,ini,config.ini,Section1
{
Msgbox % A_Loopfield ;will output "New key" and then "Other Key"
}
Loop,ini,config.ini
{
Msgbox % A_Loopfield ;will output "Section1" and then "Section2"
}


Image (its just my vote)

_________________
http://www.autohotkey.net/~iBob35555VR << help me creating better graphics! :P post suggestions in "Leave a comment". Thanks


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 28th, 2011, 10:44 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
:?:
Code:
/*
[Section1]
key1=1
key2=2
key3=3

[Section2]
...
*/
IniRead,Section1,% A_ScriptFullPath,Section1
Loop,Parse,Section1,`n,`r
   MsgBox % A_LoopField

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 29th, 2011, 1:15 am 
Even in AHK basic, this is easily accomplished by adding a few bells & whistles to a regular parsing loop. Obviously, AHK-L lets you read a list of sections, then whole sections at a time, making everything that much simpler.

Also, putting a poll on a thread that you don't intend to use directly is one of my pet peeves. I find it obnoxious and simple-minded to assume that 'votes' will add weight to your wish.

If you have a wish, explain it, state the merits/uses of it, and invite others to share thoughts.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 29th, 2011, 8:05 pm 
Offline
User avatar

Joined: May 10th, 2007, 10:54 am
Posts: 649
Location: .switzerland
A language should not contain too much very detailed/problem-specific syntax sugars, instead the syntax should be general and abstract to allow those loops easily.

As we have now kind of a For-Each Loop, all "Iterate over all items"-Tasks can be written like:

A good example is the File-Loop, a nice replacement would look like:
Code:
for each, file in File.GetFiles("C:\MyFolder\.*")
{
  msgbox % "Found a file: " file
}


Same for the ini; eg:

Code:
for each, sectionName in Ini.GetSectionNames("C:\MyFolder\settings.ini")
{
  msgbox % sectionName ; show all section names
}


The only question is, if the Ini/File Classes are shipped directly with AHK, or if they are to specific.

_________________
http://securityvision.ch
AHK 2D GAME ENGINE


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 1st, 2012, 2:07 pm 
Offline

Joined: October 13th, 2009, 10:09 pm
Posts: 1389
I think that things like these could be added to the standard library.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 3 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