Recent

Author Topic: Macros  (Read 4863 times)

typo

  • Hero Member
  • *****
  • Posts: 3051
Macros
« on: April 18, 2013, 05:34:18 pm »
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?
« Last Edit: April 18, 2013, 05:38:40 pm by typo »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6621
  • Debugger - SynEdit - and more
    • wiki
Re: Macros
« Reply #1 on: April 18, 2013, 06:02:20 pm »
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

  • Hero Member
  • *****
  • Posts: 3051
Re: Macros
« Reply #2 on: April 18, 2013, 06:05:44 pm »
Macros 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

  • Administrator
  • Hero Member
  • *
  • Posts: 6621
  • Debugger - SynEdit - and more
    • wiki
Re: Macros
« Reply #3 on: April 18, 2013, 06:21:17 pm »
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

  • Hero Member
  • *****
  • Posts: 3051
Re: Macros
« Reply #4 on: April 18, 2013, 06:29:07 pm »
Any example project of a Plugin?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6621
  • Debugger - SynEdit - and more
    • wiki
Re: Macros
« Reply #5 on: April 18, 2013, 06:40:10 pm »
Try looking at the the editor toolbar. It gets access to the editors.

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: Macros
« Reply #6 on: April 18, 2013, 06:53:20 pm »
Editor toolbar?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6621
  • Debugger - SynEdit - and more
    • wiki
Re: Macros
« Reply #7 on: April 18, 2013, 08:10:31 pm »
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

  • Hero Member
  • *****
  • Posts: 3051
Re: Macros
« Reply #8 on: April 18, 2013, 08:14:27 pm »
Which is the name of the menu entry?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6621
  • Debugger - SynEdit - and more
    • wiki
Re: Macros
« Reply #9 on: April 18, 2013, 09:29:44 pm »
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_toolbar

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.
« Last Edit: April 18, 2013, 09:31:19 pm by Martin_fr »

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: Macros
« Reply #10 on: April 18, 2013, 11:06:34 pm »
Yes, very interesting. Thanks.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6621
  • Debugger - SynEdit - and more
    • wiki
Re: Macros
« Reply #11 on: April 18, 2013, 11:27:34 pm »
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.

 

TinyPortal © 2005-2018