271 questions
1
vote
2
answers
92
views
How do I return the PID of an osascript call from within a function (or how do I create a persistent notification I can kill later in the script)?
I'm using Bash 3.2 in macOS Tahoe. I've hacked together this function to show an informational dialog:
showDialog(){
local strDialogText=$1
local intDialogSeconds=$2
IFS='' read -r -d '' strJS <&...
0
votes
1
answer
96
views
macOS 26.1 causes problems for osascript controlling Terminal, how to ensure correct target for keystrokes?
I have the following bash script that was working well for more than a year on macOS - it just opens whole bunch of terminal tabs with various processes. But with recent update to macOS 26.1 osascript ...
1
vote
1
answer
111
views
Changing Delimeter of Multiple Items Returned by a osascript/javascript File Select Dialog
I have a little zsh script I'm coding to run on MacOS. Been a bash/shell scripter for 25+ years, so it hasn't been all bad. Part of its function is to have the user select a file (or files) from a ...
0
votes
1
answer
371
views
How to create a note with a checklist in Notes on macOS from script
I am trying to create AppleScript that will generate note in Notes with a checklist. I found a bunch of examples like this:
tell application "Notes"
activate
set newNote to make new ...
0
votes
1
answer
211
views
Embedding AppleScript in Bash Script
I have a working AppleScript for pinning a given app the dock:
set theAppPath to "/Applications/Adobe Acrobat Reader.app"
try
set theShellScript to "defaults write com.apple.dock ...
0
votes
0
answers
36
views
Apple Script - Variable Not Defined Error
I'm not that familiar with Apple Script. I am wanting to setup a crontab to automagically lower the volume at night and such.. I can't find much info on this. Is there a manual (PDF) on osascript ...
0
votes
1
answer
133
views
Quoting a shell command inside an osascript command run by a shell inside a JSON file
I have the following line for my Sublime text build system json:
"shell_cmd": "osascript -e 'tell application \"Terminal\" to do script \"ssh [email protected] \"'"
...
0
votes
1
answer
831
views
How can I write an apple script that moves the mouse to a certain position after being idle?
I was searching for a way to move the mouse after some time of inactivity on a MacBook, and due to some constrains, the idle setting in the OS are not accessible, nor are some software that move the ...
0
votes
1
answer
53
views
AppleScript always results in the last line being echoed backed in my logs when ran from shell
(Possibly dumb) AppleScript question: I have a simple OSAScript (ran from a bash script function via a Jamf policy) that sets a few Finder Sidebar options for console user. It runs fine, but I noticed ...
0
votes
0
answers
70
views
How to write function in bash for reuse shell commands inside using osascript?
I want to get rid of duplicates, but get the errors:
178:186: syntax error: A “"” can’t go after this identifier. (-2740)
133:134: syntax error: Expected expression but found unknown token. (-...
1
vote
0
answers
84
views
How are my Apple Scripts saved on Google Drive being corrupted?
Note, I'm not asking what I should do, or how to fix this problem, or why saving AppleScripts in Google Drive is a bad idea - I already know that and have a solution to my problem. I understand it ...
-2
votes
1
answer
143
views
Can I "tell" the Apple "Preview" application to scale an image up or down via Apple `osascript`?
I want to script the "Preview" application to do the equivalent of clicking the + or - button in the app, which when hovered over give the text "Scale document up" (and down). Is ...
0
votes
1
answer
106
views
AppleScript handlers with whitespace in parameter names and without "given"
I read about interleaved- handlers and parameters in handlers in Apple's documentation, but I don't know why some specific open-source code is working for others while not for me.
In the documentation ...
0
votes
0
answers
169
views
ZSH osascript tell parent application (process) display dialog
I have an AppleScript application that runs a do shell script of my script.sh in the application package.
That my script.sh does some interaction with the user through
$osascript -e 'tell me to button ...
3
votes
1
answer
373
views
How to use osascript to open Iterm2 and run script?
Currently, I have an sh file which I use to run a script as such:
osascript -e "tell application \"Terminal\" to do script \"cd $PWD && npm run build:watch\""
...