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.
121 questions with no upvoted or accepted answers
6
votes
0
answers
1k
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 ...
5
votes
1
answer
267
views
Bulk copy/export name, Modification & Creation Date from multiple files in a folder
I have a bunch of files inside a folder that I want to get the Date Modified and Created from and copy it into a text document or some kind of tab delimited document. I have no idea how to do this.
...
5
votes
0
answers
281
views
Detect macOS beta using script
In a shell script, how can I tell whether or not the script is running on a (public) beta version of macOS?
Preferrably, I would like to check this without matching a specific version of macOS, since ...
4
votes
0
answers
255
views
Shell script hangs when run with a shebang line
This didn't used to happen, but now when I try to execute a shell script in my path by name, it just hangs.
The script: ~/bin/foo:
#!/bin/sh
echo this is foo
My PATH:
/usr/bin:/bin
What happens ...
3
votes
0
answers
906
views
Force reset system preferences cache
I'm trying to enable/disable time announcement feature that's present in Dock & Menu Bar > Clock > Announce the time with a shell script.
When I read the plist file, I can see that it's set ...
3
votes
0
answers
729
views
How can I add shells to the list in Run Shell Script in the Automator now that the .plist is on the read-only volume?
This question has what seems like a duplicate here, but I have an update.
The answer to that question -- how to add a shell to Automator -- is to modify Shells.plist. Specifically:
The list of these ...
3
votes
0
answers
196
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
0
answers
83
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
0
answers
308
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 ...
3
votes
2
answers
3k
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 ...
2
votes
0
answers
188
views
Automator workflow crashing silently when ran as Finder extension
I made an Automator workflow that essentially runs a shell script to optimize images. I intend to use it as a Finder.app extension, by selecting images and running the workflow as a "quick action&...
2
votes
2
answers
764
views
macOS: Double click on a file and display the output from a CLI command on the file?
There is a file type called "netCDF". My goal is to be able to double click on a netCDF file on Finder and see the text output from a CLI command to which the filename is given.
Specifics: ...
2
votes
0
answers
555
views
Switch between virtual desktops by scrolling on the menu bar
Looking for a script, macro, automation script, TIY solution that will allow me to hover my mouse over the menu bar scroll my mouse wheel up and down which in turn will switch between my left and ...
2
votes
0
answers
278
views
Using launchd to run script once a day when logged in
I'm in the situation where I would like to run a script only once per day when I open my MacBook.
I guess I could have the script note the date it was last run, and have it reject when run on the ...
2
votes
0
answers
126
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 ...