This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import PyXA | |
app = PyXA.application("Finder") | |
window = app.windows()[0] | |
lock = False | |
old_w = 0 | |
old_h = 0 | |
while True: | |
if window.position.y < 50 and lock is False: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from pprint import pprint | |
import PyXA | |
import random | |
from time import sleep | |
textedit = PyXA.application("TextEdit") | |
# Open a URL and wait for it to load | |
safari = PyXA.application("Safari") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import PyXA | |
# Open URL in new tab | |
safari = PyXA.application("Safari") | |
# Get open windows, documents, and tabs | |
window1 = safari.front_window() | |
window2 = safari.windows()[1] | |
documents = safari.documents() | |
current_doc = safari.current_document |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import PyXA | |
reader = PyXA.RSSFeed("http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/ws/RSS/topsongs/limit=10/xml") | |
links = reader.items().links() | |
m4as = filter(lambda x: "m4a" in x.url, links) | |
for index, song in enumerate(m4as): | |
print("Now playing: " + reader.items()[index].title) | |
sound = PyXA.XASound(song) | |
sound.play() | |
sleep(sound.duration) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import PyXA | |
from random import random | |
# Horizontal stitching | |
colors = [PyXA.XAColor(random(), 0, random()) for i in range(100)] | |
swatches = [c.make_swatch(10, 500) for c in colors] | |
PyXA.XAImage.horizontal_stitch(swatches).show_in_preview() | |
# Vertical stitching | |
files = ["/Users/exampleUser/Desktop/cat1.jpeg", "/Users/exampleUser/Desktop/cat2.jpeg", "/Users/exampleUser/Desktop/cat3.jpeg"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Tested with PyXA 0.1.0 | |
import PyXA | |
shortcuts = PyXA.Application("Shortcuts") | |
safari = PyXA.Application("Safari") | |
document = safari.current_document | |
shortcut = shortcuts.shortcuts().by_name("Save As PDF") | |
shortcut.run(document.url) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Tested with PyXA 0.1.0 | |
import PyXA | |
from time import sleep | |
app = PyXA.Application("System Preferences") | |
app.activate() | |
pane = app.panes().by_name("Date & Time") | |
pane.reveal() | |
sleep(0.5) # Wait for animation to finish | |
pane.authorize() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Tested with PyXA 0.1.0 | |
import PyXA | |
app = PyXA.Application("TextEdit") | |
for doc in app.documents(): | |
doc.save() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Tested with PyXA 0.1.0 | |
import PyXA | |
from datetime import datetime, timedelta | |
app = PyXA.Application("TextEdit") | |
doc = app.documents()[0] | |
print_time = datetime.now() + timedelta(minutes=1) | |
properties = { | |
"copies": 3, | |
"collating": False, | |
"startingPage": 1, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Test with PyXA 0.1.0 | |
import PyXA | |
messages = PyXA.Application("Messages") | |
person = messages.participants().by_name("Example Person") | |
PyXA.XAURL("sms://" + person.handle).open() |
OlderNewer