Questions tagged [script]

A collection of commands that may be from a CLI Shell, or programming language such as AppleScript, which are executed in order with limited iteration, usually as a way of automating actions or events.

Filter by
Sorted by
Tagged with
1
vote
1answer
55 views

Permanently change zsh environment variable on macOS Big Sur?

I tried to customize the ZSH terminal shell (e.g. prompt, auto-completion behavior) by editing the ZSH files, but failed. I have tried both the following, and none worked: Edit ~/.zshrc: When I tried ...
1
vote
1answer
45 views

How to launch two terminal commands with delay thru applescript or automator?

I need to launch two terminal commands thru applescript/automator with delay between them. Absolutely don't know how to do it thru applescript, so I tried to do it thru automator and here what it ...
3
votes
0answers
48 views

Detect macOS beta using script

In a shell script, how can I tell whether or not the script is running on a (public) beta version of macOS? Preferrably, I would like to check this without matching a specific version of macOS, since ...
0
votes
0answers
21 views

How to create a file that will start 3 different instances of iTerm (or 3 different windows in iTerm) and run a command in each one of them?

Every time I restart my mac I have to open a bunch of iTerm windows/split panes and in each one of them run some commands to start my project. How can I do that in macOS?
0
votes
0answers
18 views

How to execute rc.local at boot

Found this in an old threat. But it did not work as described here. What I want to do in the end is to start my own daemon from rc.local. I am running OSX 11.5.2. So I created the file ls -l /Library/...
0
votes
1answer
26 views

Check that a network Mac is powered on (to start backing it up)

I have recently installed in my home's basement near my router an old iMac on High Sierra to be a server helping the other macs. This server is always on and running. It performs certain current tasks ...
0
votes
0answers
6 views

local music app api for updating playlists and track ratings

are there any APIs/ Library Parsers/ programmatic ways to: create playlists (ideally in playlist folders) update playlist contents update track ratings or actually any kind of resources on how to do ...
0
votes
0answers
16 views

How to autostart and repeat a script on macOS login

I'm using Emacs mu4e, it needs an external program like getmail to fetch POP3 emails. I need to execute a shell script command: getmail --getmaildir=~/.config/getmail/ --rcfile=example@gmail.com How ...
0
votes
0answers
27 views

Is there a good way to automate periodic exporting from the Stick 'em Up application?

I'm using an application like Sticky Notes (Stick 'em Up) which has an export feature. I would like to automate a nightly export of the contents. What's the best technology for this - Automator, ...
0
votes
0answers
16 views

The Automator website search service I found on AskDifferent breaks in Apple Music/iTunes, how do I fix it?

I made a shortcut to run from the contextual menu. I want to use it in iTunes Apple Music to search discogs for certain albums and singles. I copied this workflow. I modified the code to suit my ...
0
votes
2answers
102 views

macOS shell script check. A better way to execute the if statement and check for a condition

I need to write a very simple shell script that will check if the system is configured to enforce multi-factor authentication. To verify that the system is configured to enforce multi-factor ...
0
votes
0answers
30 views

Where to find the unread message count in chat.db for messages.app

I'm trying to find the number of unread messages in messages.app. The number should match the number on the badge of the app. I've approached this by accessing chat.db, a sqlite db which lists all ...
0
votes
1answer
24 views

Can't use "open location" when it's part of a longer script

The following script works fine to open a URL in my default browser: open location "https://google.com" However, I've got an existing script to grab a URL from my Terminal window to open it ...
0
votes
1answer
45 views

Launch DMG drive script failing after restart

