Help making a Queue Script

June 5, 2020 at 05:14:39
Specs: Windows 10
Hello, I am currently trying to make a simple Queue Script and I have been looking around the net until i find this forum.
I need some help from the experts here.
Here is what I am trying to accomplish when printing the output of the bat file:
line1: Current date
line2: Current time
line3: Your number
line4: Incremental number
line5: Thanks for waiting

Here is what I have done:
I have 10 text file by the name A001.txt - A010.txt
The content of the text files are:
Your Number
A001 <<<< up to A010
Thanks for waiting

Then I have another file that I run called "print.bat", the content of the file is:
@echo off
notepad /p A001.txt
notepad /p A002.txt
notepad /p A003.txt
notepad /p A004.txt
notepad /p A005.txt
notepad /p A006.txt
notepad /p A007.txt
notepad /p A008.txt
notepad /p A009.txt
notepad /p A010.txt

This method get the jobs done but im looking for another simpler way to do this.
I have tried this method but it doesnt work:
echo %date% > test.txt
Time /T >> test.txt
echo Your number >> test.txt
set /A COUNTER=COUNTER+1 >> test.txt
echo pause >> test.txt

Can anyone here help me?

message edited by casper2201

See More: Help making a Queue Script

Reply ↓  Report •

June 5, 2020 at 09:03:33
Not sure im understanding, is this script supposed to generate a txt file with some text in it?

What should the txt files look like exactly?
Something like this?:

Your number: A001

Thanks for waiting...

and then the next file will have A002? and updated date and time?

And have you considered trying this with PowerShell?

Reply ↓  Report •

June 6, 2020 at 02:26:16
Thought a queue ticket system was a cool idea for a script, so here is what i came up with:

Save file as .ps1, run it with powershell: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
This script will create a text file, print it using the default printer and then delete the text file.
Edit: If you have problems running powershell scripts, open powershell and type Set-ExecutionPolicy Unrestricted




You are number: 001 in the queue..

We appreciate your patience!

message edited by Kilavila

Reply ↓  Report •

June 6, 2020 at 22:09:36
Thanks for the code, I found another way to do it also, i hope it can help someone in the future.

@echo off
title MyTitle
set cycles=0

echo %date% > number.txt
echo: >> number.txt
Time /T >> number.txt
echo: >> number.txt
echo Your Number >> number.txt
echo: >> number.txt
set /a cycles=cycles+1 >> number.txt
echo A%cycles% >> number.txt
echo Please Wait >> number.txt
echo Thank you >> number.txt
notepad /p number.txt
goto startpoint

Reply ↓  Report •

Related Solutions

June 6, 2020 at 22:18:53
nvm got the powershell script to work, thanks.
One problem though, the time it needs to print the ticket takes too long, is there any way to print the ticket faster?

message edited by casper2201

Reply ↓  Report •

June 7, 2020 at 03:20:27
Yea, find this section:

Write-TicketCreation -Message "Printing ticket: $Date $Time $Number" -StepNumber ($stepCounter++)
Start-Sleep -Seconds 2

and remove the Start-Sleep or comment it out with # like so:

# Start-Sleep -Sec......

You can edit all the start sleep commands or just remove them, i just placed them there so it would be easier to see whats happening when it executes.

Reply ↓  Report •

June 9, 2020 at 16:04:21
Noticed something else that will speed up this process.

Ive used add-content for each line that should be added to the file, basically opening and closing the file 8 times.

Replace all the add-content commands with this:

$Content = {Your ticket:


You are number: $Number in the queue..

We appreciate your patience!}

Add-Content -Path "$PSScriptRoot\Ticket-$Number.txt" -Value $Content

This should save the text to the $Content variable, then just write to the file one time.

Reply ↓  Report •

Ask Question