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

New answers tagged

1

Try this code for your first line: if application "app" is running or application "app2" is running then The fixed one line of code makes the rest of this script run correctly. Your example seems to be written partially backwards. It is first asking if either of the App's is running and if either app is running then tell both of them to quit. If either ...


1

I think this may be what you're looking for. set app1 to "TextEdit" -- Change as needed set app2 to "Mail" -- Change as needed if (application app1 is running or application app2 is running) or ¬ (application app1 is running and application app2 is running) then tell application app1 to quit tell application app2 to quit else tell ...


1

In Terminal, the following bash compound command will move all found .jpg files in the "/path/to/source" directory to the "/path/to/destination/" directory, but will not overwrite existing files at the "/path/to/destination/" directory. find "/path/to/source" -iname '*.jpg' -exec sh -c 'for f in "$@"; do mv -n "$f" "/path/to/destination/"; done' sh {} + ...


2

If you are looking for a command-line solution, use the following: find /source_root_directory_path -name '*.jpg' -exec mv {} /target_directory_path \;


1

Create and open your destination folder. Go to the base directory you want to scan in Finder. In the search field, enter kind:jpg. Select JPEG image when it shows up. After it generates a list of all the JPEG images, you can select them all with Command-A and drag them to a folder. If you hold down ALT when you drop them on the folder, you'll get a copy ...


5

An AppleScript solution: set the clipboard to the words of (the clipboard) as text


13

The shell snippet pbpaste | tr -cd "[:digit:]+" | pbcopy will take the content of the clipboard, remove all non-digits and put the result back into the clipboard.


2

I have created a AppleScript, that redirects all files dropped onto it, to a shell script with the matching name. Simply save as application from within Apple's ScriptEditor and rename as script.app to match your script.sh on getScriptName() tell application "Finder" set p to path to me -- alias to the file of the running script set ...


1

In Mojave, I usually manually switch the output device from the Volume Control in the menu, so I automate the same thing using the AppleScript below which does the toggling based on what is checked/unchecked. If you use this w/ some launchers, then this approach doesn't need permissions to the Preferences. ignoring application responses tell ...


1

Example #1 - via Googling Googling I found this Reddit thread titled: I want to write auto reset script for Advertising Identifier. The script from one of the replies in that thread is below. NOTE: I did not test this, am merely sharing it as something that may help steer you in the right direction to ultimately getting a workable solution for you ...


Top 50 recent answers are included