An error of type -116 has occurred. - ????

Well, hi folks!

I got a somewhat strange error while processing a plist file with AppleScript.

I don’t know which information would be relevant (it’s an extremely long script) but maybe this is enough:

  • I’m storing the plist file’s contents within a variable by executing a shellscript with the “more” command.
  • then I’m cleaning the text within this variable with some item delimiter functions of TABs, RETURNs and 0-characters.
  • after that, I store each line of text in an array.
  • then I’m scanning for information I want to extract and store these in other variables.

For the last part I use a repeat loop. But this will give me an error while processing the very last line of text. Strange.

I already made use of a “try” statement - with no effect. And that’s what I don’t understand.



-- linelist contains the text from the plist file. it's an array with one element for each line of text

set textscan to true
set line_num to 0

repeat while textscan
	set line_num to line_num + 1
	
	try
		set this_line to item line_num of linelist
	on error
		display dialog "exiting at " & line_num & " of " & length of linelist & " rows"
		exit repeat
	end try

The whole try/on error/end try statement will be highlighted by Script Editor and I get the alert: “An error of type -116 has occurred.”

Shouldn’t the error handler be invoked when an error occures???

I hope somebody can help me!

Thank you very much!

—CTE—

How did you identify a ‘line’ ?

Error -116 memSCErr Size Check failed

There’s something the matter with your ‘line’, and your ‘try’ block didn’t respond because it isn’t an AppleScript error - it’s a system error. AppleScript Errors have much higher numbers.

Why aren’t you using one of the available XML tools to parse the .plist file?

Thanks for the reply! :slight_smile:

My definition of a ‘line’ is a line of text in the xml file - meaning a line seperated by a LF/CR character.
Like in:

_name

That would be three lines.

Strange though, that this is a system error…
I built a list containing an element for each line of the xml file. Then I’m doing a repeat loop to process the list.
Meanwhile I found the mistake by myself :rolleyes: “ I was trying to access an item exceeding the maximum count of items inside the list.
But shouldn’t this trigger an AppleScript Error instead of a System Error???

Well, for the XML tools… I downloaded an OSAX but didn’t get along with it. Seemed too complicated for me. Others might think (if looking at my script) that I’m the one who did it too complicated… :wink: That’s the way I am. Complicated - but in a “different” way…

—CTE—

Glad you found your error. If your way works for you that’s great - I too find XMLTools a bit unfriendly.