Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

20 lines (16 sloc) 0.607 kB
require 'cfpropertylist'
require 'json'
plist = CFPropertyList::List.new(file:
File.expand_path("~/Library/Preferences/.GlobalPreferences.plist"))
replacement_items = plist.value.value["NSUserReplacementItems"].value
items = replacement_items.inject({}) do |memo, index|
entry = index.value
key = entry["replace"].value
enabled = entry["on"] && (entry["on"].value == 1)
replacement = entry["with"].value
memo[key] = {"enabled" => enabled, "replacement" => replacement}
memo
end
File.open("text-substitutions.json", "w") do |f|
f.write JSON.pretty_generate(items,:ascii_only => true)
end
Jump to Line
Something went wrong with that request. Please try again.