• 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
SB won't create an element on 10.5
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SB won't create an element on 10.5


  • Subject: SB won't create an element on 10.5
  • From: Fritz Anderson <email@hidden>
  • Date: Wed, 18 Nov 2009 13:13:32 -0600

I don't see a better list for Scripting Bridge — referrals welcome.

I am looking for a local-folder element in the Entourage application. If there is none, I want to create it. This works fine on my 10.6 installation, but not on my customer's 10.5. Both machines are Intel, running the same version of Entourage.

Here is the relevant method, in a category of SBObject. My customer swears he has a local folder named "Archive" already. The log output is as shown in the comments.

- (EntourageFolder *) archiveFolder: (BOOL) createIfNeeded
{
   NSAssert([self isKindOfClass: [gApp classForScriptingClass: @"application"]],
            @"Looking for archive from something other than Entourage itself");
   EntourageApplication *  app = (EntourageApplication *) self;
   EntourageFolder *       folder = [[app folders] objectWithName: kArchiveFolderName];
   if ([folder exists]) {
#if DEBUG_CREATE_10_5
       NSLog(@"archiveFolder: folder does exist.");	// Does not print
#endif
       return folder;
   }
#if DEBUG_CREATE_10_5
   else
       NSLog(@"archiveFolder: folder does not exist.");	// Prints
#endif
   if (! createIfNeeded)
       return nil;

   Class                   folderClass = [app classForScriptingClass: @"folder"];
#if DEBUG_CREATE_10_5
   NSLog(@"archiveFolder: creating Archive folder.");
#endif
   folder = [[folderClass alloc] initWithProperties:
             [NSDictionary dictionaryWithObject: kArchiveFolderName forKey: @"name"]];
#if DEBUG_CREATE_10_5
   NSLog(@"archiveFolder: initialized Archive folder (%@)", folder);	// Prints as future object
   @try {
#endif
       [[app folders] addObject: folder];
#if DEBUG_CREATE_10_5
   }
   @catch (NSException * e) {
       NSLog(@"Folder addObject archiveFolder: error %@\nReason: %@\nUserInfo: %@",
             e.name, e.reason, e.userInfo);
/* LOGS:
Folder addObject archiveFolder: error NSGenericException
Reason: Apple event returned an error.  Event = 'core'\'crel'{ 'kocl':'cFld', 'insh':'insl'{ 'kobj':'obj '{ 'want':'cFld', 'from':'null'(), 'form':'indx', 'seld':'abso'($206C6C61$) }, 'kpos':'end ' }, 'prdt':{ 'pnam':'utxt'("Archive") } }
Error info = {
   ErrorNumber = -10014;
}
UserInfo: {
   ErrorNumber = -10014;
}
*/
   }

   NSLog(@"archiveFolder: inserted Archive folder (%@)", folder);	// Prints as future object
#endif

   return [folder autorelease];
}

I know Scripting Bridge @throws for AppleScript errors only on 10.5. It's for debugging only.

Error -10014 is errAENotASingleObject, indicating that addObject: (actually crel, create element) went to more than one object. It _looks_ like the location is something like "end of ALL folders," but I don't know why the form is 'indx'.

That 'abso' of $206C6C61$ (' lla') is an endian-swap of the 'all ' constant. It worries me.

Setting NSScriptingDebugLogLevel to 1 in the global, Entourage, and my-application defaults had no effect at all on my 10.6 machine. So I can't see whether the 10.6 core/crel is different.

I'd appreciate any help at all.

	— F


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: SB won't create an element on 10.5
      • From: Fritz Anderson <email@hidden>
    • Re: SB won't create an element on 10.5
      • From: Kyle Sluder <email@hidden>
  • Prev by Date: Re: [iPhone] UITableView section header title color
  • Next by Date: Re: Question about Style wrt "private" methods
  • Previous by thread: Re: [iPhone] UITableView section header title color
  • Next by thread: Re: SB won't create an element on 10.5
  • Index(es):
    • Date
    • Thread