Macros lazarus / 9-Editor ---------------------------------------------------------------------- typo · 2013-04-18 15:34 How to save a recorded macro and how to use PascalScript package? For example, I want a external tool to add text to source editor, how should I do that? ---------------------------------------------------------------------- Martin_fr · 2013-04-18 16:02 Pascal script macros are only available in 1.1 (or trunk in svn) http://wiki.lazarus.freepascal.org/Editor_Macros_PascalScript Install the package "EditorMacroScript" Their is a testcase in the package dir. You should run it to make sure it work on your architecture. If the package is installed, then in the menu "View" is an entry "Editor Macros ..." It has 3 tabs: Recorded, project, IDE Move the Macro to one of the 2 latter. And it will be saved. --- Macros do not access the external tools. So you can't include them. ---------------------------------------------------------------------- typo · 2013-04-18 16:05 Quote from: Martin_fr on April 18, 2013, 06:02:20 pmMacros do not access the external tools. So you can't include them. I would need the external tool to access a macro, for example, or another way to edit the source editor programmatically. ---------------------------------------------------------------------- Martin_fr · 2013-04-18 16:21 If the Macro aren't enough (they have program flow, but no external data/access), then you need your own IDE plugin. SourcEditor are available through the IDEIntf package. ---------------------------------------------------------------------- typo · 2013-04-18 16:29 Any example project of a Plugin? ---------------------------------------------------------------------- Martin_fr · 2013-04-18 16:40 Try looking at the the editor toolbar. It gets access to the editors. ---------------------------------------------------------------------- typo · 2013-04-18 16:53 Editor toolbar? ---------------------------------------------------------------------- Martin_fr · 2013-04-18 18:10 It is a package, in the components folder. Can be installed as a package. It is ideal as a sample too. It is small, adds a menu entry, and works with the source editor. ---------------------------------------------------------------------- typo · 2013-04-18 18:14 Which is the name of the menu entry? ---------------------------------------------------------------------- Martin_fr · 2013-04-18 19:29 I havent got it installed. Actually, it may not add a menu, but it looks through the list of menu entries. http://wiki.lazarus.freepascal.org/New_IDE_features_since#editor_toolb ar This is just as an example. You need to create your own package, and your own code. For adding a menu: Leak view, Jedi, .... I still don't know what you want to do. ---------------------------------------------------------------------- typo · 2013-04-18 21:06 Yes, very interesting. Thanks. ---------------------------------------------------------------------- Martin_fr · 2013-04-18 21:27 SOme other info. Once you got an SourceEditor, it has an EditrorComponetn property or similar. It always is a SynEdit, but you need to typecast. On SynEdit, use TextBetweenPoint property, or related procedures to edit text (that captures undo info). Don't access Lines to write text.