download

Library

This website is based on the in-progress basil.js develop branch
In the future, this will link to the: basil.js latest release

Download the bundle above and follow the steps in our installation guide at our tutorials section.

Cheatsheets and References

The basil.js cheatsheet: basiljs_cheatsheet_v2_02.pdf

The basil.js b.typo cheatsheet: basiljs_typo_cheatsheet_v2_01.pdf

The basil.js InDesign Object Model: basiljs-IOM-0.2.pdf

InDesign Scripting Reference: InDesign_Skripting_Kurzreferenz.pdf

Source code

Please note that basil.js is provided as open-source under the MIT License.

Designers and developers who are interested in the “bleeding edge” are welcome to use our Git repository at https://github.com/basiljs/basil.js (develop branch)

Deprecated basil.js versions can still be downloaded from Github: https://github.com/basiljs/basil.js/tags

Please contact us on GitHub for pull and feature requests.

Change log

+ new
* changed
- removed

..-  --.- ..- -.... -..-- .-..-. -.-..---.-.-....--.-- -....-.... -..-- .-
basil.js x.x.x DAY MONTH YEAR

+ basil works without the b. prefix now
+ function draw() works without b.go() now, function loop() replaces b.loop()
+ User settings (units, anchor point etc.) are now saved before and restored after script execution
+ Added mode() to set performance modes (VISIBLE, HIDDEN, SILENT) during script execution
+ Added frameRate() to set frame rate during looping scripts
+ Added transform() function to transform page items independent of the current matrix
  and to measure current transforms of page items
+ Added point(), quad() and triangle() to draw the corresponding shapes
+ Added referencePoint() function to set the reference point for transform()
+ Added file() and folder()
  gets files and folders or creates them
+ Added files()
  gets all files of a folder
+ Added selectFile(), selectFiles() and selectFolder()
  opens a selection dialog to select files or folders
+ Added applyParagraphStyle(), applyCharacterStyle(), applyObjectStyle(),
  set the style of a text object/page item.
  see examples/typography/styles.jsx
+ Added applyMasterPage()
  applies a master page to a page
+ Added masterPage()
  activates and returns a master page
+ Added arrange()
  allows to arrange page items or layers in z-space
+ Added property()
  sets a property of an object to a given value
+ Added graphics() to loop over graphics in a given container
+ Added textStyleRanges() to loop over text style ranges in a given container
+ Added swatch()
  returns a color or gradient of a given name
+ Added revert()
  reverts the document to a fresh state
+ Added SCRIPTNAME
  holds the name of the current script
+ Added isInteger()
  checks if a given variable is an integer

* translate(), rotate() and scale() now behave like they do in Processing and change the current matrix
* basil scripts will by default use the user's default units or the current units of the document,
  as well as the transformation reference point set by the user
* text() can be used to place text into shapes or as text paths on graphic lines
* image() now allows to place images into text frames as well
* canvasMode() behaves a lot more reliable now
  FACING_PAGES, FACING_MARGINS, FACING_BLEEDS, fixed for 3+ page spreads
  BLEED, MARGIN, FACING_MARGINS, FACING_BLEEDS, fixed for single page in facing_pages mode
  all modes work now for margins or bleeds of different sizes
  resetMatrix() does not reset the canvas mode anymore
* performance constants are called VISIBLE, HIDDEN and SILENT now and are used together with the new mode() function
* rect() now allows additional parameters to add rounded corners
* paragraphStyle(), characterStyle() and objectStyle() are expanded:
  They can now get an applied style from a text object/page item and can
  make use of an optional object with property name/value pairs to set
  the properties of the style.
* inspect() has been completely reworked:
  Much faster, especially for complex objects.
  Nicer presentation of results (tree style).
  Options to show or hide properties, values and/or methods.
  Option to show only certain properties.
  Lots of minor fixes.
* page(), pageNumber() and removePage() now also accept page name strings as parameters
* pageCount() can now also be used to set the doc's page count
* previousPage() and nextPage() now work as expected
* when drawing closed vertex paths, endShape() instead of beginShape() now takes the
  CLOSE constant as argument
* println() and print() can now print multiple parameters to console
* trimWord() now correctly trims all punctuation from word borders
* text() now respects the currently set rectangle mode
* rectMode() now works with RADIUS
* Improved the speed of clear() considerably
* textFont() does no longer stop the script if a font is missing, but gives a console warning instead
* isText() now correctly identifies collections of multiple text objects as text
  (Characters, Words, Lines etc.)
