AutoHotKey, Foxit, PHP

429 Views Asked by At

I'm trying to print same PDF lables that are generated with PHP and Mysql.

The creation of the PDF file is done and working. I save the pdf on a temp folder. and then i run this Autohotkey script:

#Persistent 
SetTimer, PrintMon, 5000 ;every 5 seconds return
PrintMon:
IfExist C:\rolls\temp\*.pdf
  {
   runwait, "C:\Program Files (x86)\Foxit Software\Foxit Reader\FoxitReader.exe" /p "C:\rolls\temp\%A_LoopFileName%",,min 
}
FileDelete, C:\rolls\temp\*.pdf
Process, Close, foxitreader.exe
return

I need to close the Foxit program before i can generate and print another PDF file.

I've tried "Process, Close, foxitreader.exe" And "Winclose, Start - Foxit Reader",

but still no luck.

Hope someone can help me on this one,

Thanks

2

There are 2 best solutions below

0
On BEST ANSWER

Found a way to keep working, even with foxit open.

On Foxit goto file ->preferences->general and disable everything. On autohotkey script Change

runwait, "C:\Program Files (x86)\Foxit Software\Foxit Reader\FoxitReader.exe" /p "C:\rolls\temp\%A_LoopFileName%",,min

With

runwait, "C:\Program Files (x86)\Foxit Software\Foxit Reader\FoxitReader.exe" /p "C:\rolls\temp\%A_LoopFileName%",,hide

and Remove the

Process, Close, foxitreader.exe

Final Code:

#Persistent
SetTimer, PrintMon, 5000 ;every 5 seconds return
PrintMon:
IfExist C:\rolls\temp\*.pdf
{
runwait, "C:\Program Files (x86)\Foxit Software\Foxit Reader\FoxitReader.exe" /p "C:\rolls\temp\%A_LoopFileName%",,hide
}
FileDelete, C:\rolls\temp\*.pdf
return

And there you have a way to auto print from PHP using AutoHotKey and Foxit Reader

Update: New version on Foxit as a problem with the silent print. Use version 6.23 for now.

Foxit Reader 6.23

1
On

Try:

; Hard close
WinKill, Start - Foxit Reader