I am long-time user of omnigraffle who is new to automation and JavaScript. I would like to load a text file and parse the contents, which are needed to lay out a diagram. I think that what I want is to create a URL that points to the text file, use the fetch function on it, and give it a callback function to parse the data, so something like
fileURL = URL.choose([‘public.text’])
fileURL.fetch( parseTextFile )
function parseTextFile( data ) {…}
but I can’t figure how to parse the object ‘data’ inside the function parseTextFile. Since fileURL is just pointing to a text file, I would have expected data to just be a string with the file contents. All the examples of using fetch on the omni-automation webpage involve accessing images…