I have an automation (screenshots of it here: https://www.icloud.com/iclouddrive/0bB-1AiIWdJc1jmkfdjRbsAVA#Launch_Plex_Media_Automation_ )saved as an app in Automator with the following AppleScripts ...
0
votes
1answer
54 views

Hiding default folders via launchagent: not applying to documents

Bit of an odd one. Our organisation needs to allow some aspect of local storage access to accommodate work on large files without constantly writing to network drives. They work on these files and ...
0
votes
1answer
57 views

Running a script as sudo wihout terminal

I'm working on a tool for a client which needs to be run as sudo (I found out later that it doesn't work without sudo as I've never worked on a Mac before). I have the binary ready, and I wrote a ...
0
votes
0answers
43 views

How to list top 10 process/services in terminal

I'm trying to run a command every 5 min to check the top 10 services/process that are using more CPU. I would like to run the script and save the result in a file and after 5 min add the new result in ...
1
vote
0answers
29 views

Using launchd to run script once a day when logged in

I'm in the situation where I would like to run a script only once per day when I open my MacBook. I guess I could have the script note the date it was last run, and have it reject when run on the ...
1
vote
1answer
1k views

Running shell or Bash scripts with zsh on macOS v11 (Big Sur)

Every time I need to run a shell script, I need to enter chmod +x <filename> For example, if I want to run this sample script named "run", #!/bin/bash javac --version I have to go ...
1
vote
0answers
56 views

Apple Notes: Could someone help write a script for me that opens Notes.app, creates blank new note, opens note in sep window, bring to front?

The kind of shortcut I'm looking for is essentially: double-click an icon on right screen, launch "NEW NOTE", POP it to FRONT, so I can immediately begin typing or paste my selection into. I'...
2
votes
1answer
56 views

Run script every time the system's default gateway changes?

I'd like to run a script every time my mac's default gateway changes. For example, I'd like it to run if my internet connection changes from Wi-Fi to ethernet, if it disconnects or reconnects, or if I ...
0
votes
2answers
54 views

Service to underline plain text with a line of dashes

I am looking for a text service that I can call from a plain text editor (BBedit for example) and will operate the following modification: Before: This is a line of text After: This is a line of text ...
0
votes
0answers
21 views

Security Prefpane crashes - but why?

I also asked here: https://discussions.apple.com/thread/252766813 I wrote an applescript which requires access to disks. But when adding it to the allowed applications, the security prefpane crashes. ...
0
votes
2answers
91 views

Script to mount exfat drive

hope you are doing great. I´m using a Macbook pro 2019 with Big Sur and I have all my photos and videos in a external drive formatted in ExFat. Each time I have to mount the disk I need to run this ...
3
votes
1answer
32 views

Determine an SSIDs Index Value in the Preferred Networks List

Im looking for a way to use the macOS networksetup command (and some string/line filtering mojo) to output all SSIDs from the Preferred Networks, and then determine what index my corp SSID is located ...
0
votes
1answer
76 views

iOS 14 how to use "Open Wallet" and "Open Apple Card card" in automation and script

Does anyone have an example or some pointers on using iOS 14 automation, shortcuts and scripting to open the wallet app and retrieve data from Apple Card?
0
votes
0answers
19 views

/bin/sh Application Never Prompts User for Access Via TCC Mechanism but Explicitly Granting Access Via System Preference Allows Access

We have a macOS application bundle (signed, notarized per Apple) that launches a /bin/sh script. When this application accesses TCC (Transparency, Consent, and Control) restricted resources (e.g., ...
0
votes
0answers
11 views

How to disable auto spellcheck options programmatically?

I would like to write a shell script that runs on macos BigSur where I can access and modify settings you set in System Preferences. I basically want to disable any nuance of auto-correct. In order to ...
0
votes
0answers
19 views

Create a jpg with date in the middle and change it. Mac and bash

I'd like to have the date in large letters as a wallpaper that'd change everyday. I've watch some apps but I dont want to install anything. I was wondering: Can we create a jpg or png with a timestamp ...
0
votes
0answers
40 views

How to automatically type pre-defined text with a simple command on IOS?

On IOS 14.4 or above, is there any way to automate/simulate the process of entering text into the currently focused textfield, (even a password textfield)? In an ideal world, with the text cursor ...
2
votes
2answers
64 views

How to script Network Preferences using the CLI

As the title implies for development I enable/disable Web proxies, however doing it through the UI is slow and cumbersome its also pretty inflexible. I'm looking to control the following checked ...
0
votes
1answer
35 views

Forklift Tools syntax

In Forklift there is an Tools option, which allows to make quick actions. But I don't really get how to create one. For example a simple one - to copy files from one pane to another. cp $...
0
votes
2answers
33 views

Reading through an array

I'm trying to systematically remove profiles on some systems that were manually installed from github. I'm going to do so with a policy from my MDM that runs a script, however, I can't get the script ...
1
vote
1answer
105 views

Hotkey to switch to Google Chrome and go to the omnibox (location bar)

I would like to setup a keyboard shortcut/hotkey that would switch to Google Chrome and go to the omnibox (address bar). I intend to use it invoke various custom search engines. I found a couple of ...
0
votes
2answers
97 views

How to quote a path variable "$1" that contains spaces?

I am calling a script from a script and passing a positional argument {folder} — whose value is a path that contains spaces so it needs to be quoted. The second script is: #!/bin/bash -xu find "$...
0
votes
1answer
53 views

Network services deleted via terminal reenabled after Restart

I have written a shell script to remove all services excluding ethernet. The aim is to remove these services and PPPoE entries so the end user only sees ethernet under Preferences > Networking. ...
0
votes
1answer
36 views

Perform an action when bluetooth keyboard is connected or disconnected

I am trying to write a script that can detect when a bluetooth keyboard is connected or disconnected from my mac and perform an action. The keyboard is a Logitech MX but I don't want my script to be ...
0
votes
0answers
16 views

Script for compressing Files within Outlook

To prefice, I have no background in scripting whatsoever I'm trying to create a script that goes into the directory for Outlook and compresses files that are taking up a lot of space. I was able to ...
0
votes
0answers
23 views

Apple script that changes the destination folder of airdropped files is not working with large selection of images being airdropped?

I'm using the script below to move airdrop images into a different folder. This works if i send a low number of images but does not when i send amounts like 100 or more, which i do regularly for work. ...
0
votes
0answers
31 views

Stopping a script pasted into and running through BTT (bettertouchtool)?

I have a python script that runs continously once turned on that I can turn on with a shortcut in BTT (bettertouchtool), but once it's on, I have no way to turn it off, it's pasted into the program, ...
1
vote
2answers
149 views

AppleScript App to start a Slideshow in Finder

I want to write an AppleScript App that starts a full screen slideshow with all pictures in the currently active folder in Finder (on Big Sur/Apple M1). Manually, in Finder I would have to open a ...
0
votes
0answers
12 views

Modifying Apple Photos script for duplicating folder hierarchy (including subfolders)

I've found this piece of script online to automatically duplicate a smart album in a folder (with a name containing <!>) to a normal album in a folder 'SmartAlbums' (so it can sync to iPhone &...
0
votes
0answers
54 views

Script creation of Automator Quick Action and keyboard shortcut

I love the functionality described in How do I assign a keyboard shortcut to an AppleScript I wrote?, i.e. creating a "Quick Action" (a.k.a. "Service") using Automator and mapping ...
0
votes
0answers
45 views

Creating A Shortcut/desktop Icon To Run dotnet console application

Total newb to macs here... I've got a dotnet application that runs on my macbook. I can manually open a terminal and run dotnet myapp.dll and the application runs. I've put that single command into a ...
1
vote
1answer
36 views

AppleScript and shell script issue

I used to run a shell command with AppleScript for authentication to a radius server, this was running fine as I could specify a parameter for the password. the shell process was updated and don't ...
3
votes
1answer
97 views

Script menu: how to reference user-path utilities (PATH / environment is missing)

Summary How can I execute scripts from the system-wide Script menu with a normal environment? It seems the environment is not being setup at all. Scripts that are run from the script menu can find and ...
0
votes
1answer
123 views

How can I have a key pressed at a specific time?

I want to press a certain key (e.g. 'p') in a certain time (e.g. at 00:00), how can I accomplish this? I'm aware of Can a Mac be programmed to simulate pressing a key at a certain rate via software? ...
0
votes
0answers
19 views

Organize my existing Mac Photos library

I have seen multiple scripts to import files into Mac application Photos organising photos in folders and albums. Like This 2010 (folder) 2010-01-01 (album) 2010-01-02 (album) ... 2011 (folder) ...
0
votes
1answer
86 views

Applescript osacompile fails if user input contains apostrophe / single quote

I have created a script which takes some user input from me (prompts with basic dialogs), then generates a standalone script that sends me a text message and an email, which I can then schedule as a ...
1
vote
1answer
131 views

How to make Dia (which uses X11 / XQuartz) work?

When installing Dia, either through brew install dia or downloading the DMG from the Dia site, I could run it once. On the second run, I got this: (dia-bin:5065): Gtk-WARNING **: cannot open display: /...

1
2 3 4 5
14