User to user discussion and support for UltraEdit, UEStudio, UltraCompare, and other IDM applications.

Help with writing and running scripts
3 posts Page 1 of 1
UltraEdit Professional Text/HEX Editor
Version 23.00.0.59

I use the menu "Advanced->Play Script" to run the JavaScript "jsFormatPlus.js". (This script can format the selected JavaScript code.)

If the reformatted JavaScript code is more than about 2300 lines, UltraEdit.activeDocument.write(code); fails to overwrite the existing selection in active file.

Please see attachment for the script file and the example code file.

Attachments

This is indeed an interesting issue. I could reproduce the wrong behavior on writing the large block into active file with overwriting existing selection also with UE v22.20.0.39 on Windows XP. I suggest to report this issue by email to IDM support as this is obviously a bug in code of UltraEdit.

But I have also good news for you. There is a workaround which I use in my scripts always for writing large text blocks into a file as being faster than using write command.

Replace in your script the 2 lines

Code: Select all
  code = js_beautify(base_code);
  UltraEdit.activeDocument.write(code);

by the following lines

Code: Select all
  var nActiveClipboard = UltraEdit.clipboardIdx;
  UltraEdit.selectClipboard(9);
  UltraEdit.clipboardContent = js_beautify(base_code);
  UltraEdit.activeDocument.paste();
  UltraEdit.clearClipboard();
  UltraEdit.selectClipboard(nActiveClipboard);

The large block is now pasted via user clipboard 9 into the file replacing the existing selection which works always. The contents of active clipboard is not modified except the active clipboard is user clipboard 9 and reselected before exiting the script.
Best regards from Austria
Thanks
it works well
I will report this bug to IDM support.
3 posts Page 1 of 1