Questions tagged [basil.js]

basil.js is a bundle that ports the spirit of the Processing visualization language to Adobe InDesign

Description

basil.js is a scripting library that has been developed at the Visual Communication Institute at The Basel School of Design during the last nine months and is now made public as open-source. Based on the principles of “Processing”, basil.js allows designers and artists to individually expand the possibilities of Adobe InDesign in order to create complex projects in data visualization and generative design.

External link

36 questions
1
vote
0 answers

Drawing random shapes within a complex vector shape using InDeesign scripting and or basil.js

I am wondering if there is a simple way to draw a series of random ellipses (or other things) within a complex vector shape (say, a letterform) using basil.js or indesign scripting. I figured out how to place random sized and colored ellipses within…
1
vote
1 answer

How to link chacter styles with strokes in InDesign with Basil.js

I would like to link character styles with a stroke but I don't know how to begin. I have this that just draws a random line, but I would like the line to link all the character styles : #includepath "~/Documents/;%USERPROFILE%Documents"; #include…
ambaamba
  • 71
  • 6
1
vote
1 answer

basil.js scripts taking minutes to run

I'm trying to create an InDesign script using basil.js but the scripts take minutes before running. InDesign just freezes in the meanwhile. Other JS samples (not using basil) work fine. I'm using InDesign 2021 and the MacOS Big Sur 11.2. Could that…
1
vote
1 answer

Custom word styling from csv into InDesign

I have a builded a text editor in javascript that takes keyboard-written-text as an input, and outputs the same paragraph, but with each word styled accordingly to how it was written. My text editor exports a CSV file, where each row is a word, and…
Toreknudsn
  • 13
  • 2
1
vote
0 answers

How to set pageItem properties in Basil.js?

This is a follow up on this question. How do I set pageItem properties like shearAngle in Basil.js? In ExtendScript it is: myPageItem.properties = { shearAngle:20 }; or myPageItem.shearAngle = 20; What would be the Basil.js-ish…
fabianmoronzirfas
  • 4,091
  • 4
  • 24
  • 41
1
vote
1 answer

Basil.js Check URL before pasting image?

I want to eventually make a folder on my server that will be filled with images, using basil.js I would like to extract them and place them into indesign. The script works but I need like an IF statement that will error check if the URL actually…
James.TK
  • 27
  • 5
1
vote
1 answer

add property to object

With Indesign scripting, why can't I add properties to an object? I get an error Object does not support the property or method 'foo' items = b.items(b.layer("s_labels")); for (var i = 0; i < items.length; i++) { …
clankill3r
  • 9,146
  • 20
  • 70
  • 126
1
vote
2 answers

Syntax of b.startsWith() in basil.js

I was wondering how the syntax of the b.startsWith() function in basil.js is supposed to look. I want to check all words of a text to see, if they start with the string 'some' (like 'sometimes', 'something', 'someone', 'somewhere' etc.). So, I…
mdomino
  • 1,195
  • 1
  • 8
  • 22
1
vote
1 answer

How to convert a .txt string to variables in basil.js?

I want to read a string of numbers from a .txt file on my harddrive, convert the numbers to variables in an array and draw circles with the numbers in the .txt file as radiuses. This works fine in processing with code like this: String[] numbers =…
1
vote
2 answers

How can I dynamically attach a scripting label to a newly created item in basil.js?

Is there a way to add scripting labels to PageItems that are created in code, i.e. without using the Scripting Label panel? My code looks like this: var tf = b.text("Hello World", 200, 200, 300, 300);
0
votes
0 answers

Is there a way to separate text from a textbox in Indesign in multiples textboxes with Basil.js?

I would like to split a title from a textBox in multiples textBox, one for each word of the title. I'm using Basil.js for scripting in Indesign, I managed to create a script that detects which textBox is selected, counting the number of words and…
0
votes
0 answers

Can I use Basil.js to change a page's width using a csv?

I want to make book covers using Indesign's Data Merge. The indd is a spread where page 1 is the flap from the back cover, page 2 is the back cover, page 3 is the spine, page 4 is the front cover, page 5 is the flap from the front cover. Page 3, the…
0
votes
0 answers

How to bound images on page and having an individual text per image in a JSON file in InDesign+ title per page

Here is my code to build a 20 page document with prime numbered grids and random image positions and formats but they go out of the page, and it would be good to get the images to snap to the grid and have an individual comment/text per image. I…
ambaamba
  • 71
  • 6
0
votes
1 answer

Loading content from a JSON / CSV and make the textbox fit to the content with basil.js

I'm successfully loading a JSON file into InDesign via basil.js. var jsonString = b.loadString("data.json"); var jsonData; function setup() { jsonData = b.JSON.decode(jsonString); for (var i = 0; i < jsonData.length; i++) { var myText =…
ranzen
  • 3
  • 2
0
votes
1 answer

Drawing Starbursts – basil.js

I am trying to draw a starburst by first drawing a polygon and then adjusting its properties. on indesignjs.de it says a polygon is any shape that is not a rectangle, ellipse, or graphic line. When you add a polygon, InDesign creates a regular…
1
2 3