Category Archives: Python

Easier Copy/Paste for Scripting

If you, like me, primarily script with Python dealing with the clipboard is a pain. You can either handle it manually with PyObjC or use the deprecated Appscript. Currently my scripts are about half and half. I just noticed there’s now a library, Rich Xerox, which will take care of this for you. Unfortunately it doesn’t do conversion between rtf and html for you. But you can just call textutil from the command line to do that. 

Related Posts

  • 40
    I’d mentioned in passing in one of my Swift posts about using it as a scripting language. Someone on Twitter asked me if I’d convert from using Python to Swift for my scripts. It’s an excellent question that I really can’t answer fully at this stage. The language is still very beta. Most of the…
    Tags: python, scripts, scripting

Pythonic for Swift

Someone’s written an other great library for Swift: Pythonic. (HT: Oluseyi on ADN) It adds most of the commonly used standard Python library to Swift.

I confess I’ve been learning Swift by recreating the Python library calls that I regularly use. Mine was definitely an exploratory work though. I was mainly working in a Playground. Half the code I deleted when I was done.

Continue reading

Related Posts

  • 42
    I’d mentioned in passing in one of my Swift posts about using it as a scripting language. Someone on Twitter asked me if I’d convert from using Python to Swift for my scripts. It’s an excellent question that I really can’t answer fully at this stage. The language is still very beta. Most of the…
    Tags: swift, python, code

My Scripts

Over at the old blog many of my posts were focused around automation and especially scripting. My scripting language of choice was Python + Appscript. Appscript is no longer supported (although I keep using it) I have switched to using a few more Applescript scripts, but I really hate that language even though I love the idea of Apple Events. I find it sad that fewer and fewer applications really are support scripting via Apple Events. I’m hoping the announcement of Javascript for Applescripting will improve this. I know I’m not alone in disliking the Applescript language while loving a lot of the technology behind it.1

Most of my scripts haven’t been updated in a while, but I try and keep the main ones on GitHub for others to use. As I make significant updates I’ll update the GitHub versions. So if you are interested in my scripts, please check out that repository. Now that Swift is becoming a bit more mature I may try doing some scripts with it in the future.

Continue reading

  1. My favorite joke along these lines is that Perl is a write only language because anyone can writes something in it but it’s nearly impossible to read someone else’s code. (This was in the days of Perl 3) Applescript is a read only language because it’s trivial to read a program and figure out what it does but nearly impossible to easily write a script in it.

Related Posts

  • 46
    I’d mentioned in passing in one of my Swift posts about using it as a scripting language. Someone on Twitter asked me if I’d convert from using Python to Swift for my scripts. It’s an excellent question that I really can’t answer fully at this stage. The language is still very beta. Most of the…
    Tags: swift, python, scripts, scripting, code