Copy link to clipboard
Copied
I have a CSV file with booleans as the content. Now I want to write a JS script that looks for the boolean in a certain Datafield <<boolean>> from my data merge in inDesign and then depending on wether that boolean is 1,0 (True or False) displays a square with a black outline and no fill or a square with a blck outline and black fill. That square's position is dependent on my design and should be possible to be determined. How do I write that script? Can you point me in the right direction? I have no idea how to access the specific Datafield <<boolean>> from the datamerge. And how would I draw a shape with js in indesign and place it where I want it corespondingly to where the Datafields would be written on my InDesign document? Thanks for reading my complex question. (at least that's what I think it is)
Copy link to clipboard
Copied
I wouldn't use a script, but instead I'd use GREP styles to accomplish this.
First, you would need to make a font where only the characters 1 and 0 had any appearance. You could use this script: http://www.indiscripts.com/post/2013/05/indyfont-1-1-public-pro-release-and-users-guide to do this (the free version will let you create a font with one character and you could make two fonts; OR you could help out the developers and purchase the font and do it in one font). In each case, you want to turn a square into the single character font that will be mapped to the 1 and 0 characters.
Then, you would make one paragraph style that contains two GREP styles - one that applies a black outline only whenever the GREP style looks for 0; and one that applies a black fill whenever the GREP style looks for 1.