Questions tagged [py-appscript]
40 questions
3
votes
1 answer
How to get Chrome's active_tab's url by calling Python's app script?
I want to get Google Chrome's active tab's url.
In Safari,
url = appscript.app('Safari').windows.first.current_tab.URL()
Above code works, but
url = appscript.app('Google Chrome').windows.first.current_tab.URL()
it doesn't work
Do you have…

nobinobiru
- 792
- 12
- 28
2
votes
0 answers
Changing desktop in OS X Lion with Python AppScript library
My goal is to change every Mac OS X Lion background (on each Mission Control spaces and on each screen) using the py-appscript.
I've found a piece of code on SO that changes the background :
from appscript import app, mactypes
finder =…

AsTeR
- 7,247
- 14
- 60
- 99
2
votes
1 answer
Set active tab in Chrome and bring it to the front
I'd like to use Python and appscript to set a given Google tab as the foremost tab. I can acquire the tab thusly:
from appscript import *
chrome = app('Google Chrome')
tab_title = 'New York Times'
win_tabs = []
for win in chrome.windows.get():
…

eriophora
- 999
- 1
- 8
- 20
2
votes
1 answer
How to access the current table in Numbers?
How do I access the current table in Numbers using py-appscript?
For posterity, the program I created using this information clears all the cells of the current table and returns the selection to cell A1. I turned it into a Service using a python…

Chris Redford
- 16,982
- 21
- 89
- 109
1
vote
1 answer
"OSERROR -10000 Apple event handler failed" when trying to change desktop wallpaper on Mac
I have written the following really simple python script to change the desktop wallpaper on my mac (based on this thread):
from appscript import app, mactypes
import sys
fileName =…

Danielb
- 1,608
- 5
- 24
- 34
1
vote
2 answers
Translate AppleScript to Python appscript (`do javascript`)
This is the AppleScript template:
tell application "Adobe Photoshop CS5"
set theFile to alias “Application:Documents:MyFile” open theFile
do javascript (file ) with arguments { 75,2,89 }
end tell
And I would like to…

Albert
- 65,406
- 61
- 242
- 386
1
vote
1 answer
How do I export PSDs as PNGs with py-appscript?
I wrote a script to export PSDs as PNGs with rb-appscript. That's fine and dandy, but I can't seem to pull it off in py-appscript.
Here's the ruby code:
#!/usr/bin/env ruby
require 'rubygems'
require 'optparse'
require 'appscript'
ps =…

Q-Bert Reynolds
- 11
- 3
1
vote
1 answer
How to read inbox mails from Microsoft Outlook using python macOS?
I want to verify whether I am receiving an email from a "sender" with a "subject" and a particular "email" template. I have seen help links with win32 module that works for windows. I want to know the way to read the mails from my Microsoft Outlook…

Ajmal Moideen
- 170
- 1
- 6
- 17
1
vote
1 answer
How do I access all of the menu bar icons
I'm talking about the icons that show up on the right hand side of the menu bar. I can get access to that menu bar with (py-appscript)
app(u'System Events').processes[u'SystemUIServer'].menu_bars[1]
& menu_bar_item[1], menu_bar_items[1] & so on…

John
- 1,681
- 3
- 20
- 28
1
vote
1 answer
py-appscript filter with datetime
I am trying to use the day field of a datetime property as a filter when selecting events from an iCal calendar.
The following doesn't seem to work (to select all events for the current date):
cal = app("iCal").calendars["myCalender"].get()
cDate =…

plong0
- 11
- 1
1
vote
1 answer
Bouncing Python Application in Mac Dock when Accessing URLs with py-appscript
This has been a recurring, strange issue for me when accessing URLs using py-appscript, first in Safari and now in Chrome.
Whenever I run the script command to get the current URL in the terminal, for example,
appscript.app("Google…

Chris Redford
- 16,982
- 21
- 89
- 109
1
vote
1 answer
py-appscript & events
Is it possible to subscribe to events using py-appscript ?
Example: I'd like to get a callback when a user changes a rating on iTunes.

jldupont
- 93,734
- 56
- 203
- 318
1
vote
1 answer
Reading bytestreams in Python
I'm using Python appscript to write artwork to my iTunes Songs. I have a file stored in .pict format and when I use the normal open and read routines, it reads the content as a string (encoded in utf-8).
imFile =…

Kartik Aiyer
- 41
- 1
- 2
1
vote
2 answers
How to get multiple properties at the same time?
I am using Appscript - a Python interface to AppleScript - in a project of mine that basically gets data from a Mac application.
Here is a sample code:
asobj = app('Things').to_dos()[0]
self.id = asobj.id()
self.name = asobj.name()
…

Sridhar Ratnakumar
- 81,433
- 63
- 146
- 187
0
votes
0 answers
How to Unblock Appscript blocked by Google?
I am not sure if this is the right place to ask but is there a way I can allow access of scripts on my Google Account?
I have no issue from the past years but after I got a new PC, it wont authorize my App Script to run anymore.I am using someone's…

Teddy
- 1