Name

path to resource

Synopsis

bundle resource location

bundle resource location

Locates a file in the Resources folder of a bundle. Intended primarily for script bundles and applet bundles (and AppleScript Studio applications), so they can see inside themselves; doesn't work in Script Editor, but works fine in Script Debugger. You can optionally designate any bundle to look in (such as an application), and a subfolder within the bundle.

Examples

display dialog ((path to resource "description.rtfd") as string)
-- feathers:Users:mattneub:Library:Scripts:myScriptBundle.scptd:Contents:
    Resources:description.rtfd
set f to path to resource "app.icns" in bundle ¬
    alias "feathers:Applications:Mail.app:"
display dialog "Time to check your mail!" with icon f

Get AppleScript: The Definitive Guide, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.