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.

52 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4
votes
0answers
735 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
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 ...
3
votes
0answers
47 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
23 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
262 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
58 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
40 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
945 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
77 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
137 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
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 ...
2
votes
0answers
235 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
43 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
248 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
845 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
786 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
0answers
21 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
30 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
68 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
19 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
66 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
58 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
125 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
37 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
225 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
41 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
48 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
417 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
378 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 ...
0
votes
2answers
38 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 ...
0
votes
0answers
44 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. ...
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
23 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
0answers
22 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
0answers
30 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 ...
0
votes
0answers
54 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
0answers
40 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 ...
0
votes
0answers
25 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
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 ...
0
votes
0answers
24 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?
0
votes
0answers
22 views

diskutil eject fails when screensaver is active

Have a bunch of DVD drives connected via USB. Have written some bash scripting to interact with these drives and eject the discs when done. Running MacOS 10.10 (Yosemite)....yes I know, need to get ...
0
votes
0answers
161 views

Disable iTunes using a Script?

There's a much despised bug in OS X wherein iTunes unexpectedly opens and in some cases, starts playing music, a podcast, or whatever the user was listening to last. The bug can be triggered in a ...
0
votes
0answers
134 views

Execute macros or scripts based on Magic Trackpad 2 Force Touch

I’m looking at getting a Magic Trackpad 2 with Force Touch, but want to know if I can create macros for the Force Touch actions? I’m not taking about the the built in basic Apple support, but full on ...
0
votes
0answers
159 views

Notification message's delay before hide

I made a script to upload images, it shows a notification, but it stays on screen for a very long time until I close it by click. Is there a way to decrease the delay for this notification?