• 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
Scripting Bridge Strange Pauses
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Scripting Bridge Strange Pauses


  • Subject: Scripting Bridge Strange Pauses
  • From: John Nairn <email@hidden>
  • Date: Wed, 15 Sep 2010 22:50:08 -0700

I have been having problems calling my Cocoa app with Python scripts through the Scripting Bridge. To test further, I wrote the following Cocoa code to use the Scripting Bridge. For a large file (over 7000 elements in the SBElementArray recs variable) it runs smoothly until 77% completion and then stops. I thought it had crashed, but one time I waited and after a 2 minute pause, it starts up again and runs smoothly to 100% completion.

So what is wrong with the Scripting Bridge in long scripts? I get these pauses in many scripts and thus is not related to the specific calls in the sample script. I test some I thought were crashing again and so far all start up again, but some pause for over 5 minutes.

// get application, front document, and list of some app objects
id gedit = [SBApplication applicationWithBundleIdentifier:@"com.geditcom.GEDitCOMII"];
id gdoc = [[gedit documents] objectAtIndex:0];
id recs = [gdoc individuals];


	// loop and do something minor
	int i, numBdate=0, numIndi=0, numRecs=[recs count];
	float fractionStepSize=0.01, nextFraction=0.01;
	for(i=0;i<numRecs;i++)
	{	id indi=[recs objectAtIndex:i];
		if([[indi recordType] isEqualToString:@"INDI"])
		{	numIndi+=1;
			int emin=[indi birthSDN];
			int emax=[indi birthSDNMax];
			if(emin!=0 && emin==emax) numBdate+=1;
			// print progress
			fractionDone = (float)i/(float)numRecs;
			if(fractionDone > nextFraction)
			{	NSLog(@"%f ",fractionDone);
				nextFraction = nextFraction+fractionStepSize;
			}
		}
	}

------------
John Nairn
http://www.geditcom.com

_______________________________________________

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: Scripting Bridge Strange Pauses
      • From: Dave Keck <email@hidden>
  • Prev by Date: Re: Very Simple Demo: Modal Dialog causes later Modal Session to Crash
  • Next by Date: Re: Scripting Bridge Strange Pauses
  • Previous by thread: Re: keyDown:theEvent
  • Next by thread: Re: Scripting Bridge Strange Pauses
  • Index(es):
    • Date
    • Thread