Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
The results are in! See what nearly 90,000 developers picked as their most loved, dreaded, and desired coding languages and more in the 2019 Developer Survey.

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.

0
votes
1answer
34 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. ...
0
votes
0answers
44 views

Automator to remove all text before hyphen ( - )

I am 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
12 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
59 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
118 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 ...
0
votes
0answers
11 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 ...
0
votes
1answer
19 views

Network proxy setup in terminal

I am trying to create a bash script that will update the mac's proxy settings and a few other places when a user changes their password every 60 days. So far I am trying to use this command for the ...
0
votes
0answers
26 views

Finding a file in Finder with a script

someone please explain why this won't work. The script alone without the "if mainReturned = "File" then" works just fine but when I add it to another part of a script, things get weird. It highlights ...
2
votes
2answers
53 views

Opening a script with a script?

I am using a script and I have a secret code to input within the script (If that makes sense) after I input the code, it is supposed to open the script within the application, the main.scpt. I don't ...
3
votes
2answers
124 views

Getting a text file with the url of open tabs

I got used to this routine my idle times: Open hacker news, SE, other sources on my iphone. Open interesting links as new tabs. Read for a while. Leave tab to remind myself to save it somewhere. The ...
0
votes
0answers
23 views

How to open a second finder window in split view when the current window is in full screen view

Let's say I have a finder window open in full screen view. I'd like to quickly open a second one, where both would be in the same split view. Sort of like using command-tab. And preferably to the ...
0
votes
1answer
41 views

Play folder with right button with iTunes

This answer to Play folder with right button with VLC explains how playing all the audio tracks within a folder can be accomplished when using VLC. I don't want to install VLC, how can I accomplish ...
0
votes
1answer
60 views

Different execution of bash script in 'execute shell script' action in Keyboard Maestro

I try to execute shell script using Keyboard Maestro. In macOS Terminal and Raspberry everything works good. KM shows a strange error. Looks like the script works but poorly recognizes characters or ...
1
vote
1answer
27 views

Create a custom Quick Action to create a zip file with password

How to create a custom Quick Action to create a zip file with password. I understand, to create a zip file with password the following command-line can be used: zip -er archive.zip /path/to/...
0
votes
0answers
21 views

How do you react to an AppleScript list choice?

I was wondering, how would you react to a choice that was made from an Applescript list? For example, you have a list that has option 1, option 2, and option 3. When somebody chooses an option, I want ...
2
votes
1answer
390 views

Giving instructions to an executable in UNIX?

I'm pretty new at this, so excuse me if this is too easy. The thing is, I have a bunch of instructions stored in a text file named: 'FTIG_dldStruct.txt' and I want to write them all into an executable ...
0
votes
0answers
20 views

How and why is the osascript command loading a QuickTime component?

I'm trying to figure out what the osascript command is doing under the hood. Whenever I run it, it tries to load a QuickTime component which throws security errors with Mojave installed. See this ...
2
votes
1answer
133 views

Notification center documentation for applescript

Where can I find documentation for notification center method and properties to use it in applescript? I can't find anything in script editor's dictionary neither on web. This is example code to work ...
2
votes
0answers
29 views

Easy way to bulk change folder icons in Mac

In order to change the icon of one MAC folder, all we need to do is: Open the image Copy the image from the menu ("Edit" -> "Copy") Right Click on the folder and click "Get Info" Click the icon at ...
3
votes
1answer
47 views

What does “Cache location entry for Photos.app in cache file” error signify in Automator app?

I have written a very basic script to count the number of files in a folder, then if it reaches 16 files, to run an automator workflow, as below: #!/bin/bash cd /Users/barbooths/Projects/...
0
votes
0answers
17 views

How to display standard output in Mac application converted from shell script?

It's easy to convert a shell script to a Mac App as suggested here. But I am only able to see the operation result of the script(or the Mac App) after the script finished and there seem to be no easy ...
0
votes
1answer
35 views

Script to check to see if certain applications were installed [closed]

I am very new to Macs however I did hear that there was a Bash script that can be utilized to check to see if certain applications were installed on a machine
0
votes
1answer
39 views

Removing Files after Successful Extraction unrar rm shopt globstar

