• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Launching a cocoa app from a print daemon
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Launching a cocoa app from a print daemon


  • Subject: Re: Launching a cocoa app from a print daemon
  • From: "Bertrand Landry-Hetu" <email@hidden>
  • Date: Fri, 5 May 2006 12:10:00 -0700

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Launching a cocoa app from a print daemon
      • From: "A.M." <email@hidden>
References: 
 >Launching a cocoa app from a print daemon (From: Stéphane Puybareau <email@hidden>)

  • Prev by Date: [MEET] Next CocoaHeads coming up!
  • Next by Date: Re: still wrestling with dynamic columns and column auto-resizing
  • Previous by thread: Launching a cocoa app from a print daemon
  • Next by thread: Re: Launching a cocoa app from a print daemon
  • Index(es):
    • Date
    • Thread