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
2
votes
2answers
292 views

Using launchd to clear bash history?

Clarification: Am not looking to destroy history, am looking for means to periodically purge it via launchd for security purposes Have been using cat /dev/null > ~/.bash_history to clear bash ...
0
votes
1answer
41 views

Remove osascript starting after boot and get to know what it does

I am new to Mac and I have the following problem. After I log in after boot/restart, there is always a tab saying osascript wants to make changes which wants my password. I do not want to run this and ...
0
votes
0answers
17 views

When I run a .command by double click, can I pass it its directory? [duplicate]

I have a bash script that I want to run when I double click it, so I've renamed my script.sh file to script.command. The script now gets executed when I double click it, but its working directory is ...
0
votes
1answer
27 views

Any DynDNS client for current iOS for usage with nsupdate.info?

This is my first question here and my first experience with iOS. As a long-time Windows and Linux user, I have been asked to install a client (updater) for the dynamic DNS service nsupdate.info on a ...
0
votes
0answers
6 views

All the filenames of the songs in a Music.app playlist

I wrote a shell script to get the filenames of songs having a certain text in the comment tag. But apparently the tag is encrypted or something—grep -l string file cannot find any, and omitting the -...
-1
votes
1answer
33 views

Applescript fonction : «script» doesn’t understand the message

I have a script which work all the time when it's running outside a function tell application "System Events" tell process "theapp" set frontmost to true ...
9
votes
6answers
1k views

Convert bash script to a compiled standalone binary executable, not text

I want to make a Bash script executable by the kernel. I have already used the chmod +x command and #!/bin/bash to make it executable and it works, but that I want to do is make it an executable ...
0
votes
0answers
10 views

Temporarily halt logins while launchd is running a timed script

I have a launchd triggered timed script that checks if a user is not logged in and runs a one-time folder clean-up operation when they’re not. The script is fast, but I still don’t want the user ...
0
votes
0answers
18 views

How to remap specific keys (insert, fn, etc.) usint hidutil

