Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

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
0answers
32 views

Script Editor shows Error: No Error in JavaScript code for sending email

I am trying to learn how to create automation scripts in macOS with the JavaScript language. I was trying to figure out how to make a script that would send an email. Everything seemed to be going ...
1
vote
0answers
30 views

Batch compress contents within a folder using Mac Automator

I've seen an automator service that can zip multiple folders into separate zip files: Batch compress multiple folders into individual zip files Can this be modified to enter the folder, compress the ...
0
votes
2answers
87 views

Call Shell script from Automator on Catalina

I created a Automator Program wich connect me with vpn an sets routes for split tunneling via Shell script. The Program works fine on Mojave - now with Catalina the call do shell script "sudo /...
0
votes
1answer
44 views

Apple Script: 'activate' an application in fullscreen

Im trying to run tell application "X" to activate on an application that is running in fullscreen, but its not working. Any ideas on how I can work around this and give focus to a running app in ...
0
votes
2answers
47 views

How to iterate items of the window with dynamic title

I am trying to get all rows from a table of the application. set ProcName to "AppName" tell application ProcName to activate tell application "System Events" tell process ProcName tell ...
2
votes
1answer
56 views

How can I select all files of a type in a non-Finder, application window?

The Applescript below looks at the front open finder window, finds the file type of a file that is selected, and then highlights all files of that file type. I.e., if a finder window has a mix of .jpg,...
1
vote
1answer
45 views

Create an automator script to create folder + move files into created folder

Looking to create a service in Automator so when I select multiple files in the Finder, I can in one right-click create a new folder and move the selected files into that newly created folder. This ...
2
votes
1answer
64 views

Terminal Speedtest Script MacOS

I am looking for a Terminal Script for MacOS to monitor my bandwidth and ping etc. like this (linux) -> https://gitgud.io/J0s3f/speedtest_cron/tree/master I have the speedtest-cli installed via ...
0
votes
0answers
46 views

Bash error using basename

I'm running the Trouton script to change an Mac bound account to a local one but keep getting the error: Expected expression but found unknown token. Tried others syntax fixes but to no avail. ...
1
vote
0answers
23 views

AppleScript and Mail: Weird selection behaviour?

I) Intro In AppleScript, when - for example - I do tell application "Mail" set mselection to selection as list tell application "System Events" tell application "Mail" ...
1
vote
1answer
42 views

How to zip a script-file for MacOS under Windows and give it correct attributes?

