This is convenient for checking out and changing DOM properties and testing out the JS compatibilities of a given app version.
$.writeln
and $.write
are now forwarded to the console and can include css $.writeln('Hi there', 'background: yellow; color: blue;')
$.writeln()
and $.write()
and __log()
__error()
and __result()
methods will output to the console and automatically stringify objects and arrays.$.props()
will give useful info on selected item or other target, see below for details.__log('hi')
works in both JSX and JS consoles can also include css and class __log('foo', 'background: yellow', 'error')
__error()
same as __log()
just with the error class applied (comes out red)__result(err, result, stderr)
useful for JS callbacks fs.someFunction('somethingHere', __result)
Jfy(myObject)
instead of JSON.stringify(myObject)
echo "your_password" | sudo -S -k <command>
see the answer of user393365 here before you do that.The best way to set up is to clone the repository to a repository folder and create a symbolic link in the CEP extensions folder to the repositories com.creative-scripts.cstk sub-folder.
Note because you need administrative rights use a normal terminal and not CSTK's shell console
mkdir -p "/Users/TREVOR/repositories"
cd "/Users/TREVOR/repositories"
git clone https://github.com/Trevor-/CSTK.git
sudo ln -s "/Users/TREVOR/repositories/CSTK/com.creative-scripts.cstk" "/Library/Application Support/Adobe/CEP/extensions/CSTK"
Note because you need administrative rights use CMD as administrator (Type cmd in Windows search and then right click and choose run as administrator) and not CSTK's shell console
if not exist "C:\Users\TREVOR\repositories" md "C:\Users\TREVOR\repositories"
cd "C:\Users\TREVOR\repositories"
git clone https://github.com/Trevor-/CSTK.git
mklink /J "C:\Program Files\Common Files\Adobe\CEP\extensions\CSTK" "C:\Repositories\CSTK\com.creative-scripts.cstk"
Replace TREVOR with your user name!
After you have done that one time then to update the extension just cd
to the CSTK repository folder and type git pull
If you are a real beginner "developer" and can't handle the above then: Follow the instructions here
Mess around until you get the idea. See the video on this page.
const foo = 123
and then 15 years (not a long time in the history of ExtendScript) later (unless you restarted the app in the meantime) tried const foo = 456
?$.props()
method. This method provided a very convenient way of finding out the properties of a selected item or any target for that matter.
app.selection
property if an object is selected then app.selection[0]
will be the target and if that is undefined depending on the app the app.selection
will be the target and if there's no selection then the target will just default to app
.$.props(app.documents[0])
this will list all the properties of document 0.$.props(app.documents[0], 'fullName', 'id')
if you only want some of them.<integer> /* Enum.CONSTANT */
for example rgbPolicy: 1129345136 /* ColorSettingsPolicy.PRESERVE_EMBEDDED_PROFILES */
app.selection[0]
default by including an array to specify the target for example $.props(['transparencySettings', 'blendingSettings'])
__log(message, css, class)
__error(message, css)
and __result(error, result, stderr)
which will stringify objects and arrays.__result(error, result, stderr)
function is very useful for callbacks in the JS console which will display error, result and stderr.Version 2.2 (07 Aug 19)
Version 2.1 (16 April 18)
__jsx
function from the js console for better processing of jsx.evalScript
and jsx.evalFile
methods.__doc()
method from jsx console to retrieve a document __doc()
is shortcut for app.documents[0]
__doc(10)
is same as app.documents[10]
__sel()
method from jsx console to retrieve the current selection __sel()
is shortcut for app.selection[0]
(In Illustrator in cases where app.selection[0] is undefined and app.selection is not undefined then app.selection
will be returned) __sel(10)
is same as app.selection[10]
Version 2
OK a very lot changed between version 1 and 2 and I've spent too much time on the project as is to list them so for now make do with a git diff
For the next version I'll try and be more helpful.
Please judge me favorably. My annotations and general writing are much less sloppy when I get paid for what I'm doing!