Giter Club home page Giter Club logo

osaxfinderlib's Introduction

OSAxFinderLib

The OSAxFinderLib Swift package provides both a library and a command line tool for fetching the URLs of the currently selected items in the macOS Finder.

Motivation: The current macOS Swift APIs (e.g. FileManager and NSWorkspace) do not provide access to the currently selected Finder URLs.

Declaration

final class OSAxFinder

Topics

Initializers

  • init(arguments: [String])

    Supports library use by a command line tool

Command Line Tool Support

  • func run() throws

    Supports library use by a command line tool

Instance Methods

Enclosing Directory

  • func dirOfFirstSelectedFile() -> URL?

    Fetch the URL of the first selected file

  • func dirOfFrontWindow() -> URL?

    Fetch the URL of the front Finder window. Returns nil if no window is open.

General Selections

  • func selectedFileUrls(extensions: [String]) -> [URL]

    Fetch the URL of the selected files and folders which have one of the specified extensions. The extensions are provide without a . dot. For example: ["jpg", "png"]

  • func selectedFolderUrls(suffixes: [String], withAliasToDir: Bool, onlyValid: Bool) -> [URL]

  • func selectedUrls(endings: [String]) -> (dirs: [URL], files: [URL])

    Fetch the URL of the selected files and folders which have one of the specified extensions. The extensions are provide without a . dot. For example: ["jpg", "png"]

  • func selectedUrls() -> [URL]

Specialized Selections

  • func selectedHtml() -> [URL]
  • func selectedImages() -> [URL]
  • func selectedMarkdown() -> [URL]
  • func selectedPdf() -> [URL]
  • func selectedPdfSorted() -> [URL]

Workflow Methods

  • func selectedItemsJson(printStdio: Bool = false) -> Data?

    • Step 1. Fetch all selected items in JSON format
    • Returns: all selected items
  • func selectedItemsList() -> [OSAxFinderItem]

    • Step 2. All selected items as OSAxFinderItem
  • func selectedItemsUrls( files: Bool, folders: Bool, aliases: Bool = false, links: Bool = false, validOnly: Bool = true ) -> [URL]

    • Step 3. Selected and filtered URL array.

Resources

See man pages for more information on osascript, osacompile, osalang.

osaxfinderlib's People

Contributors

marc-medley avatar

Stargazers

 avatar  avatar immateria avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.