3
$\begingroup$

I'm trying to create a presentation that will demonstrate the use of RobotTools. I'm able to get everything to work, but am not sure how to go about formatting text that is typed into a notebook (e.g., bold, italics, etc.). Here's a screenshot from what I've created so far. As an example of what I need to do, how would I italicize "GIF" in the second KeyType line? Any help would be much appreciated!

Needs["RobotTools`"]

nb = CreateDocument[{}, Evaluator -> "Local"]

KeyType[nb, "How would I italicise this text?"]

enter image description here

$\endgroup$
1
  • $\begingroup$ What is robottools? I am not finding it in the Mathematica documentation. $\endgroup$
    – John
    Commented Aug 16, 2022 at 22:17

1 Answer 1

3
$\begingroup$

One way that you can do this is simply sending the typed keyboard shortcut for italics (Command-I)

KeyType[nb,"Creating a  \[CommandKey]\[LeftModified]i\[RightModified]Notebook in italics\[CommandKey]\[LeftModified]i\[RightModified] and now not anymore"]

enter image description here

It looks as though RobotTools has support for using menu items as well, so you might be able to do it that way.

NotebookWrite might be useful for your purposes as well considering you can give pre-formatted cells to it.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.