Re: Launching a cocoa app from a print daemon
Re: Launching a cocoa app from a print daemon
- Subject: Re: Launching a cocoa app from a print daemon
- From: "A.M." <email@hidden>
- Date: Fri, 5 May 2006 16:00:52 -0400 (EDT)
Couldn't you create a UI-less tool which communicates with the UI app in
the user's space [which is launched as a user-level startup item and
blocks on a socket or other IPC]?
On Fri, May 5, 2006 3:10 pm, Bertrand Landry-Hetu wrote:
> Hi Stéphane,
>
>
> Launching an application from a CUPS backend is a bit tricky, the cups
> daemon runs outside the window server and there could be multiple users
> logged in with Fast User Switching. That being said. I have something like
> that working, but it fails on some machines and I haven't found the
> solution yet. Anyway here is the code I use:
>
> LSLaunchURLSpec launchSpec;
> launchSpec.appURL = appURL; launchSpec.itemURLs = postscriptFileURLs;
> launchSpec.passThruParams = 0L; launchSpec.launchFlags =
> kLSLaunchNoParams | kLSLaunchDontSwitch; launchSpec.asyncRefCon = 0L;
>
> status = LSOpenFromURLSpec(&launchSpec, NULL);
>
>
> 2006/5/5, Stéphane Puybareau <email@hidden>:
>
>> Hi,
>>
>>
>> I come from the printing mailing list...
>>
>>
>> I want to launch a Cocoa App (with a GUI) when a user print on a
>> special printer...
>>
>> I've found tea4cups, and it seems to be suitable for this purpose.
>> Its a backend for CUPS that allow me to run command for each print.
>>
>>
>> I wrote a small Cocoa App with Xcode and i want tea4cups to launch it.
>>
>>
>> Firt, i try to launch my app with
>> /Application/MyApp.app/Contents/MacOS/MyApp &> /test.txt
>>
>>
>> in this case, when i print, the app say : # cat /test.txt
>> 2006-05-04 15:01:43.377 tea4cups[26685] No Info.plist file in
>> application bundle or no NSPrincipalClass in the Info.plist file,
>> exiting and exit
>>
>> I also try to use the open command :
>> /usr/bin/open /Application/MyApp.app
>>
>>
>> In this case, when I print, the application bounce in the dock and quit
>> immediately... I don't see any crash reporter window (the crash report
>> level is set to Developer).
>>
>> I also try to add a su -c /usr/bin/open /Application/MyApp.app
>> $TEAUSERNAME
>> ($TEAUSERNAME is an environment var thar contain the name of the user
>> who ask the print)
>>
>> How can I manage to properly launch my application when I print ?
>>
>>
>> Is there a way to catch the standard output and the standard error from
>> MyApp when it's launched with open ?
>>
>>
>> I understand that the backend and the user may not be on the same host.
>> But in my case, it's not...
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Cocoa-dev mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>>
>> This email sent to email@hidden
>>
>>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> n.com
>
> This email sent to email@hidden
>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden