• 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
Re: Won't Applescript command use defined ivars?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Won't Applescript command use defined ivars?


  • Subject: Re: Won't Applescript command use defined ivars?
  • From: Scott Ribe <email@hidden>
  • Date: Wed, 31 Aug 2011 09:15:55 -0600

On Aug 31, 2011, at 8:58 AM, Chris Paveglio wrote:

> But I am going to need the application to use the instance of the class from when it's started, not make a new instance every time the script command is given.

Well, that's not likely to happen, because that's not the way the framework works.

> I have to connect to a database, and for performance, would rather not have to create/open/use/close/destroy that connection every time it's called (could be called a lot). I would rather have the connection created and ready to use, and then just pass in my calls as needed, until the app quits (it's going to run in the background).

Fine, create it at startup, or on first need, and keep it around. Use a static variable, or some ivars & methods in your app controller class, or create a singleton class (although I don't recommend all the hoohah of enforcing singleton-ness, just create one at startup and keep it in a global variable). You don't have to, and probably shouldn't, stuff all your database connection management into a subclass of an AppleScript command anyway--probably better to abstract that into a class that deals with the database.

--
Scott Ribe
email@hidden
http://www.elevated-dev.com/
(303) 722-0567 voice




_______________________________________________

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

References: 
 >Won't Applescript command use defined ivars? (From: Chris Paveglio <email@hidden>)
 >Re: Won't Applescript command use defined ivars? (From: Martin Wierschin <email@hidden>)
 >Re: Won't Applescript command use defined ivars? (From: Chris Paveglio <email@hidden>)

  • Prev by Date: Re: Long delay of NSPopUpButton first click
  • Next by Date: Re: Long delay of NSPopUpButton first click
  • Previous by thread: Re: Won't Applescript command use defined ivars?
  • Next by thread: Re: Won't Applescript command use defined ivars?
  • Index(es):
    • Date
    • Thread