View Full Version : Command Advice help (Just the names)

Jun 25, 2008, 02:25 PM
I need to know names of commands of cocoa version of the following shell commands (if any):

lpadmin -p printer1 -v lpd:........
cupsenable (or enable for 10.4)

I am not sure if it would be wise to do three system call (17 if they choose all 17 printers)

and I found the PPD at: http://developer.apple.com/documentation/Cocoa/Conceptual/Printing/Tasks/CreatingPrinters.html but not sure if it will handle LPR printing.


Jun 25, 2008, 04:51 PM
For something that specific I would probably just use system() to either call those directly or call a shell script that you package with your app to do those things. Others may chime in with API calls to handle that, but I'm not sure if they exist or not.


Jun 26, 2008, 06:53 AM
I was afraid of that as I know to many outside calls can slow a program down.

Jun 26, 2008, 07:32 AM
If passing commands to the shell means you can get your tool/app done sooner and with less problems or bugs then I would say go for it. It might not be the prettiest way but so what. I doubt it will slow your app down noticeably and speed for these sort of tools is subjective anyway.

b e n

Jun 26, 2008, 07:41 AM
There are not Cocoa wrappers to all system/command line functionality. System calling will be fine: it's really not all that expensive at all.

Jun 26, 2008, 08:07 AM
system("lpadmin -p ARC-ATLAB-BWQ -v lpd://at-regulus.ad.ufl.edu/ARC-ATLAB-BWQ -P /Library/Printers/PPDs/Contents/Resources/HP\ LaserJet\ 4250.gz");
system("cupsenable ARC-ATLAB-BWQ");
system("accept ARC-ATLAB-BWQ");

seems to throw warnings out is there a char that I put in it (IE: Perl has the "\" to make chars that that mean something in it act literally) to make it behave correctly?

and can I call a method or function fro a .sh file the same way I would a .m file?