Questions tagged [osascript]

MacOS command line tool which executes OSA scripts (AppleScript, JavaScript, etc.)

267 questions
-1
votes
1 answer

Why does my desktop background does not change after executing Python script?

I followed this tutorial for changing the background on my macOS Monterey 12.5. When I run the Python script my background ist not changing but I also don't get an error message. In System Preferences > Security & Privacy > Automation I added the…
Max Hager
  • 536
  • 4
  • 13
-1
votes
1 answer

reload Terminal preferences .plist after change

I used plutil to edit the plist. then I placed in under /User//Library/Preferences/com.apple.Terminal.plist. I want it to update the settings without reboot the application. How do I do this? using defaults read com.apple.Terminal…
jredfox_
  • 19
  • 6
-1
votes
2 answers

How to force close terminal window id using AppleScript?

I am starting a new terminal window from a terminal: osascript -e 'tell app "Terminal" to do script "myProgram.sh"' Since the new process is not ending(it is basically a server), I want to be able to stop it at some point using AppleScript. If I…
CuriousGuy
  • 1,545
  • 3
  • 20
  • 42
-1
votes
1 answer

Is there a way to send an iMessage to a group chat using Applescript or any Python module?

I've tried pyimessage, applescript, and osascript. The only thing I could find that seemed promising was this older stackoverflow question: Send group iMessage using applescript I wasn't able to get that working. Has anyone been able to send to an…
-1
votes
1 answer

Osascript custom function not interpreting command string properly

I have this function that I've written: function alert { command='display alert ' content="${1} message ${2}" concat=$command$content osascript -e "${concat}" } When executed like: alert 'Title' 'Message' I get the error…
shoe
  • 952
  • 1
  • 20
  • 44
-1
votes
1 answer

how to convert Applescript scpt file to command

I've done this before and it doesn't lend itself to googling the terms. I'm trying to run an applescript without specifying osascript in the begining so that it's executable (i know you could do an alias), but I'm stubborn and need to figure out…
dlite922
  • 1,924
  • 3
  • 24
  • 60
-1
votes
1 answer

running nohup osascript do shell - result in errors

I'm running a command file which enables me to double-click. File name: Documents.command runs a process in the background without having a terminal window open; therefore, I'm using & pkill -f -a Terminal to close the terminal app. It was working…
James Dean
  • 155
  • 1
  • 17
-2
votes
1 answer

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 this possible? More generally though, is there a way to see what…
Michael Campbell
  • 2,022
  • 1
  • 17
  • 22
-2
votes
1 answer

How to tell terminal to do script in window I just opened

I tried this tell application "Terminal" set custom to open "/Users/jredfox/Desktop/h.terminal" do script "/Users/jredfox/Desktop/test.sh" in custom activate end tell this just says failed. I don't want to hard code window 1 because…
jredfox_
  • 19
  • 6
-2
votes
1 answer

How can I run osascript with python on MacOS?

How can you add login item in system preferences with python using osascript or any other method on macos, Is this process right? subprocess.call("osascript -e add login items to System Preferences {Path: "/home"; value: hidden} at end,…
Blackmoon
  • 22
  • 4
-2
votes
1 answer

How to loop an endless request to play a track from Spotify?

I've written this code in Script Editor. The program loops once or twice but stops soon after. The purpose of the code is to infinitely play "My heart will go on" on the victim's Mac computer. Instead, it only loops twice and can break quite easily.…
1 2 3
17
18