shopt -s globstar for f in **/*.rar; do dir=`dirname "$f"`; unrar e "$f" "$dir" && rm -frv "${f::-2}*"; done From echoing out testing the rm command, the file is the correct path. I ...
2
votes
1answer
32 views

macOS counterpart of Windows startup batch file [duplicate]

My friend pranked me by creating a batch file which opens a YouTube video and added it to the startup folder, so that the batch file launches every time I log in. This is what he wrote in the batch ...
1
vote
2answers
228 views

Launchd running an Applescript every two hours

I have written a small applescript that I would like to run automatically every 2 hours. I have thus written the following launchd daemon (probably it is an agent): <?xml version="1.0" encoding="...
1
vote
1answer
25 views

Double-click bash file -> pwd outputs my home directory instead of the current directory [duplicate]

In my Downloads directory, I have an executable bash script : #!/bin/bash pwd when I double-click on it, pwd outputs my home directory. But I want my script to run from the current directory from ...
3
votes
1answer
55 views

Automator :: Remove 6 digit date from filename; append current date

I apologize in advance if this has been answered but have performed a lengthy search in hope of a solution. I have a working Automator app that appends the current six-digit date (YYMMDD) to the end ...
1
vote
1answer
57 views

Gluing chronologically rtf files via bash script

I like learning and creating small scripts for bash, and now I have finally the first "serious" problem I would like to solve through a script. Here is the situation: I have a folder containing 45 ...
-2
votes
1answer
171 views

A script to shrink and compress DMG disk images does not seem to work well in my scenario

I'm trying to resize the *.dmg of my MAC OS X installation file because I have only DVD of 4.7 GB and not dual layer disks,at the moment. The problem is that the dmg file is almost 7 GB large and I ...
1
vote
0answers
53 views

“sudo chmod 0 /” deployed as script to remote MACs via Landesk

This probably will not make a lot of sense. We have users that have left the company and have not returned their macs. We are using Landesk as main managing platform, however the MAC managing part is ...
1
vote
0answers
18 views

Is it possible to create exs24 files with a script?

Say that I have a hundred samples and want to make an exs24 instrument for each of them. Is there any script where I could input some info like name, key and path to the audio file and then have it ...
1
vote
1answer
277 views

AppleScript, set the position of the frontmost window, even if not AppleScriptable

I am trying to write a script to center the frontmost window of the active app, when I select this AppleScript from the Script menu in the menu bar. It should work with any app, including non-...
1
vote
0answers
19 views

script to switch to fullscreen app space [duplicate]

I would like a script to manage the switch between spaces. I don't want to switch to a specific desktop, but to a fullscreened app (i.e : iTunes). I already tried the activate command in script ...
2
votes
2answers
192 views

How to deploy Automator workflow to clients?

For a specific use case, I've developed a Folder Action workflow with Automator. When a file gets created in a folder 'abc', the workflow kicks of and executes a shell script. This workflow needs to ...
3
votes
0answers
30 views

Automatically send kill -STOP or similar to runaway processes when the lid is closed?

From time to time (maybe a couple of times a week) when I get to my computer (a Macbook Pro) expecting it to be asleep with the lid closed the fans are running Most of the time it is a Chrome process ...
0
votes
0answers
30 views

How can I stop the system changing name extensions of my files?

I have a created an executable Perl script, starting with #!/usr/bin/perl and have called it t. So when I launch ./t on the Terminal the script is executed and everything is fine. But apparently ...
3
votes
2answers
85 views

How do I unmount a drive with a script?

I installed sleepwatcher to run ~/.sleep before my computer goes to sleep. I need to unmount /Volumes/Backup before my computer falls asleep. If I forget to do it, I get a message telling me that I ...
-1
votes
1answer
132 views

How to skip 'Cancel' 'Continue' when running shell script with automator?

I'm trying to run pmset sleepnow linked to a keyboard shortcut with automator. When I use the shortcut, it's giving me a 'Cancel' or 'Continue' prompt. Anyway to skip this so the script just runs when ...
0
votes
3answers
680 views

AppleScript – How can I _get_ UI elements' names, attributes, properties, classes programmatically without “guessing” via AccessibilityInspector?

When I started to search for an AppleScript's generic way to "click onto Safari's context menu" of a selected item, there were a lot of questions on "how-to" on several levels of nomenclature. How ...
0
votes
2answers
78 views

How to change the `sh` command to run scripts in bash 4

I have installed bash 4 with Homebred and bash --version shows me the version 4. If I have following test script: #!/usr/local/bin/bash # test-version.sh echo $BASH_VERSION And I make it executable ...
2
votes
1answer
159 views

Use security to get a list of Keys in Keychain based on type?

I'm successfully using security to fetch keys from my Keychain via their label, e.g.: security find-generic-password -l "PDF Encryption" However, I'm trying to build a UI that offers me a CHOICE of ...
1
vote
1answer
288 views

Applescript Tell Application of Specific Instance

If I have 2 instances of one application running, and I want to target one of them by their PID to run an Applescript snippet, how would I go about that? I have the PID of the instance I want to ...
9
votes
1answer
3k views

Is there a script I can use to download the Mojave installer without being signed in to the App Store?

Is there a way to script and download the Mojave installer without signing in to the App Store? Something other than opening or clicking a url that points to the installer on the Mac App Store would ...
2
votes
1answer
202 views

Any way to open a URL in a script without having it open in a browser

The situation: My mobile carrier offers for free to send SMS notifications by following a URL. What I'd want: Include these URLs in various scripts to get notifications when I'm away from keyboard. ...
3
votes
2answers
107 views

Difference between filename and . filename in macOS terminal

I'm newbie to MacOS. (I'm using mac OS high sierra 10.13.6) I installed a software. They said to initialize the software by . /path/setsas.sh I give no thought to . and space, so I just ran path/...
2
votes
1answer
84 views

Create macro for Sketch App

I want to create a macro for Sketch. I want to execute some commands, for example, save the file, run some plugins, etc. Is there a way I can do this? I'm using a Macbook Pro with OSX 13, I use this ...
1
vote
0answers
54 views

Formula to calculate the sum of timecodes - AppleScript

After extensive research on the Internet I could't find a decent formula to calculate (add) timecodes, so I'm building my own script from scratch. So far I can get a pretty decent result, however I'm ...
1
vote
0answers
16 views

Automating wifi login

I have a wifi network that loads a webview on connecting that has fields for username and password and a login button. is there a way to automate the login process when that network is connected?
18
votes
4answers
13k views

Mojave: disable or control the “[SOME_APP_NAME] wants access to control [ANOTHER_APP_NAME (often Finder)] …”?

A new security feature in Mojave revolves around a system dialogue that prompts you to grant access to apps that want to control other apps, such as Finder (I'm finding frequently happening with some ...
4
votes
2answers
97 views

Bash - Suppressing output to STDOUT

I've written a script for fresh macOS installs that installs Homebrew, Cask, and a bunch of apps I like, along with creating a .vimrc file. Thanks to an answer by daniel Azuelos (located here: Best ...