I am working under Windows 10 and am putting together a few data-files and a simple bash-script that I want to share with Mac-Users. (I am just learning MacOS, so may have drawn wrong conclusions ...
2
votes
1answer
56 views

Applescripting Numbers to save, close and quit in an App instead of the Script Editor

After using Applescript to add a new row with data to a Numbers document, I'm trying to save and close the document and then quit Numbers. Using the script below to save, close and quit Numbers works ...
2
votes
0answers
35 views

Keyboard shortcut for in-application action (Spotify play/pause) from another application

Is there a way to write a script, get an app, automator, or etc that would make spotify play/pause with a keyboard shortcut such as cmd+alt+shift+p that would work from outside of Spotify? In other ...
1
vote
1answer
28 views

Cron job running (?) and output file is being logged every night at 1:35am, but there is nothing listed in crontab -l

I recall creating a cron job that runs a shell script that deletes files that are 45+ days old. When I was editing crontab -e I set it to also output a log to a date stamped log file to ~/Logs. I ...
1
vote
2answers
176 views

Command in bash shell script to find path to that script?

Is there a command to go inside a bash .sh script that will provide the full path to the directory containing that script?
0
votes
0answers
22 views

Relaunch a script upon file changes

I have a script - bundle exec faktory-worker -r ./config/environment.rb - that continuously runs. I want the script to be killed - ctrl+c style - and relaunched any time a file within ./workers ...
0
votes
0answers
24 views

osa script to get user input with if condition

I want to run osa script to run in self-service application. first this line needs to be displayed: osascript 'tell app "System Events" to display dialog "Save and close all your files and ...
0
votes
0answers
30 views

Applescript service which utilises “on idle”?

I have been trying to run a script on a recurring basis via an apple service. Most answers I have seen have been are for 'stay-open' apps - whilst this possibly works as a solution and I have glanced ...
0
votes
1answer
71 views

No Prompt & Password Fill Install for Homebrew

I'm trying to create a script to deploy macOS and the last piece that isn't automated is installing Homebrew. Because of the unique scenario where Homebrew shouldn't be installed with sudo, and it ...
-1
votes
2answers
31 views

Unminimize window Apple script not working when upgrading from El capitan to Mojave

I have an Apple script that I found somewhere that unminimizes windows. It worked on El Capitan but now it doesn't in Mojave. I assume there was a change of syntax but I know nothing about apple ...
0
votes
1answer
33 views

Automatically download software update over a specific network

I want my mac to automatically download updates for me only if I am connected to a specific WiFi network. Is this possible with a script? If so, how?
2
votes
1answer
56 views

Can I tell Terminal that it is allowed to kill processes if asked?

Mojave on my iMac routinely applies its own updates and reboots itself, with most running programs returning to a reasonable copy of their pre-reboot state. That's fine, especially since these updates ...
0
votes
2answers
61 views

How do I write folder-agnostic shell script on Mac as I can do in Windows?

I would like to write a set of shell scripts which would execute smoothly on Mac disregarding where they are called from. I am currently struggling about how to implement this. On windows, I could ...
0
votes
1answer
171 views

dsconfigad returns error “authentication server could not be contacted. (5200)”, but GUI domain join works without a problem

So I've built a "script", to deploy using JAMF. It is pretty much a single command. It looks like this: dsconfigad -add "SERVERNAME" -force -computer "COMPUTERNAME" -domain "SELECTED_OU" -username "...
3
votes
3answers
166 views

Mac OS X - Bash script if statement based on system status

Creating a bash script and using the if statement, how do I execute a command based on a system status? if a specific system status is enabled do something, else do something different? I give you a ...
1
vote
1answer
71 views

How do I stop an AppleScript script that is stuck in an endless loop without restarting my Mac?

I stupidly ran an AppleScript script on my Mac running macOS Mojave and the script is running in an endless loop. I thought something obvious like pressing the Esc key would end the program. However, ...
1
vote
1answer
132 views

change all .sh files to executable by terminal

i hate retyping chmod +x filename and insect to run from terminal. how do i set this for all .sh files ? I've tried Inspect then manually setting the extension
3
votes
1answer
150 views

Is it possible to send a text file from terminal to the Notes App on MacOS?

I like how my notes in the Notes App gets synced via iCloud. I spend most of my time in the terminal during the day, so it's convenient for me to keep notes in a text file. At the moment I simply copy-...
2
votes
0answers
73 views

Create Local Network Directory User on OS X server via Terminal

I found this post: How can I create an Open Directory network user with a command? but it didn't have any answers on it. I know there's a way to create a local network directory user, but I cannot ...
10
votes
2answers
802 views

How to md5 a list of filepaths contained in a file?

I have a folder containing many folders containing many files. Thousands. I can do find . -type f > ./FILE-LISTING.TXT to create a file containing many thousands of file paths that looks like this:...
4
votes
1answer
107 views

Search folder, copy to new folder and change names of the files!

So I'm trying to recursively search folder, and as you might imagine it will be the "Photos"-folder in MacOS. And in the process, I would like to change the file name, why you might ask? Because ...
3
votes
0answers
57 views

How can I detect which button was clicked in the DMG EULA confirmation screen

I'm using the open command to automate (via bash) opening a dmg which has a EULA attached to it. When I run open my_app_distribution.dmg I get a screen that looks like this: The open commands uses ...
0
votes
1answer
18 views

Pinning Apps to dock VIA terminal or installation arguments OS Sierra

I am using meraki MDM systems manager to deploy applications for are teachers. It would save me a-lot of heart ache to be able to include a terminal command or some type of software to help with ...
2
votes
0answers
28 views

How to start an application when iPad is connected?

I would like to start an application (Duet.app) installed on my macOS 10.14.5 whenever I plug my iPad to the USB port. I tried to do it with Automator, but I have no experience.
2
votes
0answers
41 views

How to see LaTeX output in Mail.app?

I frequently receive mails with LaTeX text which appear in normal text like $frac{(1+cos\theta)^2 but I want them to be rendered in Mail.app as it would be written in books. Is there any plugin or ...
1
vote
3answers
183 views

Finding and Renaming Mislabeled Duplicates

I inadvertently formatted a Time Machine backup external hard drive. I was able to recover many of the files, but not the names of those files. All of the recovered files have generic names like "...
0
votes
0answers
23 views

Smart Folder from arbitrary script output?

This is a long shot, but is it possible to create a Smart Folder which, instead of building its search using the Search Criteria UI, but instead use the properly formatted output of necessary for a ...
0
votes
2answers
729 views

Connect and run commands over SSH using script

I'm using a series of commands for deploying my files to production. This is currently done manually. Is it possible to make these commands into an executable file? So that I don't have to copy paste ...
1
vote
0answers
33 views

Help with Apple Script for dealing with duplicates in Numbers

I had a script that I used to find duplicates in a numbers document and to highlight the duplicate in red. Well I now have a file where there are multiples of the descriptor in column B that are ...
0
votes
1answer
51 views

stderr error log from launchd scripts filled with non-errors

I've added versions of the following to each of the launchd plist files for all of the scripts I run on my server: <key>StandardErrorPath</key> <string>/script_logs/server....
-1
votes
1answer
190 views

Automator services replace selected text's spaces with underscore [closed]

Looking to create a simple automator service that I can use when selecting text. If the text has spaces, it will replace it with underscores. Thanks in advance.
1
vote
1answer
119 views

Keyboard shortcut in finder to launch >share via>airdrop

I'm for a way to share a group of selected files I have selected in the finder window, via airdrop, with a simple keyboard shortcut. since you can use cmd+c to copy, I thought there had to be a way I ...
1
vote
1answer
90 views

automating “Reset Advertising Identifier” is it possible?

I want to use osascript or some other way to automate "Reset Advertising Identifier" is it possible?
-1
votes
1answer
22 views

Start a window on top of a full screened space [duplicate]

How can I open a window on top of a full screened space? I full screen a video in Safari. I want to run some app that opens a little window on top of that full-screened video. I don't mind what ...
0
votes
1answer
111 views

How can a script detect if it has access to some Security & Privacy parameters?

I've created a script which uninstalls an application I've created. However, as you may know, in macOS Mojave the system requests the user's permission to allow said script to control System Events. ...
1
vote
1answer
129 views

Automator to remove all text before hyphen ( - )?

I'm trying to create an Apple Automator application that will rename a group of files by removing all text before and including a hyphen ( - ) that will post an error if trying to rename a file with ...
0
votes
1answer
17 views

Power off block devices

I would like a way to shut down the block devices to do safe removal by turning them off. On Linux there is the UDisks2's udisksctl power-off -b /dev/sdX command. Is there something similar? Or if you ...
0
votes
1answer
97 views

How to remove special character from a folder name?

I am creating a folder like mkdir -p ../service/target/static but windows creates it with some special character static. I need to explicitely remove that special character using shell script. I ...
0
votes
1answer
455 views

error “System Events got an error: Can’t get application process \”System Preferences\“.”

When running tell application "System Events" click button "Turn Bluetooth Off" of window 1 of application process "System Preferences" end tell I get the error: error "System Events got an ...
1
vote
1answer
119 views

Monitor Folder Contents with launchd - Including Subfolders?

I want to make a shell script that runs any time the contents of a particular folder on my server are changed. Seems easy enough at first, because launchd has a directive called WatchPaths which ...