Hi, I’ve got a script that backs up my draft (by duplicating it) then runs some replacements using the below script:
editor.setText(editor.getText().split("\n").join("
"));
editor.setText(editor.getText().split(""").join("\""));
editor.setText(editor.getText().split("’").join("’\’’"));
draft.update();
It then runs some more script to generate my child’s age and prepends that to the draft. I believe the relevant part of that script is:
draft.content = “(” + dtDiff[‘years’] + " years, " + dtDiff[‘months’] + " months, and " + dtDiff[‘days’] + " days" + ") " + draft.content;
draft.update();
//Reactivate the editor
editor.activate();
The problem is that the two parts of the script function on different drafts. The first one runs on the duplicated version of the draft, the second half on the original draft. I don’t know enough about scripting here to figure out how to make it function on just one. Any ideas?