Created
February 9, 2017 13:39
-
-
Save niittymaa/eb096af32f18538d06d4ae85af448535 to your computer and use it in GitHub Desktop.
Function for reading JSON files into Indesign
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
extended javascript for | |
Adobe Indesign 5.5 | |
by | |
PDXIII | |
http://about.me/PDXIII | |
Honestly: It's from fabiantheblind, but I typed it ;-) | |
*/ | |
main(); | |
function main(){ | |
var myJSONobject; | |
// get the textfile | |
var filepath = "~/Desktop/Design/FontList.json"; | |
var fontList = File(filepath); | |
alert(fontList); | |
var content; | |
if(fontList != false){ | |
fontList.open('r'); | |
content = fontList.read(); | |
myJSONobject = eval("{" + content + "}"); | |
alert(myJSONobject.length); | |
fontList.close(); // always close files after reading | |
}else{ | |
alert("Bah!"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment