Forum > Options

How to execute a program using a script

(1/1)

Roland57:
Hello!

I use Lazarus under Windows on a USB key. I have several projects using Cairo. The Cairo binaries are somewhere on my USB key. I don't want to paste them in each directory.

So I wrote this batch file, that I call for example run.cmd:

--- Code: Text  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---@echo off set CAIROBIN=%~d0\applications\compilateurs\newpascal\lazarus\set PATH=%PATH%;%CAIROBIN% %1
So I can open a command prompt and type run my-cairo-program.exe.

How can I use my script from the IDE? I see that it is possible, in project options, to execute a command, but I don't see how I can get the name of the executable (the parameter for my batch script).

trev:
See Compiler Commands.

I'd try putting your batch file in the Execute AFTER Compile + Build and uncheck Run (untested).

engkin:
Or you can use External Tools, which gives you more control over the process. Like show/hide console window, add shortcut,..etc.

Either way you need $TargetFile() or $OutputFile() as a parameter

Roland57:
@trev, engkin

Thanks.

Roland57:
I could finally test your suggestions. (I didn't have a Windows system under the hand last two weeks.)


--- Quote from: trev on February 04, 2022, 10:37:48 pm ---I'd try putting your batch file in the Execute AFTER Compile + Build and uncheck Run (untested).

--- End quote ---

Yes, it works (image 1).


--- Quote from: engkin on February 05, 2022, 12:54:24 am ---Or you can use External Tools, which gives you more control over the process. Like show/hide console window, add shortcut,..etc.

Either way you need $TargetFile() or $OutputFile() as a parameter

--- End quote ---

It works too (image 2).

Thanks again.


Navigation

[0] Message Index

Go to full version