Recent

Author Topic: Macro language functions  (Read 1394 times)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11826
  • Debugger - SynEdit - and more
    • wiki
Re: Macro language functions
« Reply #15 on: June 05, 2025, 05:18:35 pm »
I understand that 440bx wants to run under the debugger, hence I gave this code.
I am really not sure if it is an answer, but it works at least under Delphi.
I assume also under Lazarus or FPC.

Well, there is no debugger for "Editor macro". That is unless you debug the IDE, but then you will not so much debug your script as you debug the script engine. Which is not what he wants or needs.

Inside the script (that is specifically an "editor macro") there is no such function.

Also an debugger to such a script (as it is a script, not an exe and run by a script engine which is an interpreter) would not normally attach to the Window debug API. So it wouldn't get such messages if they actually were generated.

Thaddy

  • Hero Member
  • *****
  • Posts: 18372
  • Here stood a man who saw the Elbe and jumped it.
Re: Macro language functions
« Reply #16 on: June 05, 2025, 05:33:09 pm »
Well, I Implemented this for PerfectView in the 1999's and early 2000's and there it worked. We should be able to make it work for Lazarus, the {$apptype console} will give a console window for the script output anyway.
Script or exe.
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

440bx

  • Hero Member
  • *****
  • Posts: 5820
Re: Macro language functions
« Reply #17 on: June 05, 2025, 05:40:47 pm »
As Martin as already explained, even if it were possible to make Synedit's macro facility use OutputDebugString (which cannot be done without changes to the macro's implementation), the macros are NOT running under a debugger, they are running as part of the IDE, therefore if OutputDebugString was called by the macro, the message would go into the bit bucket because the app (in this case the IDE itself) isn't being debugged.

Yes, PascalScript can be "extended" with external functions but, that implies full access to the PascalScript instance (for it to be customized with functions it makes available) which the macro facility does not provide.  IOW, the functions needed to tell PascalScript to use a particular Windows API are not available within Synedit's macro facility.


FPC v3.2.2 and Lazarus v4.0rc3 on Windows 7 SP1 64bit.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11826
  • Debugger - SynEdit - and more
    • wiki
Re: Macro language functions
« Reply #18 on: June 05, 2025, 06:04:36 pm »
Well, I Implemented this for PerfectView in the 1999's and early 2000's and there it worked. We should be able to make it work for Lazarus, the {$apptype console} will give a console window for the script output anyway.
Script or exe.

$apptype  does not apply. The script (macro) is never run on its own. It can only run inside the IDE.

Please read up, what editor macros actually do.

And as said before: Of course any debugln/debugoutput/.... could be added (but has not yet / and that would be a change to the IDE / not something to be put into the macro) in the IDE to be available, and then the IDE could print the received data anywhere. So sure, then it could have a console window. Though  there would be more suitable means in that case.

Thaddy

  • Hero Member
  • *****
  • Posts: 18372
  • Here stood a man who saw the Elbe and jumped it.
Re: Macro language functions
« Reply #19 on: June 05, 2025, 07:01:36 pm »
Oh, well, that is all a pity.
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

 

TinyPortal © 2005-2018