PDA

View Full Version : Anyone feel like testing something?



mvidas
10-18-2006, 12:07 PM
Hi Everyone,

To Skip To The File:
Print Queue Monitor.xls (http://www.vbaexpress.com/forum/attachment.php?attachmentid=4091&stc=1&d=1161280983)

Heres the backstory for this:
I have an application in which I have to print 23 sets of 22 items (1-2 pages each). I need these to be in order in each set. The application that prints (a company made one) prints each item one at a time, this cannot be changed. Occasionally when I'm printing, one of my coworkers will print something to the same printer. After each set of printouts I have to look through them to make sure there are no extra pages in there, as my coworkers will need them, and the printout sets will be sent to customers (ie I don't want to send my coworkers' printouts to the customers).

I needed something to automatically pause my print jobs as they were being sent, so I could release them at once to print without extras in between.

The following is in excel, though once I get some time I'll convert it to a standalone vb app (either this evening or tomorrow evening).

Load up the attached spreadsheet and click the button to show the form. From this point on (until 'resume my jobs' is clicked or the form is closed--though the latter won't unpause any currently paused items), all printer jobs sent from you will be paused.

So if you have 5 minutes and a printer, would you mind testing this and see if you get any errors? Just open it up, "Pause my jobs" should not be enabled (and you'll see "(Paused)" after "My Jobs:"), and then print a couple things. doesnt matter what. I'm just looking to make sure they're actually paused. Feel free to delete them (using the real print queue), or resume them if you actually the need the printouts.
Please let me know your version of windows and excel as well :) For me its win2k and office2k

Any input would be appreciated!
Cheers

lucas
10-18-2006, 01:18 PM
Hi Matt,
When I hit the command button on the sheet I get this error:
Could not load an object because it is not available on this machine.
Can't find project or library
Highlighted is Environ in the Private Sub Form_Load
checked my references and am missing the vba timers

mvidas
10-18-2006, 01:26 PM
I'm surprised environ isn't working (really surprised), but it could just be an effect of the timers thing.
I forgot about the timer.. its a custom .ocx I found at vb.mvps.org (made my Karl Peterson).
Well, shoot. He also included class/module code to control this without having to use the .ocx, I forgot all about this part of it and I just added the ocx as a reference while I was testing his control out (I never implimented his class and module code)
I'm gonna mark this as solved, I may resurrect it tomorrow.
Thanks :)

mvidas
10-19-2006, 06:45 AM
Previous attachment removed, new attachment added
Hopefully you'll have better luck with this one! Any help is much appreciated :)

lucas
10-19-2006, 07:26 AM
Ok Matt,
The userform now loads and the drop down accuratly reflects my printers but when I print something whether from excel or Word....no print jobs show in the listbox no matter what printer I use.
win xp and office 2003

mvidas
10-19-2006, 07:35 AM
Hmmm
This may be a silly question, but does it show if you click the "Show print queue" checkbox? :)
Assuming you printed to the printer shown in the listbox (only monitors a single printer), did you see "My Jobs: 0 (Paused) or (Active)"? If paused, did the count go up to 1?
Since you had trouble with the environ thing yesterday, I'm curious to see if the username being returned isn't what you have for "owner".
When paused (default), did your printout actually print?

lucas
10-19-2006, 07:48 AM
Not a silly question at all Matt....It works when I check the checkbox. Printing is paused as default and the printer is listed in the listbox. When I click resume it processes the print job. I just didn't have the printer I was using showing in the dropdown box and I didn't have the show print Queue checkbox checked. Works fine on my system as is.

mvidas
10-19-2006, 07:54 AM
Glad to hear that!
Do you think I should change the caption on that checkbox, or have it checked by default?
The only reason I have it there is if you have more print jobs than can be displayed in the listview, it flashes when it refreshes (every half second). Got minorly annoying to me so I put the chkbox there.

Can you think of anything I should/could add or change?

lucas
10-19-2006, 08:07 AM
I like the way it functions now that I know I have to check the box....I think default checked is a good idea.

The only thing I can think of this early in the morning is if the selection in the dropdown could be automatic when you print(show the active printer when one is being used) but that might be a problem if more than one printer is being used.

lucas
10-19-2006, 08:17 AM
Matt,
Just noticed that if you have a job paused and the application is closed(word for instance)then the print job is processed even if it is paused....still testing.

mvidas
10-19-2006, 09:00 AM
Do you mean:
-start this print q monitor
-pause "Printer A"
-open word
-print worddoc.doc to "Printer A", worddoc.doc printing is paused
-close word
-worddoc.doc prints to "Printer A"
?

lucas
10-19-2006, 09:14 AM
yes....

lucas
10-19-2006, 09:23 AM
Actually after more testing it does not do it with my 2 printers that print to paper but it does happen when I use a pdf print driver. In fact it does not pause the printing at all for the pdf print driver it seems.

Works correctly for hp printers at this point.

Wolfgang
10-19-2006, 09:39 AM
Hi Matt...

I took the freedom to download your proggy and it ran without a single hickup...

Hardware is an Alienware lappie
Windows is xp-pro home edition BRITISH VERSION
Office is 2003-Pro SP2 US VERSION
Printer was a Brother Laserjet GERMAN VERSION...

What a setup...

Kind regards,
Wolfgang

mvidas
10-19-2006, 10:20 AM
Wolfgang,
I hope you bought the laptop from Japan to round it out!

Steve,
Interesting! I wonder if that means the pdf print driver doesnt use the spooler? I don't have that option here so I can't test it myself, I would think it would still follow normal processes.

I'm working on an "All Printers" option in the combobox.. got that working but now it won't work on a single printer again :)

mvidas
10-19-2006, 10:40 AM
(Hopefully) working version for all printers attached.
Rather than change the combobox to the active printer, the "All Printers" option just checks them all. So if you want only a specific one (which I'll use, as the program I talk about about I have set to go to one printer and I use the other printer for things in the meantime) you can still do just one, otherwise you can pause all print jobs with 'All Printers' (though I did have one sneak by, I can only assume it was a timing issue?)
Also, I added the printer name as a column in the list view, and set some default widths for those columns. They're still changeable, just easier this way (at least fit for me :))

lucas
10-19-2006, 10:55 AM
testing 108kb file(latest)
"All printers" is working for multiple hp print jobs on multiple printers.
pdf driver is still misbehaving. I don't think it spools....

you asked about suggestions.....any way to change the priority of the jobs in the que....move one up if its needed first?

mvidas
10-19-2006, 11:03 AM
Good question.. that can be done in the normal queues, so why not with this one? Let me play around a little more

For now though, heres an updated version, resizes the form now when the "show queue" checkbox is clicked, to avoid confusion about that :) It can still be resized when the box is unchecked, but in order to get small the box would have to be checked, and hopefully the user (me) would know I clicked it

mvidas
10-19-2006, 01:09 PM
testing 108kb file(latest)
"All printers" is working for multiple hp print jobs on multiple printers.
pdf driver is still misbehaving. I don't think it spools....

you asked about suggestions.....any way to change the priority of the jobs in the que....move one up if its needed first?
Without me being able to play around with the pdf driver, I can't say for sure. Would you want that paused?

As for the priority, I'm having a very frustrating time trying to do this. "ByRef argument type mismatch" while sending the job type as it's expecting a byte. I can't find a single example in google showing someone successfully changing the priority using "SetJob", though everything says it can be changed using setjob.

For now I'm still looking, but I'm approaching my max frustration level :(