Is possible to load code from .txt file ?

Hi experts. I have one question. Is possible to load code from .txt file ? So the program use code from .txt not from the program. Like mirc scripting or something like that. How I shuld do that ?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

no, except
you code your own interpreter
Mohammed NasmanSoftware DeveloperCommented:

you can use Innerfuse Pascal Script to do that, it's free

or Fast Experts, but it's not free, but allow you to use Pascal and C++ code

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mohammed NasmanSoftware DeveloperCommented:
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

well, ok, a third-party-interpreter instead of an own is also possible :-))
Mohammed NasmanSoftware DeveloperCommented:
of course :-)
"No" means it's not available with Delphi, but he can write his own or use third party
Yes you CAN use code in a text file. Use the Include directive:

unit Unit1;


  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
    { Private declarations }
    { Public declarations }

  Form1: TForm1;


{$R *.dfm}

{$I 'myfile.txt'}

procedure TForm1.FormCreate(Sender: TObject);


//// and in myfile.txt...

procedure TestMe;
        ShowMessage('Hello, world!');

Geoff M.
You can add scripting capabilities by using an embedded language.  There's a very nice translation of the Zend (PHP) api to Delphi which you can download for free ... I think its called php4delphi in

Back a few years there was another free component called TPasScript (or something of the sort also found in which basically added a pascal interpreter to delphi written apps.

If you search the web a little, you can also easily include VBA scripting without problems.

BTW, perl was originally built with the intent to be an embedded library for a scripting language ... I don't know if there are any delphi components for this, but by looking at the neede functions it shouldn't be too hard.  The same goes for python.
You can install Delphi on your target system and use ShellExecute('C:\programs\borland\Delphi x\bin\delphi32.exe', ...) to compile a temporary *.exe file. Another ShellExecute('tmp.exe', ...) will start it.
Are you trying to write a trojan?
Why do you want to load code from .txt?
.exe is not ok?
PoldeAuthor Commented:
Wowwww :)). So much answers :))) This is great :). No I dont want to write a trojan ! I dont havea time for this things. I wanna make my own IRC client and I realy didnt have any idea about scripting .)
you probly would be best using ini or xml for your scripting

ini is like a text file but it can hold your data like a database.


procedure TForm1.Button1Click(Sender: TObject);
myINI : TINIFile;
myINI := TINIFile.Create(ExtractFilePath(Application.EXEName) + 'tag.ini');

edit1.Text := myINI.ReadString('Table Name', 'User', 'String');
myINI.WriteString('Table Name', 'User', 'String');
myINI.DeleteKey('Table Name', 'User',);



[Table Name]

you will be able to store your data and retrieve it. this will be very good for your scripting.
Developer Express ( has a free library available.  One of the component descriptions is as follows:


This component may be considered an interpreter. It allows you to dynamically change calculation schemes in your program or the algorithm of the running program.

It can process arithmetic expressions and constructions: begin & end, if & then, if & then & else, for & to & do, while & do, repeat & until . It can also process one-argument functions.

I can only assume you can load a script at runtime.
If Geoff's code works then that method is very good.


ang on, the trouble with geoff's code it does not work outside of compilation.
That depends on exactly what the author wanted. I interpreted it as using code from a file other than the .pas file, ie at compile time. Others have interpreted it as using code at runtime. Without confirmation from the author, it is difficult to tell exactly what is required. So before you complain that my suggestion is wrong, why don't we wait to find out exactly what IS required? Fair enough, I may be wrong - but *you* might be wrong too.

Geoff M.
i guessed
>using code at runtime

I think this question is very confusing, and i agree with you Geoff, that until the author confirms whether or not that they want code to work at runtime or not, one can only answer the question to their interpretation.

I am sorry if i have offended you,


> No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

rofl thats an under statement, your a bit sloooow aint ya, call it more than a year rofl!! see am crying here already.
your doing a very good job, but when it says more than 21days, it really is an under statement, its been over a year, there really should be a page for admins so when they view that page, it will display all the questions for each of the categorys that are over 21 days and then the admins will deal with them as soon as possible.

sounds like common sense.

but, when its 1yr and
>No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

its just so funny, its like the admins are playing catch up, like this question had got lost for so long, but in the end it was finally found and dealt with, good job on dealing with it, was about time this question was closed. (1year to collect 30 points, mnasman, the long wait has paid off in the end)
forgive me, u do have quite a work load, if u need more admins, I'll be happy to apply.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.