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
# 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
# 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 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 | |
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 | |
app = PyXA.Application("Shortcuts") | |
folders = app.folders() | |
# Method 1 - Standard iteration | |
summary = [] | |
for folder in folders: | |
folder_name = folder.name | |
num_shortcuts = len(folder.shortcuts()) |
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
# Test with PyXA 0.1.0 | |
import PyXA | |
app = PyXA.Application("TextEdit") | |
documents = app.documents() | |
print("Paragraphs:", documents.paragraphs()) | |
print("Words:", documents.words()) | |
print("Characters:", documents.characters()) |
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") | |
documents = app.documents() | |
date = datetime.now() | |
documents.prepend(str(date) + "\n\n") |
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("Messages") | |
chat = app.chats().by_id("SMS;-;+11234567891") | |
chat.send("Hello!") |
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("Safari") | |
new_tab = app.make("tab", {"URL": "http://google.com"}) | |
app.front_window().tabs().push(new_tab) |
OlderNewer