• 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: Portability of the "Every Application Library"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Portability of the "Every Application Library"


  • Subject: Re: Portability of the "Every Application Library"
  • From: Jens Eliasson <email@hidden>
  • Date: Sun, 12 Sep 2004 12:41:38 +0200

Jason,
Basically the answer is yes. But as close to always there are ways around the obstacles.


What happens when you do load script is that you get that script in a script handler of its own, as you may know. You can accomplish the same result by storing a script that you have loaded in a property. As long as it isn't called it doesn't look for applications.

In order for your applet to never use the automatic search for applications you need to do a couple things in order to have the complete functionality in one applet. Actually in OSX there are two alternatives two this.

Alternative 1 (that works in all versions of MacOS):
1. Construct your script so that it always checks processes and/or the Application folder or something else that is local, not to tedious and rule that is easily followed by the users of the script, and launches the application via System Events or Finder before it calls the script handler where the application specific code is located.
2. Keep the script for each application in a file of its own while you develop, but make a property for each of them in your main-applet.
3. In the run handler of the main applet: check if the script properties are empty and load the scripts and save each of them in its property. You may add a version property in each script and check if they exist and load updated scripts for a more luxurious functionality.
4. Keep in mind that changes to properties are saved to disk when the script is quit. So if you want the scripts to start fresh every time, you better copy them to global variables that you use instead. (You know that set makes a reference to the original and copy makes a new object no strings attached.


I have used this type of design quite a lot - with success. Building further on this idea is really the closest you come to an object oriented design in AppleScript and for the right type of solutions it serves well.

Alt. 2 (for OSX):
1. Exactly the same.
2. Keep the scripts for each application in its own file as above but save your main applet as a package and make a folder inside the package where you put the supplemental scripts. As in alt. 1 you could make a check in the run handler of the main applet that check its contents and copies the files by itself.
3. Use the "path to me" in the main applet to handle the files inside the package.


I've also done this a few times lately and it is a bit simpler.

Regards/
Jens Eliasson, <email@hidden>

2004-09-12 kl. 03.58 skrev Jason Bourque:

I have a library that I load into scripts.
I works great. It has handlers to a lot of different apps.

Then I gave it to a co-worker. The script starts asking for where are those
missing applications even if those handlers are not used the in requesting
script.


Is there any way around this, or do I have to create a Library file for each
application?


Thanks,

Jason Bourque

_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Portability of the "Every Application Library" (From: Jason Bourque <email@hidden>)

  • Prev by Date: Re: Mount remote volume
  • Next by Date: Re: Mount remote volume
  • Previous by thread: Portability of the "Every Application Library"
  • Next by thread: Percentage Math help for a Script
  • Index(es):
    • Date
    • Thread