Tips for Loading dictionary/record for use in bindings...

Hello,

So, I’d like to load a dictionary or PLIST (preferably from a URL, load the data, and use bindings to get it into the interface. I can then manipulate the data locally with AppleScript.

The question is this:

  1. How to load a record/dictionary/plist into memory (preferably from a URL) so that it can be used with bindigs(without using the user defaults system).

I’ve tried calling the method “dictionaryWithContentsOfURL:” but haven’t been successful.

Is there a way?

Thanks for the help.

Cheers,

Peter

Hi,

I haven’t figured it out yet, and haven’t been able to get a plist to load into an NSDictionary.

This is what I’m trying:

on clicked theObject
	set theResults to call method "dictionaryWithContentsOfFile:" of class "NSDictionary" with parameter "/Users/username/Desktop/a1.plist"
	set contents of text field "field" of window "main" to theResults
end clicked

I get an error “The variable theResults is not defined. (-2753)”. I’ve also tried it with a text view.

However, when I try the same with:

set theResults to call method "numberWithInt:" of class  "NSNumber" with parameter 10

… it works!
(example taken from Apple site)

http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ObjC_classic/Classes/NSDictionary.html

Anyone know how to load a plist into a dictionary object using applescript?

Thanks,

Peter