Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple PDFs attachments : Handle_MultipleInstance #1

Open
DKWien opened this issue Feb 6, 2022 · 1 comment
Open

Multiple PDFs attachments : Handle_MultipleInstance #1

DKWien opened this issue Feb 6, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@DKWien
Copy link

DKWien commented Feb 6, 2022

Hello,

Your code is very good ! Great Job!

When I have an email with 3 pdf attachments:

Dok1.pdf
Dok2.pdf
Dok3.pdf

Then multiple instances to print the PDF start, but the program does not allow this and I see error message pop-up in windows 10 "PDFtoPrinter.exe is already running. Please wait." In the end only one pdf gets printed.

I get problems with running 3 x pdfprinter.exe (pdfxcview.exe) at nearly same time. It might be because I use a new version of "pdfprinter.exe" from here : http://www.columbia.edu/~em36/pdftoprinter.html

Here : http://www.columbia.edu/~em36/PDFtoPrinter.au3 I find: a piece of code:

Func Handle_MultipleInstance()
If _Singleton(StringReplace(@ScriptFullPath, '\', '/'), 1) = 0 Then
Local $sMsgBoxMsg = "PDFtoPrinter.exe is already running. Please wait."
If $cli = 0 Then
MsgBox(0, $msgTitle, $sMsgBoxMsg, 2)
Else
ConsoleWrite($sMsgBoxMsg)
EndIf
Exit
EndIf
EndFunc ;==>Handle_MultipleInstance

For testing I run the same code in batch file test.bat:

@echo on
"C:\Users\bgm\AppData\Local\Temp\PDFPrinterTmp\PDFXCview.exe" "/printto:&" "Schmierpapier" "C:\Users\bgm\Documents\OLAttachments\Dok1.pdf"
"C:\Users\bgm\AppData\Local\Temp\PDFPrinterTmp\PDFXCview.exe" "/printto:&" "Schmierpapier" "C:\Users\bgm\Documents\OLAttachments\Dok2.pdf"
"C:\Users\bgm\AppData\Local\Temp\PDFPrinterTmp\PDFXCview.exe" "/printto:&" "Schmierpapier" "C:\Users\bgm\Documents\OLAttachments\Dok3.pdf"
pause

It works without problems.

I have a workaround to slow down the VBA, but this is not perfect, because the waiting time is only an estimation:

Dim TimeEnd As Single
TimeEnd = Timer + 2
While Timer < TimeEnd
DoEvents
Wend

Best regards and thank you in advance.

@cdamyx
Copy link
Owner

cdamyx commented Mar 1, 2022

Oh hey, sorry I didn't notice this sooner - thanks for reaching out!

I believe you're correct, there is a newer version of the PDFtoPrinter.exe program, which has introduced a new bug.

I'll look into this new version and make some updates when I get a chance. Currently on the hunt for a new job, so it might be a little bit before I can dig in. I hope you were able to make use of the script with the fix you applied!

@cdamyx cdamyx self-assigned this Mar 1, 2022
@cdamyx cdamyx added the bug Something isn't working label Mar 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants