Sublime Forum

Build System for javascript

#1

I’m trying to run a script for Photoshop in sublime text written in javascript but It doesn’t work due to the build System: wich one should I use?
I tried several but they dont work….

0 Likes

#2

There are no build systems for JavaScript that ship with Sublime because generally speaking it’s something like your web browser (or in this case, Photoshop I guess) that runs JavaScript code.

Presuming that there is some tool that Adobe provides to execute scripts in Photoshop from a command prompt you could certainly create your own in Sublime, but that would require knowledge of how to do it manually first.

0 Likes

#3

Ok in fact if I put the automatic ir says that there is no Build System, so there is no way I can run my script from Sublime??? :sob:

0 Likes

#4

It says No build system because as I stated above, there isn’t a build system for JavaScript unless you write one yourself. To do that, you need to know how to manually take the steps of running some command in the Windows command prompt/MacOS Terminal that causes the action you want to take place.

0 Likes

#5

I tried to put in the script some command for the build system that I found in Internet but if u don´t put a build system from the sublime the script doesn’t work…
I just want to use command #target photoshop

0 Likes

#6

I created a new build system with this code:

{
“cmd”: ["/usr/local/bin/node", “Foto.jsx”],
“selector”: “source.js”
}

but it doesn’t work… I really don’t know how to use it

0 Likes

#7

For that build system to work, you would need to have NodeJS installed, and also be running either macOS or Linux. Additionally, the script would have to somehow connect itself to Photoshop while it’s running; does that actually happen?

1 Like

#8

Yes thank u! Now It works :grin:

0 Likes

#9

Sorry I have installed node but the build system for javascript I’ve copied from Internet doesn’t run correctly: if u want i can copy here later, so I think thats why the commands #target Photoshop and alert don’t work in my script in Sublime Text…… if u could hel8 me :grin:

0 Likes

#10

Unfortunately, I know nothing about how one would write a JavaScript program that somehow talks to and instructs PhotoShop to do something (I do not use PhotoShop).

As such, the simplest possible build system for running a JavaScript program is simply:

{
    "shell_cmd": "node \"$file\"",
    "selector": "source.js"
}

Which tells Sublime to use node to run JavaScript files. If doing that doesn’t do the right thing, that’s a question that I’m afraid you have to target at whoever wrote the script.

Or if you will, all Sublime is going to do is run some external program; what that program does is outside of anything Sublime knows or cares about.

0 Likes

#11

I´m running the Build System in javascript and it gives me this error:
/Users/lillaannecchino/Library/Application Support/Sublime Text 3/Packages/User/mio.sublime-build:3
“shell_cmd”: “node “$file””,
^

SyntaxError: Unexpected token ‘:’

0 Likes

#12

You’re trying to somehow run the build system; that’s not now that works. After you put the build system in place, you open up a JavaScript file and use Tools > Build from the menu in order to execute the javascript using it.

Your problems sound like they’re very fundamental to working with Sublime and computers in general, and it’s somewhat worrying that up above you said:

When it in fact doesn’t seem to work at all.

There is a video series that teaches you what build systems are and how to use them that can guide you through making the required changes and using them, but. and I can’t stress this enough, you really need to read the documentation on whatever script you’re trying to do something with PhotoShop with in order to figure out how to use it. Nobody here is likely to be able to help you with that aspect.

0 Likes

#13

Ok I thought the problem was the build system thanx to help me understanding that the problem is the JavaScript script: I wrote the Person who writed it now waiting for an answer.
The problem is that I really don’t know of the command #target photoshop efectly exists and why alert that really exists, doesn’t work……
It seemed they worked in somehow for a while :slight_smile: But not really sorry I got emocionated

0 Likes