jxa-lib
    Preparing search index...

    Class Workspace

    A workspace that can launch other apps and perform a variety of file-handling services.

    Index

    Properties

    shared: Workspace = ...

    Returns the shared NSWorkspace instance.

    Methods

    • Check if an app is running by bundle ID.

      Parameters

      • bundleId: string

        The bundle identifier of the app to check.

      Returns boolean

      true if the app is running; otherwise, false.

    • Retrieves information about the specified file.

      Parameters

      • fullPath: any

        The full path to the desired file.

      • OptionalappName: any

        The app the system would use to open the file.

      • Optionaltype: any

        On input, a pointer to a string object variable; on return, if the method is successful, this variable contains a string object with the filename extension or encoded HFS file type of the file.

      Returns boolean

      true if the information was retrieved successfully; otherwise, false if the file could not be found or the app was not associated with the file.

    • Returns an image containing the icon for the specified file.

      Parameters

      • fullPath: any

        The full path to the file.

      Returns NSImage

      The icon associated with the file.

    • Returns an image containing the icon for the specified files.

      If fullPaths specifies one file, that file's icon is returned. If fullPaths specifies more than one file, an icon representing the multiple selection is returned.

      Parameters

      • paths: any[]

        An array of JXString objects, each of which contains the full path to a file.

      Returns NSImage

      The icon associated with the group of files.

    • Determines whether the specified path is a file package.

      Parameters

      • fullPath: string

        The full path to examine.

      Returns boolean

      true if the path identifies a file package; otherwise, false if the path does not exist, is not a directory, or is not a file package.

    • Start an application by bundle ID.

      Parameters

      • bundleId: string

        The bundle identifier of the app to start.

      • waitTime: number = 3

        The time to wait after starting the app, in seconds.

      Returns void