* size() now can use existing page size presets as a parameter with an optional
  second parameter for page orientation (introducing PORTRAIT and LANDSCAPE)
* duplicate() now duplicates page items reliably in place, even when in FACING canvas modes
* selection() can now be used to set the selection
* label() can now be used to assign a label to a page item
* Updated categories and sub-categories of many functions to better align to Processing/p5.js categories
  or – in case of non-Processing functions – to better reflect the InDesign categories they belong to
* Changed all include/includepath/targetengine statements from # to //@
  This allows linting with eslint of all files
* Linted all the test files
* Changed the location of the basil.js library from `~/Documents/basiljs/bundle/basil.js` to `~/Documents/basiljs/basil.js` in all the example files.
The user is allowed to have his files wherever he wants.
* bounds() now correctly measures bounds in different canvas modes(MARGIN/BLEED etc.)

- b.go() and b.loop() are removed (use function draw() or function loop() instead)
- b.itemX(), b.itemY(), b.itemWidth(), b.itemHeight(), b.itemPosition() and b.itemSize() are removed
  and replaced by the new transform() function
- b.transformImage() is removed as it can be replaced by the new transform function()
- b.storyCount() is removed (use stories(doc()).length instead)
- Array.map() and Array.filter() are removed
- b.Random.nextGaussian() is removed

Special thanks to Hartmut Bohnacker for making the transform functions work in Processing style!

..-  --.- ..- -.... -..-- .-..-. -.-..---.-.-....--.-- -....-.... -..-- .-
basil.js 1.1.0 - 11 November 2016

+ Added b.size() to set and get the document size
+ Added b.gradient() to great colourful gradients
+ Added b.gradientMode() to set gradient type b.LINEAR or b.RADIAL
+ Added b.placeholder() to fill a textFrame with random placeholder text
+ Added b.LOREM constant holding a lorem ipsum string
+ Added npm script for better tooling and development
  npm run watch
  npm run release (insert timestamp + version string in first line of bundle)
  npm run bundle (without timestamp + version string)
+ Added .eslintrc file (linting rules) to reflect current coding style

* The basil.js file is bundled from /src to a single file:
  It is no longer required to have the basil.js file at a certain path.
  Break out with your project folders to any location w/o breaking things!
* Entire source code is linted, wrong line breaks fixed
* Source code reorganised to /src folder
* Readme files updated to acknowledge new contributors

* Bugfix: b.color("colorName") error when using resulting color in b.fill() twice
* Bugfix: b.layer() did not set active layer to given argument
* Bugfix: b.image() error/warning handling if incomplete arguments
* Bugfix: b.isText() did not work for instances of Text
* Bugfix: b.words(), b.lines() etc. were broken
* Bugfix: b.objectStyle(), b.characterStyle() and b.paragraphStyle() were broken

Shout outs to Timo Rychert and Fabian Morón Zirfas!
This release is entirely based on your hard work!
Many thanks for this massive contributions!

..-  --.- ..- -.... -..-- .-..-. -.-..---.-.-....--.-- -....-.... -..-- .-
basil.js 1.0.10 -

+ Added package.json definition
* Changed versioning scheme to npm style

..-  --.- ..- -.... -..-- .-..-. -.-..---.-.-....--.-- -....-.... -..-- .-
basil.js 1.09 -

+ Added installer scripts for OS X and Windows
* Added some better error reporting for null objects
* Minor bug fixes

..-  --.- ..- -.... -..-- .-..-. -.-..---.-.-....--.-- -....-.... -..-- .-
basil.js 1.08 - 11 November 2013

+ Added b.arc() by Ken Frederick, cheers mate!
+ Added b.weekday(), b.timestamp() and b.millisecond()
* Fixed output to progress panel
* Added auto save to MODEHIDDEN
* Added 15s timeout to loadStrings via TCP/IP
* Improved error reporting
* Bugfix to b.addStory()
* Changed default folder for b.download() to data/

..-  --.- ..- -.... -..-- .-..-. -.-..---.-.-....--.-- -....-.... -..-- .-
basil.js 1.07-experimental - 22 October 2013

* Fixed buggy b.noise()
* Urgent bug fix to b.color() and others

..-  --.- ..- -.... -..-- .-..-. -.-..---.-.-....--.-- -....-.... -..-- .-
basil.js 1.06-experimental - 21 October 2013

