MacOS command line tool which executes OSA scripts (AppleScript, JavaScript, etc.)
Questions tagged [osascript]
267 questions
0
votes
0 answers
Get Verbose Output From Command
I am executing this (on a Mac):
find "/Volumes/Untitled3/Done" -type f -size +1400000k -exec mv -fv "{}" "/Volumes/Media/Overflow/" \;
When running the script in the foreground, progress is echoed to the console. As the files are quite large, it…

Lorccan
- 793
- 5
- 20
0
votes
2 answers
Path Issues - POSIX HFS Cannot get folder
I am trying to get this short script to work. All it should do is take the contents of the folder in Application Support/App of the local user and move it to a usb.
set localLocation to POSIX path of (path to library folder from user domain) &…

Ryannnnnmmm
- 25
- 5
0
votes
1 answer
Bash/Osascript Error: unexpected EOF while looking for matching `)'
I'm splitting a string using osascript (was working this way, not with bash), and assigning the resulting array to a bash variable, and continuing with my bash script. I'm doing it like so:
tempArrayApplications=$(osascript >/dev/null <

javarookie
- 49
- 7
0
votes
1 answer
How to fix "Can't make missing value into type date"
I am trying to list all the reminders from the app where the due date is missing but I get the above mentioned error. Any body knows how to check for a missing value in such case?
Here is the code:
set remListOut to ""
set curDate to current…

RNP
- 27
- 6
0
votes
1 answer
Programmatically launch bash shell command 'osascript' using java
I've tried with:
ProcessBuilder pb = new ProcessBuilder("osascript script.scpt");
pb.inheritIO();
pb.directory(new File("bin"));
try {
pb.start();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
but I…

JaneLilep
- 79
- 1
- 9
0
votes
0 answers
Make osascript execute in parent bash
I want to extend the sudo timeout using GUI on my Mac for a script which contains sudo commands but is not allowed to run with root in total.
so I want to do something like:
osascript -e "do shell script 'sudo -v'" with administrator…

cagcoach
- 625
- 7
- 24
0
votes
1 answer
Why is JAX shell not seeing the command that is on the global path?
When I call my script that then calls my shell command I'm getting an error:
Error: sh: excel: command not found
I'm using the following code in my SCPT file:
var app = Application.currentApplication();
app.includeStandardAdditions = true;
var…

1.21 gigawatts
- 16,517
- 32
- 123
- 231
0
votes
2 answers
How to write to standard data out using JavaScript or AppleScript multiple times?
If I create an AppleScript script called myscript.js and pass it to oascript it will execute the run function once and write "hello world" to standard data out:
function run(args) {
for (var i=0;i<10;i++) {
// out("number " + i); //…

1.21 gigawatts
- 16,517
- 32
- 123
- 231
0
votes
1 answer
How do I choose JavaScript for my AppleScript SCPT file?
I'm calling an Applescript scpt file and when I opened the AppleScript editor it had an option to use JavaScript.
I would like to convert my AppleScript to JavaScript but can't find any documentation on it (announcements and such and redirects on…

1.21 gigawatts
- 16,517
- 32
- 123
- 231
0
votes
2 answers
Mac Automation Scripting - Pass an object as a value
I am trying to pass Date object as a value to Javascript constructor for Mac Automation Scripting. Here is the code that I am trying to run:
app = Application.currentApplication();
app.includeStandardAdditions = true;
app.strictPropertyScope =…

ys64
- 290
- 2
- 8
0
votes
0 answers
Display dialog on run argv only shows first word of string
I'm trying to create a script that will bring up a popup window with info that involves a variable created earlier in the script.
I initially made the following and it works:
#!/bin/bash -v
minToRestart=5
osascript -e 'display dialog "Software…

it7276
- 1
- 1
0
votes
1 answer
How to pass a variable as an argument in Bash
I'm trying to change my Mac OS X desktop background using osascript script. Everything works fine if I use everything as static. But if I try to introduce a variable everything goes haywire.
My code is below.
#! /bin/bash
function random_wall ()…

Furkanicus
- 329
- 2
- 18
0
votes
1 answer
Application is background-only
I am trying to open Google chrome using OSX script to bring it to front.
But I am getting the exception:
Application is background-only
Code is given below.
public void bringBrowserToFront() {
try {
String script = "tell app \"Google…

Shamnad P S
- 1,095
- 2
- 15
- 43
0
votes
1 answer
Can’t make application into type application
script error: Can’t make application into type application. (-1700)
Bad parameter data was detected or there was a failure while performing a coercion. (Line 17, Character 28). I think it may be a problem with my dialog popup or script the line…

user7903682
- 199
- 1
- 1
- 18
0
votes
1 answer
osascript opens a new window instead of just a new tab
I'm trying to open a new tab and run a command in it. Instead, this opens a new tab which opens a new window and then runs the command... What am I doing wrong?
exec(`osascript -e 'tell application \"System Events\" to tell process \"Terminal\" to…

Idan Adar
- 44,156
- 13
- 50
- 89