[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [amibroker] Printing from afl - Solution for USB printers + afl code



PureBytes Links

Trading Reference Links

Neat stuff, eh?
 
d


  _____  

From: Herman van den Bergen [mailto:psytek@xxxxxxxx] 
Sent: Monday, September 27, 2004 4:58 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: RE: [amibroker] Printing from afl - Solution for USB printers + afl
code


Hello, here is the code I use to print RT trade information from afl. This
will print one time for each time you click on "Click to Print", some
additional code was needed to prevent repeated prints each time the RT chart
refreshes. Read TJ's post below the code as well as earlier posts on this
topic.

best regards

herman

----------------------------------------------------------------------------
----


// This code allows you to print from the Param window
// Information to be printed is contained in "PrintString"
// which could contain RT trading information, read thread:
// http://finance.groups.yahoo.com/group/amibroker/message/70841
// before using this code. Thanks for your help Tomasz!

if( IsEmpty(StaticVarGet("IsInitialized")))
        {
        StaticVarSet("PP",0);
        StaticVarSet("IsInitialized",1);
        _TRACE("# Initialized");
        }

PrintString = "Testing Print ParamToggle "+Now(2); // Test text only

PP1 = StaticVarGet("PP");
PP2 = ParamToggle("Printing","Click to Print|Click to Print",False);

if( PP2 != PP1)
        {
        fh = fopen("LPT3:", "w");
        StaticVarSet("PP",PP2);
        if( fh )
                {
        fputs(PrintString, fh );
                fclose(fh);
                }
        else
                {
                printf("Error opening");
                }
        }



----------------------------------------------------------------------------
----


-----Original Message-----
From: Tomasz Janeczko [mailto:amibroker@xxxxxx]
Sent: Sunday, September 26, 2004 5:10 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] Printing from afl - Solution for USB printers


Herman,

I have found the way to use your Canon USB printer (yes I have tested it):

Please follow these instructions:
1. in Control Panel->Printers, select your printer and choose "Properties"
2. then go to "Sharing" tab and select to share this printer and enter the
share name
  for example "CANON"
