How can I execute an external script in Delphi (like wsh, vbs, bat...) and get back the result? I want to launch them as task within a thread do other things and when the result is ready the scripts itself will inform the application which will receive it in main thread. How to achieve that?
Use Microsoft's Windows Script COM interfaces, in particular the IActiveScript interface.
You mention a lot of different script languages and engines in your question. They have all different possibilities. If you are free to choose your script language i would suggest two approaches:
Have a look at http://www.scalabium.com/smscript.htm they have a nice component to execute a script (VBScript, JavaScipt) and get the return value.
Have a look at http://www.remobjects.com/ps.aspx RemObjects Pascal Script, this is a very powerfull script language and there are plenty of examples around.
I suggest Delphi Web Script (DWS). This is excellent and aggressively updated by Eric - see his blog.
Fast Report have Fast Script used in their famous reporting Fast Report
TMS software also have TMS Scriptor studio and TMS Scriptor studio pro
Related
I would like to be able to access TButton TCheckBox TEdit etc.. of a running Delphi application from a Lua script.
It is a retail Delphi application so I have no access to the source code. I would normally use AutoHotKey but would like more control.
Is this possible as I seem to be able to change things with the Enabler below. Could it be done by integrating Lua into a Delphi app and use it to send to the retail Delphi app ?
Or is there another way ?
An open source solution would be best so to make it available to others.
I use Reaper DAW and it has API for Lua scripting I would like to be able to do similar with the Delphi app without the API available.
In order to run any script in a specific application then that specific application needs to have suitable scripting capabilities built into it in order to be able to interpret that script accordingly.
Now I'm guessing that "retail" application you are using doesn't have LUA scripting built into it otherwise you probably wouldn't be here.
So I'm afraid that the answer is no. You can't interact with a third part application from LUA script unless that application is designed to work with LUA scripts.
I saw an installed application, that feeds some XML data from the vendor's website and displays it in the Main Form window. Simple stuff, I suppose, but whgat I noticed was that, even when I close the Application in the system tray, tomorrow morning (at exactly 12:00AM) it pops ups again! This is so cool. I am not sure that it was written in Delphi, probably some .NET IDE or somehting.
Can Delphi XE2 achieve this? If so, how can I get that to work?
Windows can achieve this: Administrative Tools -> Task Scheduler
If you need to add / manage Task Scheduler in your delphi application, there is a JCL library specially created for that :
http://wiki.delphi-jedi.org/wiki/JCL_Help:JclTask.pas
There is no documentation but you can see the source code and use the TJclTaskSchedule to add executing your own application in Task Scheduler.
To automatically create a scheduled Task either use the "schtasks.exe" command line utility that comes with Windows or an interface to the Task Scheduler API. An alternative to the JCL library is the commercial "VCL Scheduling Agent" component for Delphi.
I'm doing quite a bit of NAnt script writing at the moment and would love to know how I can speed the process up?
I'm currently editing the script in Visual Studio, then going to the command line to test the output. I like how Visual Studio can be configured to autocomplete your NAnt commands (via xsd) but I'm still testing my scripts on the command line.
Are there any tools that bring all of that together? I use Notepad++ quite a bit but would switch allegiance to another editor that has editing and command line functionality built in.
I guess what I'm looking for is something like NAnt Builder (http://www.nantbuilder.com) but I don't really want to spend that sort of money when I have my free current alternative.
If you use ReSharper, it will handle this for you. And when you look at the overall value that the tool provides (almost any "favorite VS add-in" question on here lists ReSharper at the top), it is a pretty easy decision to go for it. This link provides a list of features.
A free alternative that requires some customization is Notepad++.
Does anyone know of an equivalent to FxCop/StyleCop for Delphi? I would really like to get the automatic checking of style, etc. into Continuous Integration.
There's Pascal Analyzer from Peganza: http://www.peganza.com/products_pal.htm
I don't know how the features compare to FxCop, since I haven't really used either one.
The closest I've seen is CodeHealer from SOCK software. We use it, and we have integrated it into our FinalBuilder build. It differs from FxCop in one important way: It analyzes the source code, rather than the produced executable. It also doesn't check quite as much as FxCop does. But I think it is the best thing which is available in this category for Delphi.
Delphi 2009 support isn't there just yet, but they say they're working on it.
Delphi Code Analyzer is another one that is open source.
The DGrok project started with something like FxCop some years ago. The parser and analysis parts are still available, read more at "DGrok 0.8.1: multithreading, default options, GPL" - The parser is a .Net project but
DGrok is a set of tools for parsing
Delphi source code and telling you
stuff about it. Read more about it on
the DGrok project page.
There is a new Delphi plugin for Sonar, which uses a Delphi grammar to run automatic tests over the source code.
I've heard of something called Delforex but haven't used it myself (yet)
Delforex is great for actually formatting the code. It does not do much more than that though. (we have/do use it).
I would second the votes for either Pascal Analyzer or Code Healer.
Vaccano
Doesn't Delphi output .net compatible IL code? I haven't used it in an age but I thought newer versions output .net assemblies.
If so then I would have thought FXcop would work and you could always add some of your own custom rules to it. Stylecop would not work but you could at least get FXCop running.
i have an application which call another console application and pass to it some parameters (console app is a video/audio coverter app) ... is there a way to programmatically "spy" or catch the passed paramters other than hooking/monitoring shellexecute/CreateThread etc ?
Create an executable yourself that just calls the original and passes all parameters on to it. Then move the original somewhere else and replace it with your exe. Your program can then log all calls to it, including all parameters.
Yes, there is - as you write Process Explorer is able to do it, and you could employ the same technique. But AFAIK there's no Delphi translation of the winternl.h file from the Platform SDK, so it is even more tedious and difficult. Also this is extremely version-specific, and there are chances it will break with the next Windows version. It's also not quite clear whether this works for 64 bit processes (from a 32 bit process).
If you really want to do it you will find the necessary information in this blog posting by Matt Pietrek, and in the CodeProject article "Read Environment Strings of Remote process".
If you do not plan to use it for closed source commercial programs then a look into the (GPL licensed) annotated version of the winternl.h file from the ReactOS project would probably also help.
It's a Win32 FAQ since 1992 : just read the PEB.
See on Win32 experts group.