Printing tickets - Forum

Forum Navigation
You need to log in to create posts and topics.

Printing tickets

I'm trying to produce a program whereby you can type a name and when a 'user' presses a button, it prints out the name on a thermal printer.

Can anyone point me in the right direction as to a plugin that can be used to do this

Hello!

One command is enough.
The attached draft has two pages. On the first entry of the name. And the second page will be printed. You can arrange it as you wish.

You can see other commands starting with print.

Uploaded files:
  • You need to login to have access to uploads.
luishp has reacted to this post.
luishp

Ah, thank you...must have missed the reply.

 

This is what I am trying to achieve...

on screen are eight buttons, numbered 1 to 8.
when you press a button it adds 1 to the count (eg: button one is called BUTTON1) and everytime you press it, it adds one to the BUTTON1 count.
The same for all other buttons (BUTTON2,BUTTON3,BUTTON4,BUTTON5,BUTTON6,BUTTON7, BUTTON8)

When you have finished pressing buttons, you press another button that prints out which buttons you pressed and the number of times each one was pressed?

eg; BUTTON 1 WAS PRESSED 3 TIMES
BUTTON 2 WAS PRESSED 2 TIMES
BUTTON 3 WAS PRESSED 4 TIMES
etc...all printed as above on a separate line.

Hope this makes sense?

 

Thanks again for your help

@mbpitt

I am confused; are you still looking for help about "keeping and printing the count of button presses" ? ... or did Vadim answer your enquiry which, according to the original post, was about printing to a thermal printer ?

Yes...still looking for advice.

 

Thanks

@mbpitt

In the startup (Book >>> Properties >>> Actions) section ...

Loop "1" "8" "[thisButton]"
   SetVar "[Button[thisButton]Count]" "0"
EndLoop

In the left click event section for each of the the BUTTONx objects (where x is 1 to 8) ...

Math "1+ [ButtonxCount]" "0" "[ButtonxCount]"

In order to print the counters, try ...

FileErase "[TempDir]PrintContents.txt"
Loop "1" "8" "[thisButton]"
   FileWrite "[TempDir]PrintContents.txt" "[thisButton]" "BUTTON [thisButton] WAS PRESSED [Button[thisButton]Count] TIMES"
EndLoop

PrintTextFile "optionalHeaderTextHere" "optionalFooterTextHere" "[TempDir]PrintContents.txt"

Your thermal printer may require some different control codes (e.g. for new line), so try printing the information on a regular printer first.

If you encounter any problems with the printed output, using notepad.exe check out the contents of [TempDir]PrintContents.txt to make sure the contents of the file is as expected; then provide details of your thermal printer so the proper control codes can be found.

Note: I have not tried this myself so excuse/report any typo errors in the code.

Yep....looking good.
Is it possible to print out ONLY the buttons that were pressed, as opposed to printing all buttons whether pressed or not?

Its for a tote type system

Gaev,

Unable to find the PrintContents.txt file in [TempDir].....

@mbpitt

Is it possible to print out ONLY the buttons that were pressed, as opposed to printing all buttons whether pressed or not?

Yes, inside the Loop/EndLoop, replace this code ...

FileWrite "[TempDir]PrintContents.txt" "[thisButton]" "BUTTON [thisButton] WAS PRESSED [Button[thisButton]Count] TIMES"

... with ...

If "[Button[thisButton]Count]" ">" "0"
   FileWrite "[TempDir]PrintContents.txt" "Append" "BUTTON [thisButton] WAS PRESSED [Button[thisButton]Count] TIMES"
EndIf

Unable to find the PrintContents.txt file in [TempDir].....

I am assuming the offending command was FileErase ... when you run the App for the very first time, this file does NOT exist; so it balks at the request to erase it ... to get around it, just create a dummy file ahead of erasing it ...

FileWrite "[TempDir]PrintContents.txt" "All" "blah, blah, blah"
FileErase "[TempDir]PrintContents.txt"

... you could also do a FileExists command, and only erase it if the file exists.

Managed to get a PrintText.txt file..

Is there a way I can send you this as totally don't understand any of it!

 

Martin

@mbpitt

Is there a way I can send you this

What is "this"?

as totally don't understand any of it!

What is it that you do not understand ? ... post "it" here so everyone benefits.

OOps, sorry..

All I can see that it produces is a file called PrintPage.txt

The contents of which I don't understand