TeXstudio macro script : how to move the cursor to specified position?

386 Views Asked by At

For example, I want to write the following macro in script in TeXstudio(using QtScript):

%SCRIPT   
editor.write("\\textcolor{red}{}")

After invoking this macro, I want the cursor to move into the second pair of curly braces automatically. How can I modify my code to achieve the desired effect?

1

There are 1 best solutions below

0
On BEST ANSWER
%SCRIPT
txt = "\\textcolor{red}{}"
cursor.insertText(txt)
cursor.movePosition(1,cursorEnums.Left)