3. go to "Advanced" tab, click on "Print Processor" button and choose
  "WinPrint" from left-hand list (instead of default "Cannon print
processor")
and "TEXT" from right-hand list (default data type).
4. close the properties dialog via OK
5. then open command line prompt and enter

NET USE LPT3 \\YOURCOMPUTER\CANON   /PERSISTENT:YES

(replace YOURCOMPUTER by the name of your computer (you can find it
in "My Computer" -> Properties))

Then you should be able to print using this:

fh = fopen("LPT3:", "w");
if( fh )
{
  fputs("TESTING", fh );
  fclose(fh);
}
else
{
  printf("Error opening");
}

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
From: "Tomasz Janeczko" <amibroker@xxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Sunday, September 26, 2004 10:39 AM
Subject: Re: [amibroker] Printing from afl


> Herman,
>
> I have two printers,
> Minolta PagePro 1100 Laser Printer connected to LPT1 (parallel Centronics
port)
> and
> Canon i455 (USB) - it creates virtual port USB001 (exactly as in your
case)
>
> I have checked both and tried PRN: and USB001: device names.
>
> And this formula:
>
> fh = fopen("PRN:", "w");
> if( fh )
> {
>  fputs("TESTING", fh );
>  fclose(fh);
> }
> else
> {
>  printf("Error opening");
> }
>
> always prints fine to laser printer (connected via parallel port)
> no matter what default printer is.
>
> Using port USB001 does not work (simply the formula does not open file
handle
> - but it does NOT hang)
>
> This experiment shows that to print via file output you have to have
> printer connected to REAL, PHYSICAL port (such as LPT1) not to "virtual"
one.
> And this is of course the problem of the driver.
>
> There are some third party programs that allow to circumvent this
limitation
> of the driver, by redirecting the output sent to real port to the virtual
port
> exposed by your USB printer.
> I have found this for example:
> http://www.guolo.com/printfil/edesc.htm
>
>
> or you can try to play (for free) with windows printer sharing:
> http://www.experts-exchange.com/Hardware/Printers/Q_10353915.html
> http://www.experts-exchange.com/Operating_Systems/MSDOS/Q_21071579.html
>
http://www.microsoft.com/resources/documentation/windows/2000/server/reskit/
en-us/serverop/part1/sopch04.mspx
>
> As this is not really a problem of AmiBroker I am not going to dig
further,
> but you can use www.google.pl to find other solutions.
>
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message -----
> From: "Herman van den Bergen" <psytek@xxxxxxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Sunday, September 26, 2004 12:03 AM
> Subject: RE: [amibroker] Printing from afl
>
>
>> Well, my CANON i350 printer is only a few months old and I just
downloaded
>> and re-instaled the latest driver for XP.
>>
>> Perhaps this doesn't work exactly because it is an "old technique that is
>> here since the beginning of PC computers" :-)
>> AmiBroker just becomes unresponsive when I run the code (requires
>> ALT-CTRL-DEL to exit). However I can right-click and print the formula
>> without problem.
>>
>> But not to worry and waste time on this, it will work eventually.
>>
>> herman.
>>
>>  -----Original Message-----
>>  From: Tomasz Janeczko [mailto:amibroker@xxxxxx]
>>  Sent: Saturday, September 25, 2004 4:39 PM
>>  To: amibroker@xxxxxxxxxxxxxxx
>>  Subject: Re: [amibroker] Printing from afl
>>
>>
>>  Hello,
>>
>>  Every decent printer driver must support text output to PRN:
>>  This is an old technique that is here since the beginning of PC
computers.
>>  If it does not then it means that your driver is faulty/incomplete/etc.
>>  Contact printer manufacturer for updated printer driver.
>>
>>  Best regards,
>>  Tomasz Janeczko
>>  amibroker.com
>>  ----- Original Message -----
>>  From: "Ara Kaloustian" <ara1@xxxxxxxxxx>
>>  To: <amibroker@xxxxxxxxxxxxxxx>
>>  Sent: Saturday, September 25, 2004 8:24 PM
>>  Subject: Re: [amibroker] Printing from afl
>>
>>
>>  >I was not able to print with the code below. Using WIN 2000 Pro
>>  >
>>  > I looked at my printer ports, had my printer on LPT1, tried that also,
>> again
>>  > without success
>>  >
>>  >
>>  > ----- Original Message -----
>>  > From: "Tomasz Janeczko" <amibroker@xxxxxx>
>>  > To: <amibroker@xxxxxxxxxxxxxxx>
>>  > Sent: Saturday, September 25, 2004 10:40 AM
>>  > Subject: Re: [amibroker] Printing from afl
>>  >
>>  >
>>  >>
>>  >> Herman,
>>  >>
>>  >> The following code prints "TESTING" word on my laser printer:
>>  >>
>>  >> fh= fopen("PRN:", "w");
>>  >> if( fh )
>>  >> {
>>  >>   fputs( "TESTING", fh );
>>  >>   fclose( fh );
>>  >> }
>>  >>
>>  >> Best regards,
>>  >> Tomasz Janeczko
>>  >> amibroker.com
>>  >> ----- Original Message -----
>>  >> From: "Herman van den Bergen" <psytek@xxxxxxxx>
>>  >> To: <amibroker@xxxxxxxxxxxxxxx>
>>  >> Sent: Saturday, September 25, 2004 7:34 PM
>>  >> Subject: RE: [amibroker] Printing from afl
>>  >>
>>  >>
>>  >> > Thanks Marek,
>>  >> >
>>  >> > Your source required payment for access so i didn't do that. I am
>> using
>>  > XP
>>  >> > and found the info below, trying this command print /d:USB002
>>  > c:\Test.txt
>>  >> > without success.
>>  >> >
>>  >> > I gather that in XP i should be able to use simply Print Test.txt
but
>> it
>>  >> > doesn't work.
>>  >> >
>>  >> > herman
>>  >> > PRINT
>>  >> >
>>  >> > Print a file or files to a local or network printer.
>>  >> >
>>  >> >
>>  >> > syntax
>>  >> >      PRINT [/D:device] [pathname(s)]
>>  >> >
>>  >> > key
>>  >> >   device   : either a local printer (LPTx, COMx )
>>  >> >              or a network printer by its sharename
>>  >> > (\\servername\print_share)
>>  >> >
>>  >> >   pathname : The file or files to be printedThe default device is
>> PRN.
>>  > The
>>  >> > values PRN and LPT1 refer to the same parallel port.
>>  >> >
>>  >> > To delete a print job:
>>  >> >
>>  >> > Use Control Panel, Printers (GUI) or use
>>  >> > NET PRINT job# /DELETE
>>  >> >
>>  >> > It is possible to delete the relevant .spl and .shd files from
>>  >> > %SystemRoot%\system32\spool\PRINTERS
>>  >> > but the .spl file for a print job at the top of the print queue
>> cannot
>>  > be
>>  >> > deleted.
>>  >> >
>>  >> > Printing requires the Spooler service to be running
>>  >> >
>>  >> >
>>  >> >
>>  >> >
>>  >> >  -----Original Message-----
>>  >> >  From: Marek Chlopek [mailto:mchlopek@xxxxxxx]
>>  >> >  Sent: Saturday, September 25, 2004 12:00 PM
>>  >> >  To: amibroker@xxxxxxxxxxxxxxx
>>  >> >  Subject: Re: [amibroker] Printing from afl
>>  >> >
>>  >> >
>>  >> >  On Saturday, 25 of September 2004 17:37, Herman van den Bergen
>> wrote:
>>  >> >  > Its listed under the Ports tab as USB002 ... but I have no clue
>> what
>>  >> > that
>>  >> >  > means :-)
>>  >> >
>>  >> >  is it xp? I have absolutely no experience with xp (my latest ms
>>  > operating
>>  >> >  system is 98). can you get a console? can you type: copy
>>  > c:\any_text_file
>>  >> >  port
>>  >> >  where port=lpt usb002 or something else?
>>  >> >
>>  >> >  I only know that you have to find a solution how to print directly
>> to
>>  > the
>>  >> >  printer from the command line (from console). when you have a
>> solution
>>  >> > than
>>  >> >  you should have no problems to print from afl.
>>  >> >
>>  >> >  I have found it using google (this is your question, maybe they
have
>> an
>>  >> >  answer?):
>>  >> >  http://www.experts-exchange.com/Applications/Q_20852377.html
>>  >> >
>>  >> >  Regards,
>>  >> >  --
>>  >> >  Marek Chlopek
>>  >> >  mchlopek@xxxxxxx
>>  >> >
>>  >> >
>>  >> >  Check AmiBroker web page at:
>>  >> >  http://www.amibroker.com/
>>  >> >
>>  >> >  Check group FAQ at:
>>  >> > http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>>  >> >
>>  >> >
>>  >> >        Yahoo! Groups Sponsor
>>  >> >              ADVERTISEMENT
>>  >> >
>>  >> >
>>  >> >
>>  >> >
>>  >> >
>>  >>
>>
>> -----------------------------------------------------------------------
>> ---
>>  > --
>>  >> > --
>>  >> >  Yahoo! Groups Links
>>  >> >
>>  >> >    a.. To visit your group on the web, go to:
>>  >> >    http://groups.yahoo.com/group/amibroker/
>>  >> >
>>  >> >    b.. To unsubscribe from this group, send an email to:
>>  >> >    amibroker-unsubscribe@xxxxxxxxxxxxxxx
>>  >> >
>>  >> >    c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of
>>  > Service.
>>  >> >
>>  >> >
>>  >> >
>>  >> > [Non-text portions of this message have been removed]
>>  >> >
>>  >> >
>>  >> >
>>  >> >
>>  >> > Check AmiBroker web page at:
>>  >> > http://www.amibroker.com/
>>  >> >
>>  >> > Check group FAQ at:
>>  > http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>>  >> > Yahoo! Groups Links
>>  >> >
>>  >> >
>>  >> >
>>  >> >
>>  >> >
>>  >> >
>>  >>
>>  >>
>>  >>
>>  >> Check AmiBroker web page at:
>>  >> http://www.amibroker.com/
>>  >>
>>  >> Check group FAQ at:
>>  > http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>>  >> Yahoo! Groups Links
>>  >>
>>  >>
>>  >>
>>  >>
>>  >>
>>  >>
>>  >>
>>  >
>>  >
>>  >
>>  >
>>  >
>>  > Check AmiBroker web page at:
>>  > http://www.amibroker.com/
>>  >
>>  > Check group FAQ at:
>> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>>  > Yahoo! Groups Links
>>  >
>>  >
>>  >
>>  >
>>  >
>>  >
>>
>>
>>  Check AmiBroker web page at:
>>  http://www.amibroker.com/
>>
>>  Check group FAQ at:
>> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>>
>>
>>        Yahoo! Groups Sponsor
>>              ADVERTISEMENT
>>
>>
>>
>>
>>
>> -------------------------------------------------------------------------
---
>> --
>>  Yahoo! Groups Links
>>
>>    a.. To visit your group on the web, go to:
>>    http://groups.yahoo.com/group/amibroker/
>>
>>    b.. To unsubscribe from this group, send an email to:
>>    amibroker-unsubscribe@xxxxxxxxxxxxxxx
>>
>>    c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.
>>
>>
>>
>> [Non-text portions of this message have been removed]
>>
>>
>>
>>
>> Check AmiBroker web page at:
>> http://www.amibroker.com/
>>
>> Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>> Yahoo! Groups Links
>>
>>
>>
>>
>>
>>
>
>
>
> Check AmiBroker web page at:
> http://www.amibroker.com/
>
> Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> Yahoo! Groups Links
>
>
>
>
>
>


Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html


Yahoo! Groups Sponsor
ADVERTISEMENT






Yahoo! Groups Links

To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/

To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx

Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


[Non-text portions of this message have been removed]



Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html 



Yahoo! Groups Sponsor	

ADVERTISEMENT
 
<http://us.ard.yahoo.com/SIG=129abt899/M=295196.4901138.6071305.3001176/D=gr
oups/S=1705632198:HM/EXP=1096405127/A=2128215/R=0/SIG=10se96mf6/*http://comp
anion.yahoo.com> click here	
 
<http://us.adserver.yahoo.com/l?M=295196.4901138.6071305.3001176/D=groups/S=
:HM/A=2128215/rand=567711905> 	


  _____  

Yahoo! Groups Links


*	To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
  

*	To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<mailto:amibroker-unsubscribe@xxxxxxxxxxxxxxx?subject=Unsubscribe> 
  

*	Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
<http://docs.yahoo.com/info/terms/> . 




[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/