* Internal refactorings (split basil.js into many includes)
* Changed to FAST_ENTIRE_SCRIPT execution mode

Please note that this release is still experimental.

..-  --.- ..- -.... -..-- .-..-. -.-..---.-.-....--.-- -....-.... -..-- .-
basil.js 1.05 - 9 October 2013

* Bugfix to b.endShape()
* Bugfix to b.loadString() and b.download(),
  now supports more than one GET parameter
* changed default anchor to center for transforms with line()
* internal safety improvements

..-  --.- ..- -.... -..-- .-..-. -.-..---.-.-....--.-- -....-.... -..-- .-
basil.js 1.04 - 23 September 2013
+ added b.addShape() in order to create multi-component shapes with b.vertex();

+ added b.nameOnPage(), get a pageitem on the active page by name.
  see examples/document/nameOnPage.jsx

+ added b.download(). Downloads an URL to a file, currently Mac only.
  see examples/output/download.jsx

+ added b.shellExecute(), currently Mac only.
  see examples/input/shellExecute.jsx

+ added b.group() and b.ungroup()
+ added b.isURL() validator checker function
+ added string helpers b.endsWith() and b.startsWith()
+ added b.projectPath() to get the folder of the active document
+ added b.saveString() to save a singe string to a file

* Extended loadString() and loadStrings() to handle URLs. Happy GET URL!
  see examples/input/loadStringURL.jsx

* all export functions can handle now sub-folders
  e.g. exportPNG("swiss/basel/snap.png")


..-  --.- ..- -.... -..-- .-..-. -.-..---.-.-....--.-- -....-.... -..-- .-
basil.js 1.03 - 3 July 2013
* added missing support for layer and stroke settings to b.image()
+ added b.savePNG()


..-  --.- ..- -.... -..-- .-..-. -.-..---.-.-....--.-- -....-.... -..-- .-
basil.js 1.02 - 3 June 2013

* fixed a bug with b.constrain()
* added constraints for b.color() and b.fill(), where illegal channel
  values would previously produce strange results


..-  --.- ..- -.... -..-- .-..-. -.-..---.-.-....--.-- -....-.... -..-- .-
basil.js 1.01 - 23 May 2013

+ added b.transform() and b.matrix()
+ added b.remove() for the removal of objects
+ added b.duplicate() for duplicating page items and pages
+ added b.label() and b.selection() as single item alternatives
+ added demos to examples folder
* changed default image fit behaviour to FitOptions.FILL_PROPORTIONALLY
* corrected credits for the processing.js team
* Several JSDOC updates and updated reference on website


..-  --.- ..- -.... -..-- .-..-. -.-..---.-.-....--.-- -....-.... -..-- .-
basil.js 1.00 - 28 Feb 2013

First public release!

+ new functions to work conveniently with stories (indesign model of linked
  content or many textframes), e.g. b.addToStory(), b.storyCount() ...
  see: examples/document/story.jsx


..-  --.- ..- -.... -..-- .-..-. -.-..---.-.-....--.-- -....-.... -..-- .-
basil.js 0.22 - 25 Feb 2013

+ new computation modes MODESILENT, MODEHIDDEN, MODEVISIBLE.
  HIDDEN is very handy for working with large files, as the document is
  processed completely in background, performance is a lot better.

* Changes for b.go().
  You can switch between the computation modes via b.go( b.MODESILENT ),
  b.go( b.MODEHIDDEN ) and b.go( b.MODEVISIBLE ). If b.go() is called
  without a paramter, then the default mode MODESILENT is used.

Special thanks to be:screen GmbH for the new computation modes and
performance optimization!

+ new functions for creating shapes. you can create arbitrary lines,
  bezier curves, polygones with beginShape(), endShape() and vertex()


..-  --.- ..- -.... -..-- .-..-. -.-..---.-.-....--.-- -....-.... -..-- .-
basil.js 0.21 - 21 Dec 2012

basil.js goes semi public with a private beta release


..-  --.- ..- -.... -..-- .-..-. -.-..---.-.-....--.-- -....-.... -..-- .-
basil.js pre 0.21 - May to Dec 2012

basil.js is developed over the Summer by Ted Davis, Benedikt Groß,
Stefan Landsbek and Ludwig Zeller.

Special thanks to Stefan Landsbek for the inital code architecture!