Skip to content

Instantly share code, notes, and snippets.

@jlangvad
Forked from alhafoudh/stickies-to-notes.rb
Created August 4, 2012 20:49
Show Gist options
  • Save jlangvad/3259840 to your computer and use it in GitHub Desktop.
Save jlangvad/3259840 to your computer and use it in GitHub Desktop.
OSX 10.8 Mountain Lion - Migrate your stickies from Stickies.app to Notes.app
# Author: Ahmed Al Hafoudh <alhafoudh@freevision.sk
#
# Usage: ruby stickies-to-notes.rb
#
# Prerequisites:
# gem install rb-appscript
#
require 'appscript'
require 'osax'
include Appscript
se = app('System Events')
stickies = app('Stickies')
notes = app('Notes')
se.application_processes['Stickies'].windows.get.each do |window|
note = window.scroll_areas.first.text_areas.first.value.get
notes.activate
OSAX.osax.set_the_clipboard_to(note)
se.keystroke('n', using: [:command_down])
se.keystroke('v', using: [:command_down])
sleep 0.5
end
@jloosfelt
Copy link

Thks for this gist.
To make it work, I had to run Stickies and to check "activer l'accès pour les périphériques d'aide" in the system preferences.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment