Skip to content

Instantly share code, notes, and snippets.

@hanachin
Created November 4, 2012 17:48
Show Gist options
  • Save hanachin/4012751 to your computer and use it in GitHub Desktop.
Save hanachin/4012751 to your computer and use it in GitHub Desktop.
Sublime Text 2 Plugin AutomaticClosePurchaseDialog (works only osx)

How to use

git clone git://gist.github.com/4012751.git ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/AutomaticClosePurchaseDialog

import sublime, sublime_plugin
import subprocess, os
class AutomaticClosePurchaseDialog(sublime_plugin.EventListener):
def on_post_save(self, edit):
close_purchase_path = os.path.join(
sublime.packages_path(),
'AutomaticClosePurchaseDialog',
'close_purchase.scpt'
)
subprocess.Popen(['osascript', os.path.abspath(close_purchase_path)])
tell application "System Events"
tell process "Sublime Text 2"
if exists button "Purchase" of window 1 then
click button "Cancel" of window 1
end if
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment