How to show a message box from the filter

Michael R Sweet msweet at apple.com
Tue Aug 5 12:21:42 PDT 2008


keens312 wrote:
>>> keens312 wrote:
>>>>> keens312 wrote:
>>>>>> Hello,
>>>>>>
>>>>>> I am developing a filter driver on Mac OSX.
>>>>>>
>>>>>> A messagebox(with a button on it) should be show up in some cases.
>>>>>>
>>>>>> Does the CUPS provide a way to define the UI in Drv file and show it up with cups APIs?
>>>>> No, there is no way for you to directly communicate with the user.
>>>>>
>>>>> Keep in mind that your filter may not be running on the same system
>>>>> as the user, or the user may not be logged onto the console when the
>>>>> job actually gets printed.
>>>>>
>>>>> About all you can do is use STATE: messages to make the printer queue
>>>>> icon bounce in the dock so that the user can correct the problem, but
>>>>> your driver will need to monitor the printer to know when to continue.
>>>>>
>>>>> --
>>>>> ______________________________________________________________________
>>>>> Michael Sweet, Easy Software Products           mike at easysw dot com
>>>> Hi Michael,
>>>>
>>>> I have to make a workaround for this, since there is no button on printer.
>>>>
>>>> We just take into consideration in the case that filter running on the same system as user.
>>>>
>>>> My plan is to call an external application in filter with LSOpenApplication API. When user click the button on the external application, triggered the job left.
>>> That will not work - your filter isn't running as the login user and
>>> has no access to the screen.  You MUST have a program either running
>>> or registered with launchd in the user's account so that it can
>>> receive the message from your filter and then display a dialog to the
>>> currently logged in user.
>>>
>>> That said, a printer driver that depends on communicating with the
>>> user will have serious issues - it won't work with printer sharing,
>>> users will not like dialogs popping up randomly over their
>>> applications, and it exposes confidential jobs to interception by
>>> the user at the computer when the job prints.
>>>
>>> --
>>> ______________________________________________________________________
>>> Michael R Sweet                        Senior Printing System Engineer
>>>
>> Michael,
>>
>> I am trying the way registed with launchd.
>>
>> LaunchService document does not help me to write the code.
>>
>> Is there any sample code about LaunchService?
>>
>> or could you please tell me the APIs that I should use in my cases?
>>
>> Thanks very much.
>> Keene
> Finally I find the correct document
> http://developer.apple.com/documentation/MacOSX/Conceptual/BPSystemStartup/BPSystemStartup.html
> 
> What I need to do is make Launch Agent, which is per user-session, and has the ability to access window server.
> 
> The Launch Agent will be started when user login, and it will be running on backend and listen on the TCP port I specified. If the defined command received, agent will display the window and bring it to the topmost. CUPS filter driver will send the command.
> 
> I have to programming for the IPC between agent and filter.
> 
> Am I correct?

Basically, yes.  The only change I would make would be to use a UNIX
domain socket instead of a TCP socket, then you can easily tie the
launch agent to a particular print queue.

-- 
______________________________________________________________________
Michael R Sweet                        Senior Printing System Engineer





More information about the cups-devel mailing list