Reading a text file

Hi All,

I want to develop a script like reading INI concept. Below is the format of TEXT file.

I want to take all values in a variable, like I want 10 in a var_Resolution, BLACK in var_Color etc. How can i do it, pleas suggest me.

Below the code upto what I have done.

tell application "Finder"
	set myFile to (choose file with prompt "Select INI file" of type {"TEXT"})
	open for access myFile
	set myFileContents to read myFile
	set TOT to get count of lines
	close access myFile
end tell



something like this

set myFile to (choose file with prompt "Select INI file" of type {"public.plain-text"})
set myFileContents to paragraphs of (read myFile)
-- set TOT to get count of lines
set a to {}
set {TID, text item delimiters} to {text item delimiters, "="}
repeat with i in myFileContents
	set end of a to word 1 of text item 2 of i
end repeat
set text item delimiters to TID
set {var_Resolution, var_Color, var_Type} to a

Hi Stefan
Thanks a lot, but the script is not working showing some errors of


The error occurs, if there is no equals sign in the string


I have given the equal sign in the file. But I don’t know why it occurs

The script parses all paragraphs of the file.
If there is at least one paragraph without an equals sign, the error occurs

Oh Gr8

Thanks, yes it was my fault, I have given one extra enter.