I have a computer that I cannot download much 3rd party software to (I'm not supposed to – long story, just accept it). This means, no Karabiner, etc. Further, the generic solution of "system ...
-1
votes
1answer
39 views

Duplicating and renaming images using script

I need to duplicate and rename an image using a list of SKU codes from a spreadsheet as the unique name for each image. I have used the script from this answer Automate Duplicating and Renaming Images....
0
votes
1answer
82 views

How to use script to open an app if it's not the front most app, and hide it when it is the front most app in macos?

I need a script to open an app if it's not the frontmost app and hide(command+h) it when it is the frontmost app. e.g 'Kim.app' how to write this in Applescript or shell script? Here is some info I ...
0
votes
0answers
7 views

Is it possible to disable the gui controls in apple tv (former itunes) app for MacOS?

I got someone to help me disable amazon prime video's gui that shows up when you move the mouse and am happy with how it went, but I understand that works through browser and appletv is an app, would ...
1
vote
1answer
30 views

Finder shows executable shell scripts as Unix binaries

I am writing and using many shell scripts (bash) on my mac. One issue has been bugging me for a while. When I look at the scripts in the Finder, they come up as "Unix Binaries". If I tag a ...
0
votes
0answers
16 views

Applescript - calling another script, but property in said script is not updating

I have; script A, that wants to run script B. I want script B to save a file path to a property in that script. When I run script B in Script Editor the property updates as expected... but when I call ...
4
votes
1answer
50 views

Is there a way to make my macbook automatically execute a script every time I connect it to an external monitor?

I would like to make my macbook automatically connect to a specific wifi and launch Lunar everytime I connect it to my external monitor, and vice versa when I unplug it, but don't know where to start.....
0
votes
0answers
7 views

How to chain action of third party app to a short cut

I want to be able to chain several actions into a shortcut on mac. I'm on macOS 10.14.6 For example: Open Zoom, if not opened yet Start new meeting without video Share Screen of 2nd Desktop (ideally ...
1
vote
1answer
72 views

How can I script the bootup disk in macOS Catalina without disabling SIP?

I'm on Catalina 10.15.6. Previously, you could write shell scripts that would set the boot volume and restart the Mac, either by using bless --mount X --setBoot or by using systemsetup -setstartupdisk,...
1
vote
1answer
49 views

Block a built-in keyboard in macOS 10.15.6

I'm looking for some tool that would turn off a built-in MBP keyboard. I would like to put my Planck on it. I've already tried: Krabinier's disabled keyboard. Not an option. Karabinier interferes ...
0
votes
0answers
12 views

Can I temporarily disable keyboard entries on the lock screen?

I'd like to create an apple script that sends the computer to the lock screen and disables the keyboard for 60 seconds. This is what I have so far Lock the keyboard entries with KeyboardCleanTool Go ...
2
votes
2answers
248 views

syntax error near unexpected token `('

I was given a script to automate some processes. This script gets executed on a Mac in Terminal. The script is a bash script. However, Terminal is showing syntax error near unexpected token `(' in ...
0
votes
1answer
274 views

Catalina: How to add System Events to System Preferences > Security & Privacy > Privacy > Automation?

The problem In a script I'm using AppleScript to reload the browser when a change happens. I start this in the builtin terminal of my IDE, WebStorm. Since MacOS Catalina this yields the following ...
0
votes
3answers
117 views

Batch print with printer preset in MacOS

I have 50+ documents to print with the exact same printer settings and I'm trying to batch print them using the existing printer preset. What I've done so far: open all documents in one preview ...
0
votes
0answers
20 views

Automating sorting process for files in a folder based on same prefixes in their filenames

Okay, I have a directory that is the output directory for generated screenshots for a media player I use on a macbook (OS X High Sierra). I take a multitude of screenshots to review video files and I ...
1
vote
0answers
35 views

Mounting problems with autofs and executable maps

I wanted to replace my already existing and working autofs mount to my NAS with a script variant, which additionally wakes up the server via WoL if necessary and requests the password via keychain. ...
0
votes
1answer
65 views

I want to create a script in script editor that will press a key and then press enter every 60 seconds

I want to create a script in script editor that will press a key and then press enter every 60 seconds. However, I don't know how to make a script that presses a key. Does anybody know how to make a ...
0
votes
2answers
33 views

Using terminal and the open command I am trying to open a new browser instance followed by 2 tabs

I can open a new single instance using open -na "Firefox" --args --new-window "https://website.com" however I can't seem to get my script to open a second tab populated with a second url address after ...
2
votes
1answer
36 views

Query Apple's Servers for Update Using Script?

Is it possible to have a script or some sort of command-line tool that will query Apple's update servers to see what the latest version of an OS is? For example, I'd like to alert somewhere when a new ...
0
votes
0answers
34 views

How can I make a script containing passwords secure?

I have made a simple script : sysadminctl -adminUser AdminUserHere -adminPassword AdminPasswordHere -addUser NewUserNameHere -fullName "Full Name Here" -password NewUserPasswordHere Now the system ...
1
vote
1answer
57 views

Can I run a script in the background? (Apple script editor)

I have a script on apple script editor for a discord bot. (Discord is a chatting app my friends and I use) The discord bot is called "Dank Memer" and basically there are coins that you can get by ...
2
votes
0answers
25 views

Automatically copy files to a flash drive in terminal

I am trying to make a script that will automatically copy any files in the home directory with the extension .txt. What commands should I use in Terminal to search for and copy any txt files to a ...
0
votes
0answers
7 views

Scripting Mail.app

I use a service that regularly sends me an e-mail message containing a link to a downloadable file. The messages follow a standardized format that is easy to parse. Something like Standardized ...
0
votes
1answer
22 views

Need a script to connect to wifi based on user logged in

I know nothing of macs, just windows, but I need a script to connect to a specific wifi ssid based on the currently logged in user. Is this possible? This is not a school project; I need this for my ...
0
votes
0answers
21 views

A simple way to replace date created with last opened date? [duplicate]

I have a huge number of files that were copied into an old OS X 10.6 server. Problem is there are a large number that came over with a time last opened but no create or modified dates. Is there a ...
0
votes
1answer
28 views

Auto run a shell script when connecting to a network? (wifi or utp)

Is there a way to make macOS run a custom script whenever it (re)connects to any WiFi or Ethernet network? Basically, whenever my macbook connects to any network (wired or wireless) I would like to ...
1
vote
1answer
64 views

Extract e-mail addresses from large text file [closed]

Is there any way I could search through a load of text documents and extract the email addresses from it into one new document? I have this so far in Automator: #!/bin/bash Report=/Users/me/Desktop/...
0
votes
0answers
30 views

Create Multiple Output device via script or terminal

My Goal: I'm trying to let some "non-techy" users to share their internal audio in some applications. All would be done with some script or really, really basic actions (manually create a multi-out ...
1
vote
1answer
28 views

Trigger custom script on specific log message

I am using AirServer for Airplay on my Mac. As far as I know, AirServer does not provide an interface to run scripts on specific actions. However, I found a AirServer specific message inside the ...
0
votes
0answers
51 views

file not found error in shell script called from Automator

I want a shortcut to a script that merge video and audio. If I go in terminal to the directory documents/convert and run the script with ./script.sh everything works. If I copy the script in ...
0
votes
0answers
26 views

How can I set what computer uses the secondary monitor with a script?

I have two computers, an iMac 27" and a MacBook Pro, both running Mojave and a Thunderbolt 27" display. Both computers are linked to the external monitor through a thunderbolt cable. I primarily use ...
0
votes
0answers
23 views

Create GIF from Screenshots

Hello everyone, I need to create a program to take a set of screenshots and converrt them into a GIF. I've currently got this code in Shell which works, but the output is quite choppy. cd "~/....
0
votes
1answer
44 views

How can I write a script that opens a notification?

Is there an apple script that can click on the notification for me so that I don't have to open the app using a mouse? I plan to bind this script to a keyboard shortcut and that way I can open ...
0
votes
0answers
19 views

How to get the size of a file or directory in JavaScript for Automation

How do we get the size of a file or directory in JavaScript for Automation? I see some folder and item entries in the Dictionary, but I can’t figure out how to call them.
0
votes
1answer
32 views

how to set afplay as default media player for wma files in mac OS

Hi I am using a vim plugin named eblook which turns vim console into a dictionary. The problem is that the implementation of the plugin is using a default player for WMA file to play the sound file (...
1
vote
0answers
20 views

How can I fix my USB volume control from changing the volume two steps at a time?

I have this USB volume control, but when I adjust the volume, it adjusts it two steps at a time. When I connect it, it registers as a USB keyboard. My guess is that it is sending the "keypress" for ...
0
votes
1answer
137 views

How to use Launchd? [duplicate]

(sorry if this is a bad question. I am new to apple coding) I want to run a .scpt file at a specific time, once a day, every day using launchd (if there is a better way please tell me) I am running ...
2
votes
2answers
62 views

Applescript app keeps crashing

Whenever I try running this code it does not log the text. repeat set myTime to (time of (current date)) set precisetime1 to 82800 set precisetime2 to 84600 set ...
0
votes
1answer
40 views

Run Script Atomically

I have a launchd task that runs a bash script periodically, and this works great. However, if I change the script while the task is running, either by editing it directly, or swapping it with an ...
1
vote
1answer
21 views

“File is Locked” message for a folder with thousands of subfolders/files

After transferring a massive code project to my Mac, I noticed I couldn't write anything to the files inside due to the "File is Locked" plus an access denied message. Unlocking the root folder didn'...
0
votes
2answers
52 views

How do you git fetch all repos in a folder?

I keep all the repositories I work on in a folder on my machine ~/Code, and I want a script to execute git fetch && git status against each of the repos in that folder. I imagine that, if it’...
2
votes
0answers
26 views

How to script Catalina Security & Privacy Preferences

In my line of work we use LanRev for our remote management. However, with new machines using Catalina, we've had to manually allow Full Disc Access in order for remote control to work. Is there way ...

1
2 3 4 5
13