• 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: Resource folder of library script?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Resource folder of library script?


  • Subject: Re: Resource folder of library script?
  • From: Axel Luttgens <email@hidden>
  • Date: Wed, 12 Feb 2014 19:13:30 +0100

Le 12 févr. 2014 à 01:35, Jim Brandt a écrit :

> [...]
> Jörgen,
>
> That gets me the resource folder in the main script. I need to know it's location from within ScriptA, the handler. I want the handler to find files stored in it's own Resource folder, not the main script. After all, the main script already knows where the library file is, getting the resource folder to it is easy.

Hello Jim,

If I understood you correctly, your base problem arises because of the arbitrary location of a script bundle.

Perhaps could you try something along these lines?

1. Save your library (assumed here to be made of two handlers) as a script bundle, say "Macintosh HD:some:where:Lib.sctpd":

	on run {pth}
		return Lib's init(pth)
	end run

	script Lib
		property basepath : ""
		on init(p)
			set my basepath to p
			return me
		end init
		on Handler1()
			display dialog my name
		end Handler1
		on Handler2()
			display dialog my basepath
		end Handler2
	end script

2. From your application, supposed to somehow know your librarie's location:

	set libpath to "Macintosh HD:some:where:Lib.sctpd"
	set S to run script alias libpath with parameters {libpath}

	tell S
		Handler1()
		Handler2()
	end tell

This could be extended/enhanced several ways.
Or this is just not what you are looking for. ;-)

HTH,
Axel


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden


References: 
 >Re: Resource folder of library script? (From: Jim Brandt <email@hidden>)

  • Prev by Date: Re: Resource folder of library script?
  • Next by Date: Script Libraries in iCloud
  • Previous by thread: Re: Resource folder of library script?
  • Next by thread: choose file default location in OS X 10.8
  • Index(es):
    • Date
    • Thread