how to read INI Files in Applescript Studio

Hi all …

I do a lot of cross platform work, and I’m porting a Windows project I’ve made over to the mac …

On Windows, a very common way of storing data is in INI files… I know over on the mac side we’re a bit more posh and we use XML , but is there a way of reading INI files into AS?

I would be surprised if there wasn’t some kind of pre-scripted class or something we could just pop in to our projects …

For those of you who don’t know what INI files look like, the data layout looks like this:

As you can see, it’s a lot easier to read and understand than XML, and in a lot of cases would suit smaller projects way better.

Thanks for any info guys!

-Mel

mmm, INI is strictly windows so I’m not thinking so, but there may be some sort of plug in…who knows

Hi melligeorgiou,

Whenever I need to read INI files on the Mac, I am using Python’s ConfigParser module. Of course, you can also rewrite it in AppleScript, but its rather painful as AppleScript does not support dictionaries containing key-value pairs.

Looking at the general outline of the INI format, isn’t it possible to write custom functions in applescript studio to parse the appropriate values?

I’m sure it’s possible, but my applescript skills aren’t what they should be just yet …

I’ll probably try my luck at it at some point…

-Mel