Re: stuck trying to build plist
Ronald Oussoren <[email protected]> Thu, 17 Oct 2013 12:14:18 +0200
| Newsgroups | gmane.comp.python.pyobjc.devel |
|---|---|
| Message-ID | <[email protected]> |
On 11 Oct, 2013, at 18:14, Roy Nielsen <[email protected]> wrote: > Hello, > > I'm trying to use SMJobSubmit - trying to convert the example at : > > http://www.stairways.com/blog/2012-08-06-smjobsubmit > > to python using pyobjc... > > I've gotten this far: > > 18 mylabel = "gov.lanl.example" > 19 > 20 authItem = [kSMRightBlessPrivilegedHelper, 0, None, 0] > 21 authRights = [1, authItem] > 22 flags = kAuthorizationFlagInteractionAllowed | kAuthorizationFlagPreAuthorize | kAuthorizationFlagExtendRights > 23 > 24 auth = None > 25 > 26 if AuthorizationCreate(authrights, kAuthorizationEmptyEnvironment, flags, auth ) == errAuthorizationSuccess : > 27 SMJobRemove(kSMDomainSystemLaunchd, mylabel, auth, false, NULL) > 28 > 29 ##### > 30 # To load a plist into a dictionary: > 31 #plist = NSMutableDictionary.dictionaryWithContentsOfFile_(os.path.expanduser(plist)) > 32 > 33 plist = NSMutableDictionary.dictionary() > 34 > 35 plist.setObject_forKey(mylabel, "Label") > 36 plist.setObject_forKey(NSNumber.numberWithBool(YES), "RunAtLoad") > 37 plist.setObject_forKey(executablePath "Program") > 38 > > I need to pass in some ProgramArguments... > > Would I do it by: > > plist.setObject_forKey([arg1, arg2, arg3], "ProgramArguments") Use plist.setObject_forKey_(value, key), or plist[key] = value The "_" at the end of the method name is important. Ronald > > Thanks, > -Roy Nielsen > > ------------------------------------------------------------------------------ > October Webinars: Code for Performance > Free Intel webinars can help you accelerate application performance. > Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from > the latest Intel processors and coprocessors. See abstracts and register > > http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk_______________________________________________ > Pyobjc-dev mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk