2

I am new to Adobe Scripting - what is the difference between .jsx and .js?

4

The scripting engine Adobe uses is called ExtendScript which is a dialect of JavaScript, or more accurately EcmaScript. There are many dialects of JavaScript with different libraries around, and some unique preprocessor statements. ExtendScript has a number of libraries not available elsewhere. JavaScript has certain base features that makes them similar and often compatible but they have different API details. So ExtendScript has many different commands from JavaScript in a browser.

Why a different extension? Simply put, that allows the Windows operating system to recognize that you intend to run the script with Adobe's interpreter. There is a somewhat similar mechanism on OS X. On Windows for example a file with the *.js extension will by default launch Microsofts script interpretter that is called JScript which again is a dialect of EcmaScript with libraries unlike ExtendScript, unlike Browsers and unlike NodeJS...

(JScript can also talk with Adobe software but trough a COM bridge just like Visual Basic, but unlike ExtendScript it can also communicate with many more Windows components like OS, and many more installed software like Excel or a CAD app for example, but being IPC its a bit different)

Actually the extension does not matter... as long as you tell which software should do what with the file. Its just more convenient to have automatic file handling.

| improve this answer | |
  • 1
    While the explanation is correct, note that it can in some respect also be less convenient to use .jsx: On OS X for example you cannot search for text in .jsx files via Spotlight, while with .js files you can. Finder does also not show you text previews with .jsx files, while with .js files it does. For those reasons I switched to using only .js when I develop new ExtendScript scripts, as I find it more convenient. – mdomino Aug 10 '16 at 22:08
  • @mdomino you can probably register jsx as a text file for finder search. Same thing happens in windows, but its pretty trivial to add jsx as one of the files that previews and searches as text that IMO is a better option. Now of i only could do the same with ai files and convince them to preview as PDF but nobody seems to know how to do that. – joojaa Aug 11 '16 at 4:42
  • I would start here if wanted to change jsx to searchable on mac @mdomino – joojaa Aug 11 '16 at 4:57
  • 1
    Thanks, I didn't know that. However, I have not encountered any disadvantages with using .js instead of .jsx, so I think I'll stick with it (also, I use Sublime to develop my ExtendScript scripts). – mdomino Aug 11 '16 at 6:53
  • @mdomino well like i said it does not matter what your extension is. However for a average user it may be better to stay as jsx, also its more useful if you develop javaScripts for multiple platforms if all you ever do is ExtendScript then no problem but if you ever start using Node.Js you get a extra interdiction on top of this. Which is why if i were you i would configure for jsx and set sublime default editor for jsx that way you dont attempt to run something meant for NodeJs or a browser in Adobe context. Also it makes it easier to share to beginners. – joojaa Aug 11 '16 at 7:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.