Link to home
Start Free TrialLog in
Avatar of jexd99
jexd99

asked on

Best way to run a batch prog....

I would like to verify the best way to write a batch program....
If creating a batch program, and I place all the code in the main form, (with no CreateForm commands) then I cannot use any of the VCL components unless I dynamically create them, right?  Is there a better way to do this or am I planning this the best way?
In other words, I can't drop any components (lets say label, listbox, and timer) on a form because even making the form invisible still creates it initially and shows it.  I need to create these dynamically in the main file, after removing any CreateForm statements, correct?

            Thanks
Avatar of inthe
inthe

Hi
what you are saying is correct just place your code in the main dpr file (view - units - project1) and remove all references to the unit1 and form1 from project.
you may need to add some units to the uses section of the main dpr if your using showmessage() for instance you'd ned to add dialogs etc..
what is your batch program for?
Regards Barry
You could use the command

Executefile(filename,paramet,'',sw_show)

filename = your file
paramet = parameters behind your filename
sw_show : displays the dosbox, swhide executes the batch-file without showing the dos-window.

USES
  fmxutils

You also have to put the link to the directory where fmxutils are in Tools->Environment options :

c:\program files\borland\delphi5\demos\doc\filmanex

or
$DELPHI)\demos\doc\filmanex;
Avatar of jexd99

ASKER


inthe,

    There is no way to add/drop components from the VCL in this case is there (when using only the main dpr)?  I think the only option is to dynamically create these as needed, but I just want to make sure before I get too deep into this. :)

(Also how to I give you the points for this when you weren't the first answer?)


           
If you want to give Inthe the points, you could reject my answer :-)
yes you have it all straight in your head :-)
you can only create them dynamically (and only components that dont need a form(canvas property etc) if your not going to have a form ;-)so you couldnt create a tlabel but you could create a
ttimer or use a stringlist but not a memo etc.. you know what i mean .
if you dont know the easist way to remove the default form from a new project you can go to the menu in delphi and choose project - remove from project and choose unit1,form1 then after removeing go to menu item view and choose unts and choose project1.that should set it up to start.

btw.
you probably know but you must remember to free these thing you create as well .
i was asking about waht the batch was going to do because i wondered if you knew you could create .bat files in code if you needed.

oh and theres an option on this page   to reject / accept answers .. sorry batalf :-)
Avatar of jexd99

ASKER


Thanks for the answer, thats what I thought but I wanted to be sure before I got to deep into it.  I've done these things before then found out later that I could have done things much easier! :-)

Thanks for your answer too batalf, I need to do this in delphi so I can't use a dos bat file, I think we just misunderstood each other on the question. :)

(Inthe, go ahead and answer this question so I can give you the points)
ASKER CERTIFIED SOLUTION
Avatar of inthe
inthe

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial