Questions tagged [applescript]

AppleScript is a proprietary programming language in macOS to control and exchange data with applications.

Filter by
Sorted by
Tagged with
0
votes
0answers
21 views

Is there a way to signify a wildcard placeholder when recording a workflow with Automator?

I have a task that is very repetitive, with only a few minor caveats. Usually, the caveat is as simple as a name change, but the task jumps between Finder, Xcode, and uploading files via a storage ...
1
vote
2answers
55 views

Applescript - opening file inside app bundle

I have used Automator to create an app bundle that activates an app ("Fuse") within the Resources directory of the bundle, which then opens the file "Exolon.tzx" (also located in Resources). However, ...
1
vote
1answer
110 views

Applescript transform date format

I'm using this to transform my date from a DD/MM/YYYY to MM/DD/YYYY set today to short date string of (current date) set t to (time string of (current date)) set [_day, _month, _year] to [day, month, ...
0
votes
0answers
26 views

How to fix Automator passed arguments returning empty files?

I'm attempting to create a workflow in Automator that uses jpegtran to convert several hundred album art jpg files from progressive to baseline. I can manually run the script in terminal like so: ...
3
votes
0answers
41 views

Using AppleScript to delete an event still existing in Calendar?

I'm trying to write an AppleScript that clears a calendar (an iCloud one) of all of its events. I have the following: tell application "Calendar" tell calendar "Test calendar" set ...
0
votes
0answers
102 views

Run AppleScript in background without showing in app switcher?

Is there any way to run an AppleScript command (which runs infinitely) completely in the background without any icon showing in the dock or app switcher (⌘+Tab)? For example, hiding the AppleScript ...
2
votes
1answer
36 views

Why is networksetup so slow compared to manually changing Wi-Fi networks?

if I run networksetup -setairportnetwork en0 myssid it takes between 10 and 15 seconds. If I manually click the Wi-Fi icon in the notification bar and select myssid, it's instant. Alternatively, I'...
1
vote
0answers
24 views

AppleScript : two class with same name

I'm getting some text from Safari in a column. I used to use this script to add all text from this column in a list : PS the class is class="sortable null" tell application "Safari Technology ...
0
votes
1answer
69 views

AppleScript : repeat with each item from end to beginning

I'm trying to do a repeat form a list but I would to repeat from the last item of the list to the newest instead of the another way. How can I do that knowing that this will do in the wrong order : ...
0
votes
2answers
41 views

AppleScript : next/Previous tab in safari

I'm trying to change the focus on safari for the next tab (and the previous tab) I wrote this which is not working : tell application "Safari Technology Preview" tell window 1 set ...
0
votes
1answer
95 views

Create new (.url) file with url address as variable input

I am looking for a way to create a new .url file in the current folder, but have an input field that allows me to enter the desired webaddress the file should link to. The whole process should be ...
2
votes
1answer
39 views

How to find program's Application Support folder

I am wondering if there is a way to get the name of a program's Application Support folder, perhaps in a way similar to get the id of an app. osascript -e 'id of app "Sublime Text"' gives you com....
0
votes
1answer
101 views

How can I make Automator run service I made (shell script) and display the output in Terminal?

Hi I'm new to Macs and OSX, I'm using p7zip cli app to compress folders with big files inside (1; 2 GB or more). So I managed to make a Bash script to do it in batch process when I go to bed and I'm ...
2
votes
3answers
88 views

Automate arranging files into folders based on beginning of file name?

Looking to quickly arrange a whole load (talking about multiple thousands) of files into subfolders, and the files come in sets of three (left audio, right audio, video) separate files. Not ...
1
vote
1answer
112 views

AppleScript basic date/time format and filename

I'm trying to wrap my head around AppleScript. I have a simple project to capture screenshots every several seconds and save them to a folder. I found this helpful script on GitHub: https://gist....
2
votes
1answer
66 views

AppleScript to Add Multiple Files to VLC From List Results

I have a FileMaker Pro database of music files which uses AppleScript to pass it's search results into an iTunes playlist. I would like to use VLC instead of iTunes to play the audio files since I ...
0
votes
1answer
42 views

How can I filter and sort videos by orientation (portrait or landscape)?

I'm attempting to filter and sort all videos in a local folder based on their orientation. I can't find anything in AppleScript, macOS file search, or video metadata that will make this easy. My guess ...
0
votes
1answer
44 views

Can’t get “play/pause” of window 1. Access not allowed. - trying to unpause movie through Applescript

I'm trying to pause/unpause QuickTime Player with a little dictation command: on run activate application "QuickTime Player" tell application "System Events" click "play/pause" of ...
1
vote
0answers
54 views

applescript- script works when used in Script Editor but does nothing when saved as standalone app

Don't judge, my first code lol. How do I fix the stated issue and suggestions for improvement would be great. I just tried making something to pause music when I started a video and start playing ...
2
votes
2answers
66 views

Is there any way to change the mac dock's position with a keyboard shortcut?

I don't think there are default shortcuts for that. But I assume you could make one using AppleScript or other automation programs. I found this post from 2012 asking the same question. I tried ...
0
votes
0answers
40 views

How to force Safari to open links clicked in other apps in a “public” window

I wrote an AppleScript (saved as an app) awhile back that opens a new Safari Private window to a web-app site that requires a private window in order to have multiple windows to that site open and not ...
2
votes
1answer
108 views

How do I retain globals in AppleScript between invocations under Mojave?

Problem Apparently with the security changes made in Mojave and now going forward, I lost the ability to store globals between invocations of my scripts. All that I want to do is to toggle states ...
0
votes
0answers
13 views

Run Automator service when program cannot access accessibility services

I've read this: How do I assign a keyboard shortcut to an AppleScript I wrote? The app I am trying to add the service to under Accessibility does not allow me to see the service. It's a game running ...
0
votes
0answers
91 views

I want to prevent the Touch Bar from sleeping when left inactive

I just bought a new MacBook with Touch Bar and when ever I'm watching something, or the Touch Bar is left inactive, it dims and sleeps which is really annoying to me. Is there any terminal command or ...
1
vote
1answer
103 views

AppleScript Get HTML of Chrome Active Tab

Is there a way to get the actual HTML of a current active tab in Chrome? Some websites use the position on the page to induce an AJAX call to expand the page further. So working with a URL only won'...
1
vote
0answers
19 views

Strange AppleScript behaviour in relation to Reminders

I am trying to write a small script that will move all reminders from one list to another. After some experimentation, I have come up with this, that seems to do what I want: tell application "...
0
votes
1answer
61 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. ...
1
vote
1answer
50 views

How can i change Terminal Settings to automatically close terminal after Execution using shell script

when i execute some command file or shell file after execution terminal remains open and its not look appropriate i want to close the terminal by script without changing settings manually in MAC ...
1
vote
3answers
119 views

osascript display dialog hangs when screen is off; detect unavailable GUI/display from bash or applescript?

background I've been working on a backup script that runs occasionally via launchd. When it runs, it prompts me with something like: osascript -e "display dialog \"Is now a good time to back up?\"" ...
4
votes
0answers
30 views

Is there a script/cmd that I can create/run that will allow me to install .dmg? [duplicate]

I have been working on a "Mac Rollout Project". After I run the Macs through the Apple setup, I have a list of .DMG / Applications that I have to install. There is no particular order that the .DMG / ...
2
votes
2answers
72 views

Removing numerous ‘homepage’ entries from Contacts.app with AppleScript extremely slow

A syncing issue with Outlook left me with hundreds, if not thousands of duplicate contacts. After managing to merge duplicates without Contacts crashing, I was left with 177 contacts, most of which ...
1
vote
0answers
27 views

Can AppleScript select text after my cursor between designated characters?

I would like an AppleScript to start from my current cursor location (or the end of the current selection if there is one), scan forward to the next ";" or "(", then select all text until before the ...
2
votes
2answers
148 views

JXA JavaScript for automation How to make JXA click something

What is the JXA equivalent of --AppleScript tell application ("System Events") click at(x,y) end tell
3
votes
1answer
54 views

How can I change the default delay time before automatic shutdown?

I don’t want to change the default delay time before shutting down all the time, but on occasion I want it to be 10 seconds and still show the dialog. The only documentation I could find was for ...
0
votes
1answer
40 views

Applescript : text delimitation in a loop

I'm trying to get values from a log file of all the occurrence of a value Recorded on the following key : > <key>MyTime</key> <string>2019-03-29T08:48:18+0000</string&...
2
votes
1answer
32 views

Automated copying of Finder comments

I have a bunch of old files in FLV format, which VLC will convert to M4V format while preserving the audio and video tracks (not re-encoding them). Many of them have Finder comments that I want to ...
0
votes
1answer
19 views

AppleScript : add to plist instead of replacing

I have a script which add the current time to a plist. Basically it's help me taking track of my overtime. That's work fine if I run it once but if I run it more than once the primary Plist is ...
6
votes
2answers
1k views

How can I open an app using Terminal?

I want to be able to open any given app from the terminal, now I have tried osascript -e 'open app "Calendar"' I have tried for Mail, Calendar and Slack.. Slack acctually opens but it does generate ...
0
votes
0answers
17 views

Software or applescript for generating web loc links for files in a folder

Is there a software for Batch generating web loc links for specified folder? Input Folder1 -- file1.pdf --- Folder 1.1 ---- file1.1.pdf Expected Output Folder1 (Folder ) -- file1.webloc --- ...
0
votes
1answer
77 views

AppleScript : convert decimal to hours / days

How can I convert the value on my script from decimal to hours / or day? For converting decimal to hour I believe it's : hours + (minutes /60) but my variable is in this format : 23....
0
votes
2answers
64 views

AppleScript Date calculation

I created this script to do date calculation between a date and today, but for some reason I get a decimal number. How can I just get the number of date without decimal point ? Tried to use a ...
1
vote
1answer
129 views

Apple script to change main display

I have 3 displays, MacBook and 2x4k. My main display is one of 4k. The issue is when I lock computer often 2nd 4k Display (not main) move all full screen apps to MacBook, MacBook to this 4k. Only main ...
1
vote
0answers
30 views

How to log the search history in Mac Dictionary when using the pop-up dictionary mode

how to log the search history in mac dictionary The answer to this post provides an AppleScript to record the words that have been looked up by actually opening the Dictionary app (using an assigned ...
1
vote
0answers
173 views

Running a command with access to “System Events.app” granted

I am updating applications installed via Homebrew from command line. iTerm2 requires access to "System Events.app" to be correctly updated, which ends up in a process that is not fully automated and ...
1
vote
1answer
82 views

Automator to remove all text before hyphen ( - )?

I'm 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
0answers
28 views

Do anyone know how to use AppleScript to enable Adobe Flash Player?

Need to make this work in a enterprise setting. Do anyone know how to use AppleScript to enable Adobe Flash Player?
0
votes
1answer
34 views

Applescript refer a link to a file in current finder window

Edited. Where is my current script : set plistfile_path to POSIX file "/users/moi/Desktop/Time/" choose file with prompt "Please choose a file:" of type {"plist"} ¬ default location ...
0
votes
1answer
47 views

Calculating time with AppleScript

I created one start to log a "start time" and save into a plist file, and a an other script to read the start time and calculate the number of time elapsed from the start time and now (reading time) ...
0
votes
1answer
59 views

MacOS, export email folder with each message to its own file

Is there a good way to export a Mac email folder so that each email message goes into a separate file? The only way I can think of is to export the folder using the "Export Mailbox" menu item, and ...
1
vote
1answer
131 views

Script that creates a mailbox (folder) based on the email subject

I adopt the inbox zero approach, which means that I want to keep my inbox as close to empty as possible. To achieve this, I need to archive emails quickly. The best method I found was to write a ...