Write to text file

Hello,
Brand new to OO.
I am starting to play with the sample plugins and would like to modify one [1] to write the content of the document to a text file.
I have seen calls such as “app.openForAccess” which no long seem to be accepted (tried in the console) nor visible in the API documentation.
I do realize OO does export to text but will need the functionality from within a script so I may apply some modification to the document prior to exporting.

Any advice?
Regards,
Philippe

[1]
com.omni-automation.oo.send-outline-as-text

Hi there, and welcome to the forums Philippe.

Sure, that is possible. If you look at FileWrapper class, you would find this method:

function write(url: URL, options: Array of FileWrapper.WritingOptions or null, originalContentsURL: URL or null)

Writes the FileWrapper to the given URL. NOTE: Any existing file or folder at the desination URL will be replaced. Care must be taken when developing scripts to avoid unintended data loss.

You could start there. Feel free to ask for further clarification.

openForAccess method has never been available in OmniAutomation API. Perhaps you are talking about JavaScript For Automation scripting interface, right ?

@unlocked2412 - Thank you. Not sure where I saw app.openForAccess - it seemed relevant at the time.
I will look at the FileWrapper class.
Regards,
Philippe

1 Like