If we select a .plist file in the Finder
this macro will copy it to the clipboard as JSON, which can be pasted into Script Editor, Atom.app, CodeRunner etc as the value of a JavaScript object.
Copy selected plist file as JSON.kmmacros (21.3 KB)
JavaScript for Automation Source:
(function () {
'use strict';
var strPath = Application('Keyboard Maestro Engine')
.getvariable('plistFilePath');
return (strPath.toLowerCase()
.endsWith('.plist')) ? (
JSON.stringify(
ObjC.deepUnwrap(
$.NSDictionary.dictionaryWithContentsOfFile(
strPath
),
null, 2
)
)
) : '';
})();