QOwnNotes/docs/scripting/examples/execute-command-after-note-update.qml

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

23 lines
773 B
QML
Raw Normal View History

2016-05-12 11:44:29 +02:00
import QtQml 2.0
/**
* This script will execute an external program every time a note was written to the disk
*/
QtObject {
/**
* This function is called when a note gets stored to disk
2016-05-14 07:19:46 +02:00
* You cannot modify stored notes, that would be a mess since
* you are most likely editing them by hand at the same time
2016-05-12 11:44:29 +02:00
*
2017-05-20 11:24:18 +02:00
* @param {Note} note - the note object of the stored note
2016-05-12 11:44:29 +02:00
*/
2017-01-11 17:15:35 +01:00
function onNoteStored(note) {
2016-05-12 11:44:29 +02:00
// execute an external program
// try not to alter the note file or QOwnNotes will try to update
// the file every time you change the note
2017-01-11 17:15:35 +01:00
script.startDetachedProcess("/path/to/my/program", [note.fileName]);
2016-05-12 11:44:29 +02:00
2017-01-11 17:15:35 +01:00
script.log("program was executed for file: " + note.fileName);
2016-05-12 11:44:29 +02:00
}
}