Page 1 of 1

Binary data into binary script

Posted: May 27th, 2009, 3:13 am
by Yenaphe
Hi everyone,

i was wondering if it is possible to embed graphics into a jsxbin file. I've got several pngs as external ressources, but to avoid any problem i'd like to put them inside the binaryfile, but i don't know how it can be done, and if it's compatible with the AE extendscript.

Re: Binary data into binary script

Posted: June 3rd, 2009, 8:35 am
by nab
You can embed binary data in you script as an hex string. When you execute the script, the icon file (if it does not already exists) can be recreated from the hex string. So basically what you need is some binToHex() and hexToBin() functions to do the conversion.
  • for each icon file, convert binary data to hex string and write the resulting string in a text file for instance (e.g. myIconData.txt --> var hexStr = "...";)
  • insert this string in your main script
  • in the main script, check whether the icon file exists, and recreate it if necessary
For more details see this post: ps-scripts.com (you can find conversion functions in xbytor's xtools)

I will soon release new versions of my scripts, and some of them use this technique. Works pretty well ;)

Re: Binary data into binary script

Posted: June 4th, 2009, 2:53 am
by Yenaphe
Very very very nice Nab. Gonna have a closer look at this.

Re: Binary data into binary script

Posted: June 4th, 2009, 4:42 pm
by Yenaphe
Quick question nab.

Is it possible to use the hex data directly within ScriptUI methods, or do i have to do the hex2bin to recreate the file and then reimport it ?

Re: Binary data into binary script

Posted: November 20th, 2010, 7:09 am
by francoisgfx
that is great, I was actually trying a base64 approach, but that looks great. did you guys come up with some framework for that ?