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
0
votes
1answer
26 views

Why does Automator not see new files in subdirectories on a Flash Drive?

I've created an automator app to find all the csv files on a flash drive, then modify and copy those files to a directory on the hard disk of my MAC. The automator app uses a shell script to compare ...
1
vote
1answer
36 views

Why would a python3 script not find a module when run in Automator?

I am trying to automatically run a python script using automator. This script python3 ~/Desktop/python/gmaps.py works fine in terminal but not when I try to run it through Automator , I get a "module ...
1
vote
0answers
56 views

ApplesScript, autopress space bar

I am trying to run a script that will double press space bar in a fast sequence after this command repeat 10000 times tell application "System Events" to keystroke "g" using command down ...
0
votes
0answers
39 views

How do I continuously check the status of a process and execute something once the process stops with an Apple Script?

I'm using an Apple Script to open an application and transcode a file. What I need to be able to do is continuously check the CPU usage of the process and when the CPU usage hits 0 I need to do ...
0
votes
1answer
9 views

Move Dock to another screen edge when unplugging monitor

When I exclusively use my laptop screen I prefer to have the Dock on the left edge, but when I plug in my external monitor I'd like to move the Dock to it instead. Since my external screen is to the ...
0
votes
0answers
34 views

How to execute admin level command via remote login without typing password?

I would like to allow a remote script to access my Mac (Catalina 10.15.2) at the root level. I know that I can enable keyboard-less access at the user level, by using publickey authentication, via ...
2
votes
1answer
95 views

Zip the contents of every sub-folder in a folder in Mac automatically

I have this folder/file structure parent folder --subfolder1 -sub-subfolder -file1 -file2 --subfolder2 -sub-subfolder -file1 -file2 ... I want to: create zip files from the contents of ...
1
vote
1answer
60 views

Batch Removal of “Where from” Metadata Without a Handler

I have many images that contain the "Where from" metadata in the "get info" section that shows the URL where they were downloaded from. I want to remove this information from all of them at the same ...
0
votes
1answer
89 views

Having Issues Renaming Files That Are Moved From A New to Old Folder via Applescript [duplicate]

Ok so this is a complex script that I hope someone out-there can help me with because I have spent the entire day trying to figure this out. Lets say I collect cat images from Instagram and I have ...
1
vote
3answers
96 views

Terminal command to move all loose files into a directory with the file name

I have a folder containing thousands of files and directories. I would like to move all the files that are not contained in a sub directory into a directory and name it the file name, while leaving ...
0
votes
1answer
41 views

How to make and alias list from multiples results of a shell script?

So this is the shell script that I have in my Applescript editor which brings up all of the videos that have been added to my computer today. do shell script "mdfind 'kMDItemDateAdded >= $time....
0
votes
1answer
35 views

Keep standalone bash script app open after run of script

I have a bash script that I have turned into a standalone macOS app (i.e. I created a folder Script.app which contains subfolders Contents and MacOS and in the folder MacOS resides my bash script). If ...
2
votes
1answer
43 views

AppleScript to choose item on web page

Is it possible with AppleScript to choose a clickable element in a web page and click it and if so, can you give me an example?
0
votes
0answers
19 views

Incorrect validation loop [duplicate]

I made a loop that inserts a number into a string, and by the color of the number (blue - registered, red - missing), using the standard utility Digital Colors Meter determines the color of the number....
0
votes
0answers
36 views

Incorrect validation loop for iMessage [duplicate]

I'm trying to do a number checker in imessage. We all know that there is no such api, so I'm trying to use the tools at hand. The main took with past issues on this site on this topic. I made a loop ...
1
vote
5answers
191 views

How to run script at wake?

I'm looking for a method to run a script (well, a single shell command) when my laptop wakes from sleep. This question has been asked before, but 8 years ago (for OS X Lion), and several of the ...
0
votes
0answers
4 views

How to properly install a custom pkg script such that it gets picked up by “system_profiler SPApplicationsDataType”?

I have a very simple script that I want to distribute via MDM such that it gets properly registered with OSX app registry? MDM verifies whether the script has installed successfully by executing "...
1
vote
1answer
68 views

How to remove metadata from image files using AppleScript?

I am using Catalina. I want to create an application using Applescript which which will remove metadata from dropped image files (onto its icon) using the unix utility exiftool. I tried the following ...
0
votes
1answer
45 views

Can I create a Siri custom voice command that performs actions in an app?

I can't seem to find any docs for this so was wondering if this is possible. I have a SmartThings app on my phone for controlling my Samsung tv. I was wondering if I could create a Siri voice ...
11
votes
4answers
4k views

Do Macs come with any programming language available from the Terminal?

I need to do a few little scripts on my Mac but I don't really want to install Xcode or Python for a full environment, just a quick command line deal. Does macOS come with anything suitable out of the ...
2
votes
1answer
80 views

Applescript: Prevent “Choose Application” prompt from appearing

Suppose the following Applescript is run on a machine that does not have an application called SomeApp installed: if isAppRunning("SomeApp") then tell application "SomeApp" --Do Something ...
2
votes
1answer
93 views

How to run an AppleScript when Safari starts up?

To use uBlock Origin in Safari 12.1.1, I run it using Extension Builder 1. But I have to go by the builder tool at every Safari startup, so the blog suggested adding the script to ~/Library/Scripts/...
0
votes
1answer
250 views

Terminal won't find command of custom script since Catalina update

I have a very simple script to hide the icons from my desktop #!/usr/bin/env bash defaults write com.apple.finder CreateDesktop false killall Finder It is located in $USER/bin. Since the update, ...
1
vote
0answers
40 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
62 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 ...
1
vote
2answers
324 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 /...
1
vote
1answer
113 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
74 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
115 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
132 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
96 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
50 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
25 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
46 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
91 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
41 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
31 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
357 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
36 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
38 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 ...
1
vote
1answer
243 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
37 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
36 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
72 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
690 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
474 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
173 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
272 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