1

I created this macro to replace a specific word with another word in the current document, but ideally, I want to replace it with clipboard content. My current code is as follows:

// Macro recorded on: Wed Jul 11 2012 01:29:42 GMT+0530 (India Standard Time)
komodo.assertMacroVersion(3);
if (komodo.view) { komodo.view.setFocus(); }
ko.find.replaceAllInMacro(window, 0, 'Itemlink', 'target', true, 0, 2, false, false);

The above code replaces the word 'Itemlink' with the word 'target', but how to use clipboard content instead ? So far, I found this Komodo command to paste data from the clipboard, but I don't know how to use it. The command is:

komodo.doCommand('cmd_paste');

Please help, thanks...

Paul Sweatte
  • 24,148
  • 7
  • 127
  • 265
Asim
  • 401
  • 1
  • 5
  • 17

1 Answers1

1

Use a reference to the scimoz object, which uses a subset of the Scintilla API and includes both the copyText() method to add to the clipboard and the paste() method to output the current data:

komodo.assertMacroVersion(2);
var editor = ko.views.manager.currentView.scimoz;
editor.copyText(1,"("); //add left parentheses to clipboard buffer

Find_ReplaceAllInMacro(window, 0, 'Itemlink', editor.paste(), true, 0, 2, false, false);
Paul Sweatte
  • 24,148
  • 7
  • 127
  • 265