JustOneBren,
It is wrong. Implement the code you want to do in the while block.
Try to understand it because it shows more concrete code.
var n = 0;
var doc = app.documents.add();
var tf = doc.textFrames.add();
tf.geometricBounds = doc.pages[0].bounds;
tf.parentStory.pointSize = 3;
//Continue processing the contents of the while block until you press the shift key
while (ScriptUI.environment.keyboardState.shiftKey == false) {
tf.contents += "press shift key to stop the script.\t";
tf.recompose();
}
I was also wrong, and my Mac was able to abort with the esc key. The final form of the code.
At least ' keyCode == "esc" ' didn't work in my environment.
var n = 0;
var doc = app.documents.add();
var tf = doc.textFrames.add();
tf.geometricBounds = doc.pages[0].bounds;
tf.parentStory.pointSize = "6pt";
//Continue processing the contents of the while block until you press the esc key
while (ScriptUI.environment.keyboardState.keyName != "Escape") {
tf.contents += "press esc key to stop the script.\t";
tf.recompose();
}