One more bug. Select a text box, execute the following code, undo, then execute it again.
(Works fine when there isn't a carriage return in the string.)
var textbox=activeDocument.selectedItems[0]; textbox.range.content="testr";
I get a spinning beachball for a while, and then it outputs the following error to the console:
Wrapped java.lang.NullPointerException (/Users/synch/Desktop/stuff/Code & Research/New Scriptographer scripts/test.js#2)
java.lang.NullPointerException
at java.util.StringTokenizer.(StringTokenizer.java:146)
at com.scriptographer.ai.TextRange$TokenizerList.adjustEnd(TextRange.java:493)
at com.scriptographer.ai.TextRange.adjustEnd(TextRange.java:163)
at com.scriptographer.ai.TextRange.append(TextRange.java:173)
at com.scriptographer.ai.TextRange.setContent(TextRange.java:193)
at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:142)
at org.mozilla.javascript.JavaMembers.put(JavaMembers.java:142)
at org.mozilla.javascript.NativeJavaObject.put(NativeJavaObject.java:114)
at org.mozilla.javascript.ScriptableObject.putProperty(ScriptableObject.java:1396)
at org.mozilla.javascript.ScriptRuntime.setObjectProp(ScriptRuntime.java:1432)
at org.mozilla.javascript.ScriptRuntime.setObjectProp(ScriptRuntime.java:1422)
at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:2824)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2250)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:149)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:337)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2755)
at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:160)
at com.scriptographer.ScriptographerEngine.executeScript(ScriptographerEngine.java:252)
at com.scriptographer.ScriptographerEngine.executeFile(ScriptographerEngine.java:299)
at com.scriptographer.ai.Tool.setScript(Tool.java:66)
at com.scriptographer.gui.MainDialog$ToolButton.onClick(MainDialog.java:285)
at com.scriptographer.adm.Button.onNotify(Button.java:75)
at com.scriptographer.adm.NotificationHandler.onNotify(NotificationHandler.java:55)
java.lang.NullPointerException
at com.scriptographer.ai.Tool.setScript(Tool.java:68)
at com.scriptographer.gui.MainDialog$ToolButton.onClick(MainDialog.java:285)
at com.scriptographer.adm.Button.onNotify(Button.java:75)
at com.scriptographer.adm.NotificationHandler.onNotify(NotificationHandler.java:55)