[Pyobjc-dev] stuck trying to build plist
Brought to you by:
ronaldoussoren
From: Roy N. <am...@gm...> - 2013-10-11 16:14:33
|
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") Thanks, -Roy Nielsen |