OO-PG0005
Plug-In: Send Outline as Text
This plug-in will create a new outgoing email message whose contents is the revealed outline elements as plain text with tab indents.
Return to: OmniOutliner Plug-In Collection
Send Outline as Text
/*{
"type": "action",
"targets": ["omnioutliner"],
"author": "Otto Automator",
"identifier": "com.omni-automation.oo.send-outline-as-text",
"version": "1.1",
"description": "This plug-in will create a new outgoing email message whose contents is the revealed outline elements as plain text with tab indents.",
"label": "Send Outline as Text",
"shortLabel": "Send as Text",
"paletteLabel": "Send as Text",
"image":"envelope.fill"
}*/
(() => {
const action = new PlugIn.Action(async function(selection, sender){
// action code
// selection options: columns, document, editor, items, nodes, outline, styles
try {
baseName = document.name
fileTypeID = "public.plain-text"
wrapper = await document.makeFileWrapper(baseName, fileTypeID)
var email = new Email()
email.subject = `Contents of “${baseName}”`
email.body = wrapper.contents.toString()
email.generate()
}
catch(err){
new Alert(err.name, err.message).show()
}
});
action.validate = function(selection, sender){
// validation code
// selection options: columns, document, editor, items, nodes, outline, styles
return true
};
return action;
})();