A working script for the catch and replace issue:
Notification(Constants.FA_Note_PreFunction);
function Notify(note, object, sparam, iparam) {
switch (note) {
case Constants.FA_Note_PreFunction:
if (sparam=="z") {
var tl=app.ActiveDoc.AddText(app.ActiveDoc.TextSelection.beg,"y");
var tr= new TextRange(tl, tl);
app.ActiveDoc.ScrollToText(tr);
ReturnValue(Constants.FR_CancelOperation);
}
break;
}
}
It is not perfect, but it works just fine (at least when you are not typing too fast, i.e. on a normal user typing rate).
But there is still the issue with the iparam that always returns an invalid object (alert(iparam) says "[object InvalidObject]").
And how do I execute an f-code like "pressing" the tab-key, when the user presses an arrow key?