Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How do i get my (writen) Plain text editor to print at the command line?

Posted on 1998-09-05
8
Medium Priority
?
148 Views
Last Modified: 2010-04-06
How do i get my (writen) Plain text editor to print at the command line, Like notepad when a mytexteditor.exe /p.???
0
Comment
Question by:hyper66
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 
LVL 3

Expert Comment

by:mirek071497
ID: 1338713
You must say more what you need.
For parsing command line you have ParamCount and ParamStr - however what you need more ?
if the program can apear on the desktop when printing ? or he need to be hidden ?
To many results I getting whent trying to give you some answer ;)
0
 
LVL 3

Accepted Solution

by:
Matvey earned 180 total points
ID: 1338714
Hi guys, glad to see you Mirek. What you could do:

1) Best in the .DPR itself, befor form showup, put a check for the command line parameters:
 
  if ParamStr(1)='/p' then printfile(ParamStr(2));

2) Define the printfile procedure:

procedure printfile(filename: string);
var s: string;
    printer, t: textfile;
begin
  try
    assignPrn(printer);
    rewrite(printer);
    reset(t, FileName);
    while not eof(t) do begin
      readln(t, s);
      writeln(printer, s);
    end;
  finally
    closefile(t);
    closefile(printer);
  end;
end;

c u, Matvey
0
 
LVL 3

Expert Comment

by:mirek071497
ID: 1338715
nice to see you Matvey - too ;) do you log to the delphi.magsoft.com.pl ?
I have some problems with hackers because our start passwords is not very good ;(
please login and change the password - the rest can wait.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 3

Expert Comment

by:Matvey
ID: 1338716
What do I have to do exactly? I'm not very in the middle of the business right now :(
0
 
LVL 3

Expert Comment

by:mirek071497
ID: 1338717
hi Matvey.
the best way is to read the : http://delphi.magsoft.com.pl/board.shtml

hyper66 - sorry for this private comments.
0
 

Author Comment

by:hyper66
ID: 1338718
How do i get this code into my for so that when i click on a text file it will load fine in my text editor, and when i use my text editor with the /p and text file my text editor will load and print that file.. the Print code you gave me works but i cannot get it to work in Form show with my other code to display text files when they are clicked.  

procedure TMain.FormShow(Sender: TObject);
Var
F :Integer;
Filename: String;
Begin
if ParamCount >= 1 Then
Begin
Filename := '';
For F := 1 To ParamCount Do
Begin
Filename := Filename + ' ' + ParamStr(F);
End;
 SaveDialog.FileName := Trim(Filename);
 Memo.Lines.LoadFromFile(Trim(Filename));
 Memo.Modified := False;
 MemoChange(Sender);
 OpenDialog.HistoryList.Add(Trim(Filename));
 Caption := 'My Text Editor - ' + '['+ ExtractFileName(Filename)
+']';
End;
End;

How do i insert that code into my other code the right way? and is my code for opening texts file right to begin with?



 
0
 
LVL 3

Expert Comment

by:Matvey
ID: 1338719
LoadFromFile won't work with some files as parameters, it just opens one file at a time. You are trying to post all the command line parameters to it.

I sugest something like:

If ParamCount = 1 then
  <memo.loadfromfile(ParamStr(1))>
else if (ParamStr(1)='/p') and ParamCount=2 then
  <memo.loadfromfile(ParamStr(2))>
  <PrintFile(ParamStr(2))>

-Add all the rest of the code if necesary.

Sorry for your english :), but if you could explain just a bit better... (if you still have problems)

--Matvey
0
 

Author Comment

by:hyper66
ID: 1338720
I have it fixed now, I just was'nt thinking. Thank's :)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question