Author Topic: PRINT a TXT file, from VISUAL LISP  (Read 928 times)

0 Members and 1 Guest are viewing this topic.

domenicomaria

  • Mosquito
  • Posts: 16
PRINT a TXT file, from VISUAL LISP
« on: April 14, 2019, 05:06:38 AM »
I need to
PRINT a TXT file, from VISUAL LISP . . .

But
(DOS_SPOOL "c:\\LISP\\BLA-BLA-BLA.txt" (DOS_GETPRN) )
does not work !

my printer
says :
"Receiving data"
but never prints anything . . .

roy_043

  • Water Moccasin
  • Posts: 1728
  • BricsCAD 18
Re: PRINT a TXT file, from VISUAL LISP
« Reply #1 on: April 14, 2019, 07:53:59 AM »
Please stop posting the same problem again and again and again.

domenicomaria

  • Mosquito
  • Posts: 16
Re: PRINT a TXT file, from VISUAL LISP
« Reply #2 on: April 14, 2019, 11:28:03 AM »
Sorry !

I had a problem with your site !

When I try to send a post
it takes at least 10 minutes.

So I think that something is going wrong !

And later
i try again !

I apologize.

Please remove every thing
and leave only one instance !

sorry again !

ciao


BIGAL

  • Bull Frog
  • Posts: 345
  • 30 + years of using Autocad
« Last Edit: April 14, 2019, 09:48:38 PM by BIGAL »
A man who never made a mistake never made anything

domenicomaria

  • Mosquito
  • Posts: 16
Re: PRINT a TXT file, from VISUAL LISP
« Reply #4 on: April 16, 2019, 03:42:09 AM »
I tried :

(STARTAPP "print" path-filename-txt)

(DOS_SPOOL path-filename-txt (DOS_GETPRN) )

(STARTAPP "print /d:\"\\\\Dbroad\\Brother MFC-6490CW Printer\"" path-filename-txt)

. . .

they don't work
. . .
and however I don't understand
the syntax of the third row
. . .
I need a simple and working solution
. . .
ciao

roy_043

  • Water Moccasin
  • Posts: 1728
  • BricsCAD 18
Re: PRINT a TXT file, from VISUAL LISP
« Reply #5 on: April 16, 2019, 04:39:38 AM »
Modern printers may not be able to handle a text file.
Try using notepad.exe. Look into its command line parameters.

kdub

  • Mesozoic relic
  • SuperMod
  • Swamp Rat
  • Posts: 1365
  • class keyThumper<T>:ILazy<T>
Re: PRINT a TXT file, from VISUAL LISP
« Reply #6 on: April 16, 2019, 04:40:04 AM »
I tried :

(STARTAPP "print" path-filename-txt)

(DOS_SPOOL path-filename-txt (DOS_GETPRN) )

(STARTAPP "print /d:\"\\\\Dbroad\\Brother MFC-6490CW Printer\"" path-filename-txt)

. . .

they don't work
. . .
and however I don't understand
the syntax of the third row
. . .
I need a simple and working solution
. . .
ciao

I imagine it's not working because that is/was the address of Doug Broads printer, not yours.
called Kerry in my other life

Sometimes the question is more important than the answer.
#ridesober

roy_043

  • Water Moccasin
  • Posts: 1728
  • BricsCAD 18
Re: PRINT a TXT file, from VISUAL LISP
« Reply #7 on: April 16, 2019, 07:01:26 AM »
Try:
Code: [Select]
(startapp "notepad.exe /p \"X:\\Your path\\File.txt\"")

domenicomaria

  • Mosquito
  • Posts: 16
Re: PRINT a TXT file, from VISUAL LISP
« Reply #8 on: April 16, 2019, 09:59:20 AM »
"Sometimes the question is more important than the answer."
Yes. You are right !

"I imagine it's not working because that is/was
the address of Doug Broads printer, not yours."


What have I to do
to know my printer address
-> via Visual Lisp <- ?

or the printer address of a generic user ?

roy_043

  • Water Moccasin
  • Posts: 1728
  • BricsCAD 18

John Kaul (Se7en)

  • Administrator
  • Needs a day job
  • Posts: 9270
Re: PRINT a TXT file, from VISUAL LISP
« Reply #10 on: April 16, 2019, 02:50:39 PM »
I did some work on this subject--in Cpp--at one point and it's a more difficult situation then one would expect. -i.e. if I remember properly, you can COPY a file to the COM/LPT port (COPY /B filename LPT1:) but the output depends file type you have (TXT, PS, PDF, etc.). In the end it is a big mess.

The knowing which COM/LPT port to send the information to is another big nasty problem. For my Cpp project I choose to use Redmon. Ultimately, I created redirected printer port(s) -i.e. connected a windows print driver to a redirected printer port and then used "redpr" (a better `copy to printer port method') to print my files. ...in the end, it is a bit of a mess and in the end, you'd probably be better off (save yourself a bunch of time) installing Redmon on everyone's machine (this can be automated).
“Common sense is not so common.” ~Voltaire

--> Donate to TheSwamp.org <--

Master_Shake

  • Swamp Rat
  • Posts: 1447
Re: PRINT a TXT file, from VISUAL LISP
« Reply #11 on: April 16, 2019, 03:28:17 PM »
This thread has me intrigued, what would be the advantage or printing to a TXT file?

kdub

  • Mesozoic relic
  • SuperMod
  • Swamp Rat
  • Posts: 1365
  • class keyThumper<T>:ILazy<T>
Re: PRINT a TXT file, from VISUAL LISP
« Reply #12 on: April 16, 2019, 03:54:06 PM »
,INI file
.XML file
.CSV file
General data file
etc, etc


called Kerry in my other life

Sometimes the question is more important than the answer.
#ridesober

domenicomaria

  • Mosquito
  • Posts: 16
Re: PRINT a TXT file, from VISUAL LISP
« Reply #13 on: April 16, 2019, 03:58:31 PM »
"what would be the advantage or printing to a TXT file?"
I wrote my
(internal to Autocad)
NOTEPAD !

Everything works well.
But not PRINT !

dgorsman

  • Water Moccasin
  • Posts: 2399
Re: PRINT a TXT file, from VISUAL LISP
« Reply #14 on: April 16, 2019, 05:51:27 PM »
This thread has me intrigued, what would be the advantage or printing to a TXT file?

You might be misreading this; it's about printing a TXT file to hard copy, not printing to a TXT file.

FYI, the MSXML DOM has a 'save' method to put the contents of an XML DOMDocument to file, so there's no need to use "print" like that.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}