Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mac1404

macrumors newbie
Original poster
May 15, 2009
7
0
Hi Everyone,
Is there a way to get the AppleEvent List? I need to get them to check if there is a print requested( from any application like TextEdit etc). Need not say my application would be running as a daemon process.
I would then process the Print event before sending it actually to printer.
Appreciate quick response..

Thanks
 
Print Spool Pause and Resume?

Hi Everyone,
I need to write a piece of code to Stop the Print Job for a moment till the user authorizes it. When a user selects a print operation from any of the applications on the Mac, like TextEdit etc, I need to inspect the number of copies the user is printing, and do some calculations.
Is there a way to pause the print job till the calculations are done and the user authorizes it? Once the user authorizes the print operation should proceed, else terminate. How can this be achieved programmatically? Can someone help me with some sample code?
My application would be running as a daemon process to check the print operation.

Thanks
 
Re:print Spool Pause and Resume?

Hi Kainjow,
Many thanks. Sorry for late reply. Had a weekend, so was out of office. I went through the links provided by you. My requirement is to find if there is a print job initialized by any application (like TextEdit, Acrobat Reader etc..) All the Print jobs have to call my function to handle them. Is there a sample code you could share with me?

Thanks
 
Print jobs do not go through AppleEvents. Instead the only place you could do something like this is to wrap the CUPS filter at /usr/libexec/cups/filter/pstops. I actually intend to write an article about this in the near future as I did a proof-of-concept on this recently. Wrapping the cups filter, even with a shell script, can do some of what you are looking for. But to do it all I think you would need to parse the PS stream, and I don't envy you that.
 
Hi,
I never happened to think about AppleEvents not handling the Print. Is there a command to detect if print is initialized. I would also need to halt the print processing as soon as it is issued from a third party application? I am totally new to CUPS. Could you share a piece of code to achieve that?
 
hey go through this link, I haven't tried it myself but justin is right in most of the cases.

http://www.rawmaterialsoftware.com/juceforum/viewtopic.php?p=20009&#20009

instead of using

[[[NSWorkspace sharedWorkspace]notificationCenter]addObserver:self selector:mad:selector(volumeMountedNotification:) name:NSWorkspaceDidMountNotification object:nil];

use

[[[NSWorkspace sharedWorkspace]notificationCenter]addObserver:self selector:mad:selector(volumeMountedNotification:) name:NSWorkspaceDidPerformFileOperationNotification object:nil];

then try picking up the data from this

- (void)volumeMountedNotification:(NSNotification*)note
{

NSLog([[note userInfo]objectForKey:mad:"NSDevicePath"]);
}
 
Hey Larkost,
Many thanks for your support. I tried the approach u have discussed in the site. Could you be more elaborate on these "
printingServer = 'printing.macenterprise-example.com'
printingPage = 'https://printing.macenterprise-example.com/printer.php?printer='
"

I used "printingServer = 'http://localhost:631/"
Is this a right way or something else has to be done?
 
You will want to read that article more carefully. The goals I had for that project diverge from yours a bit. The only thing this does is pop up a specific web page (our print authentication page for the specific printer). I don't care about the number of pages (taken care of on the server) or anything else. The two variables you reference would point at the print server (so I only catch "printers" that are print queues on that server), and the print authentication page (also on that server). Pointing at localhost:631 is just going to get the CUPS admin page to open up on your clients, not really doing any good.

Your needs sound like they are going to be more complicated, and are going to require you to parse the PostScript that is in the job (I don't envy you that), and then do even more work. This is really going to take a lot of research on your part, and I am not in a position to do it for you. The article I pointed you at gives you an idea where to hook in, but is not a solution for doing exactly what you want to do.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.