banner 728x90

Create context menu items in Mac Finder

In Mobile Web Development 34 views
banner 728x90
create context menu items in mac finder - Create context menu items in Mac Finder

How much I also practice my assignment skills, for many tasks, I prefer to click on a time or two . The problem is that installing brewing installation and other package managers do not come with UI expansion capabilities … so well-informed people like us need to find a way to unravel them. functionality in a user interface. The UI on Mac is Automator; let's investigate how to add custom context menu items to macOS Finder!

Create a context menu item with Automator

The example we will use is to create a context menu to unravel archives of rar . The following steps will help you to add a context menu in MacOS Finder:

  1. Open Applications -> Automator
  2. File -> New in the menu bar
  3. Select a Document Type Service

    gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== - Create context menu items in Mac Finder

  4. In the top panel of the right pane select files or folders from the first drop-down list and then Finder.app from the second drop-down menu.
  5. Select in the left panel Run Shell Script

    gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== - Create context menu items in Mac Finder

  6. When the Run Shell Script box appears in the right pane, change the value Pass input in in arguments .
  7. Now you can write which shell scripting you want, and you receive the file arguments as $ @ . My script to undo files is overly simple:
    # Enter the first file folder
    current_path = $ (dirname "$ 1")
    cd "$ current_path"
    
    # Delete the current folder for each file
    for f in "$ @"
    do
    / usr / local / bin / unrar x "$ f"
    done
    
    # Exit 0, so that annoying errors do not appear
    exit 0
    

    gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== - Create context menu items in Mac Finder

    You can add additional controls to ensure that the file has the correct extension and other validation with a little more scripting.

  8. File -> to save in the menu bar to save the Automator task. The name with which you save the job is what appears as the context menu name.

Debugging and testing of the context menu item

The best method for testing and debugging an Automator task is by adding additional actions to the task to simulate real-time use. In our case, by adding an action select certain search items to validate a file and test the outcome of the action:

gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== - Create context menu items in Mac Finder

Automator delivers error and success messages when performing tasks, a luxury that may not offer the context menu. If you are satisfied that your Automator job is working properly, remove all temporary debugging actions you've taken.

Use the context menu item

Right-click files or folders in Finder (in our case only .rar files) and choose Services -> (Your Job Name Here ):

gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== - Create context menu items in Mac Finder

Your task will be performed in the background.

While I'm proud to improve my command-line skills, I would like to have researched Automator's tasks many years ago. Downloading a file to the winner and then jumping to the command line is sometimes inconvenient – sometimes it's just fun to perform a few clicks instead of remembering commands and argument formats.


  •  How I Quit WordPress Comment Spam

    How I Quit WordPress Comment Spam

    ] I like almost every part of a tech blogger: learning, preaching, scolding, researching. The only part about blogging that I do not really like: handle SPAM comments. Over the last two years my blog has registered 8000+ SPAM comments a day. PER DAY. An inflated database …

  •  7 Essential JavaScript Features

    7 Essential JavaScript Features

    I remember the first days of JavaScript, which required almost all of you a simple feature because browser providers implemented different features, not just border functions, basic features like addEventListener and attachEvent . Times have changed, but there are still some features that every developer should have …

    • ] Create a Dynamic Flickr Image Search with the Dojo Toolkit “/>

      Create a dynamic search feature on Flickr images using the Dojo Toolkit

      The Dojo Toolkit is a treasure chest of great JavaScript classes. You can find JavaScript base functionality classes for AJAX, node manipulation, animations, and so on in Dojo. You'll find elegant, functional UI widgets like DropDown menus, tabs interfaces and substitutions of form elements within …

    •  GitHub Style Glide Links “/>

      GitHub seems to change a lot, but not really to change if that makes sense; The updates are often, but are always quite small. I have seen one of the most recent updates on the pull request page. Links to the long branch …

<! –

->

banner 728x90
author
Author: 
    Script & Style Show: Episode 1: Marc Grabanski
    Script & Style Show: Episode 1: Marc Grabanski
    During this second episode of the Script
    AWS AppSync region expansion and new functions for API keys
    AWS AppSync region expansion and new functions for API keys
    AWS AppSync, a managed GraphQL service with
    What is the best time to involve your mobile app users?
    What is the best time to involve your mobile app users?
    When talking to customers about mobile analysis,
    How to make a Twitter bot with Node.js
    How to make a Twitter bot with Node.js
    Twitter bots have been in the news

    Leave a reply "Create context menu items in Mac Finder"

    Must read×

    Top