I am trying to change the window title text on my Mac with Applescript.
I followed this post Rename window title in OS X with AppleScript or terminal, but it did not change the text of the Telegram app window title and gives this error: Syntax Error: A property can’t go after this identifier.
I used this script:
tell application "Telegram"
set custom title of window 1 to "I want to change this"
end tell
Can someone find a solution to my problem?
Telegram does not include even the most rudimentary AppleScript support, sorry to say.
Related
I can only find some applescripts on Google with specific music app(like itunes, spotify, etc) to get current playing song.
But now I'm using Netease Music which not supporting to be controled by applescript, I wonder if there is any universal way to get current playing song info via mac media center?
Applescript and other command line tools both ok.
I made a cli tool that lets you read properties from the private MediaRemote framework.
https://github.com/kirtan-shah/nowplaying-cli
Since it uses private APIs, it may break with future macOS updates but is currently working on Ventura 13.1.
Here is an example that will retrieve the song name:
This following AppleScript code uses UI scripting to retrieve the currently playing media.
tell application "System Events" to tell process "Control Center"
click menu bar item "Control Center" of menu bar 1
set currentlyPlaying to value of static text 3 of window "Control Center"
key code 53 -- press 'esc' key
end tell
activate
display dialog currentlyPlaying with title "Currently Playing" buttons ¬
{"OK"} default button 1 giving up after 3
Can anybody figure out how to click the AirPlay Display pop up button in the new TV app (found in MacOS Catalina) using AppleScript? I've tried a zillion different ways, and still get the result "missing value."
As far as I know this code should work:
tell application "System Events"
tell application process "TV"
tell window 1
click ((button whose description is "airplay") of pop up button 1)
end tell
end tell
end tell
Here is a picture of the Accessibility Inspector for that pop up button:
UPDATE: Apparently the new TV app in Catalina is not fully scriptable. AppleScript support for AirPlay Displays does not exist (neither directly nor through GUI scripting). Hopefully, Apple will add support in the future...
I've googled & searched the site for this with no luck, and you guys were such great help last time. I was hoping someone might have an idea of how to change the current users iMessage icon through Applescript? I have looked through the Messages suite under the applescript library and found that there under the class 'application' there is a property 'image'. The description of which is "My image as it appears in all services". It does not appear to be read only.
I am trying to change that property, but in my limited knowledge of Applescript it does not appear to be working. Here's what I've got:
tell application "Messages"
set image to NewImage
end tell
NewImage in this case is a POSIX file path (which I'm not sure is right either) ;\
(OSX Yosemite by the way)
Thanks :]
I am currently working on a school project in which I need to open a video file while using a key press in applescript. I want the program to open the file fullscreen in quicktime player when I press "y" while the program is running.
This is my current code, it works but I don't see how I can include keypresses.
tell application "QuickTime Player"
set testmovie to "Users:Nan:movies:atime.mp4"
activate
open alias testmovie
play document 1
set presenting of document 1 to true
end tell
I hope you guys can help!
You can create a Service in Automator and paste your code within a run applescript action. You can then assign a keystroke to the service in keyboard preferences.
In the example below there are three tabs. Their titles are bash, less, and ssh.
How can I use applescript get the title of the currently selected tab? In this case I hope it would return less.
Picture.png http://img28.imageshack.us/img28/903/pictureqn.png
On OS X 10.7 try something like this:
osascript -e 'tell first window of application "Terminal" to get custom title of selected tab'