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.

64 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4
votes
0answers
747 views

How to detect locked screen / login-session from a script?

I am looking a way for a script (either bash or AppleScript, doesn't matter) to detect whether the state of the screen or the user login session is locked or not (i.e. the user will need to type in ...
3
votes
0answers
64 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 ...
3
votes
0answers
72 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 ...
3
votes
0answers
25 views

How can I customize Spotlight so that if a number (or some pattern matching a regex) is typed, I can execute a command or script?

I want to "augment" Spotlight to do things like: If an integer (^\d+$), open a site, example.com/$0. If a UUID (^\d{8}-\d{4}-\d{4}-\d{4}-\d{12}$), open another site. If a string beginning with "user:"...
3
votes
0answers
3k views

Terminal (bash) - copy files from Windows (SMB) shares without mounting

In past OSX versions, one could copy files from SMB shares like so: smbclient //my-server/foo -U USER%PASS -I 127.0.0.1 -c "get my.file" However, in recent versions, sbmclient has been replaced ...
3
votes
0answers
263 views

Can I use the Terminal to find all OpenMeta tags on my system?

I know that there are apps that can do this, so I figure it must be possible: I'd like to compile a list of every OpenMeta tag that I've used on my Mac (OS X 10.8.3). But here's the rub: I'd ideally ...
2
votes
0answers
18 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 ...
2
votes
0answers
47 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 ...
2
votes
0answers
110 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 ...
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
47 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 ...
2
votes
0answers
1k views

Applescript click by position

I'm trying to click on a button using YX coordinate, it's work with some app, but I have one app with two windows which give me an issue. here is my original code tell application "System Events" ...
2
votes
0answers
78 views

Empty Trash Hook

Is there a way to trigger some custom code to run if somebody tries to empty the trash like for login / logout hooks? Is there a way to interrupt the empty trash process for non-admin users?
2
votes
0answers
181 views

How to properly esca‌​pe spaces in the res‌​ults of mdfind to use them in a for loop

Trying to answer the question Are true dynamic folders (NOT a “Smart Folder” SavedSearch) possible? I stumbled about the problem to loop the results of an mdfind search as quoted or escaped paths. ...
2
votes
0answers
189 views

AppleScript or Safari add-on to highlight text

I have some variable that I would like to highlight in Safari. I was thinking AppleScript, but I can use something else otherwise. I'm using a Chrome plug-in which does the same, any idea how to do ...
2
votes
0answers
279 views

'Add notes' to a Calendar event using Automator

I would like to build a 'Service' for selected text which: Get the currently selected text Creates an Calendar event adds the selected text as a 'note' for that Calendar event I prefer Automator for ...
2
votes
0answers
39 views

How can I detect an incoming call on Yosemite

I'd like to detect an incoming Facetime call and run certain scripts as a result. I'd like to achieve something similar to when iTunes pauses when there is an incoming call, but I would run my own ...
2
votes
0answers
2k views

Applescript / Automator - Pass variables between them

I have a question about how to pass the applescript input from one computer to another computer's automator input (I created it as a program). I've created the script below to ask for the filename and ...
2
votes
0answers
44 views

Run script when I connect something to the line in port?

I'm connecting my phone to my mac via the line in port to listen to podcasts. I'm using the app LineIn to do this and I was wondering whether there was anyway I could have: My audio input be set to ...
2
votes
0answers
179 views

How can I tell programmatically whether a process is in app-nap?

I'm looking for a script, built-in shell command, or program (with sources) that can tell me whether a process is in App-nap mode or not. I want to use it in automated testing, for profiling and to ...
2
votes
0answers
256 views

Correct Way to Check if Spotlight Has Indexed a Folder's Contents

Okay, so I've written a script that uses mdfind to more quickly match files, however, I need to find the best way to check whether a target directory is indexed or not, so I can fall back to using ...
2
votes
0answers
869 views

How can I create (nested) Keynote.app slides from a XML file?

I have some nested lists (XML/OPML file) and I am looking for a (automated) process to create Keynote presentations from them. Use case: I write concepts for presentations in an Outliner, then would ...
2
votes
0answers
788 views

With Lion, Problems Accessing Shared NTFS Folders with SMB://

We are testing a local login script that we created for our Macintosh users on Lion. It has worked fine on all OS X versions prior to 10.7. Listed below is the script that we are using. When we run ...
1
vote
1answer
14 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'...
1
vote
0answers
19 views

MacOSX El Capitan - After using command line to create a new user, why won't the user appear in the login screen on bootup?

Using sudo dscl to create new users with and without admin privileges. The newly created users for some reason are not in the login screen on bootup and using the input entries for users do not login ...
1
vote
0answers
25 views

How to open a window and tab in Terminal via Javascript automation

I want to use the Script Editor program to create a script (Javascript) that will recreate my Terminal window and tab setup. I open a few windows, open tabs within those windows, label the tabs, run ...
1
vote
0answers
58 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 ...
1
vote
0answers
47 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
78 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
0answers
26 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
0answers
47 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 ...
1
vote
0answers
80 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
23 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
0answers
102 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
68 views

How to make Spotlight index shell script wrapper applications?

You can create executable Application Bundles containing a script with the same name (e.g. Example.app and Example.app/Example). Unfortunately, these applications do not seem to get indexed by ...
1
vote
0answers
136 views

shell script on mac to ssh path / CD in a dir

I am looking for a way to in terminal cd into dir1 Then in a new tab cd into dir2 Then in a new tab cd into dir3 Then in a new tab cd into dir4 Then in a new terminal window ssh ...
1
vote
0answers
40 views

Automator Service - prevent multiple calls

I might need some help. I have an Automator Service / Script, which does basically just toggle play/pause in some application. I call this script via Shortcut. I am using this to play/pause Spotify, ...
1
vote
0answers
248 views

script to get PDFpen to OCR multiple PDFs at once

I'm trying to create a simple Automator workflow to find all non-searchable PDFs then OCR them with PDFpen. I can't make much sense of the one or two other posts here (like this one), nor do I have ...
1
vote
0answers
44 views

Need help troubleshooting a shell script that won't launch (yes, permissions are 755)

It could be the lateness of the hour, but I can't understand why the following script isn't working. It's directly from the CommuniGate Pro documentation http://www.communigate.com/CGPSophos/#Update, ...
1
vote
0answers
52 views

Rearranging spaces in macOS in a more “automatic” fashion

I'm looking for a way to swap Mission Control space n to space m, by means of a keyboard shortcut or a terminal command as to make this process more automated/automate-able. With this, I am not trying ...
1
vote
0answers
429 views

Create a script to turn wifi off on shutdown

Is there anyway to create a script that will automatically shut down the WiFi when I power down my machine? Maybe in Automator?
1
vote
0answers
6k views

Apple installer issue in terminal where -target keeps saying; error cannot find Volume

I am trying to use the Apple Installer commands to install a package and the output is that it was successful, however, the end result is that nothing actually happens meaning the package never gets ...
1
vote
0answers
401 views

Script to make the x red button kill the app

Quick background: new mac, long time windows user; not scared by linux and scripts. I am currently using RedQuits to make the x red button quit de app, not just close the window. It is a great ...
1
vote
1answer
170 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
1answer
34 views

MacOSX El Capitan - Running bootstrap-vcpkg.sh results in a build stopped: subcommand failed, any solutions?

When running sudo ./bootstrap-vcpkg.sh, the script stops resulting in a ninja: build stopped: subcommand failed. I have no idea how to continue from here if anyone could help that would be greatly ...
0
votes
0answers
16 views

Show FaceTimeNotificationCenterService

I wonder how I can show FaceTimeNotificationCenterService again if I run the command killall -kill FaceTimeNotificationCenterServicebefore?
0
votes
0answers
8 views

Can I write a script which caffeinates itself?

I have a couple of bash scripts which I almost always start and then walk away from my computer to let them do what they do unattended because of how long they take (and because they are often ...
0
votes
0answers
23 views

Links in HTML files opened with qlmanage don't work

I'm attempting to open HTML files using qlmanage. They open and render correctly, but whenever I try to click on a link, it takes me to Safari and then nothing happens. No new tab, no webpage. If I ...
0
votes
0answers
122 views

Requiring user input in order to run a script which controls Safari

Using Script Editor, I've created the following script to close tabs and open a particular window: tell application "Safari" repeat with i from (count of windows) to 1 by -1 repeat with j ...
0
votes
0answers
43 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 ...