Is it possible to execute JavaScript-Scripts with MC Packages?

Solved
D
Daniel
Hornbach Baumarkt AG

Hey Guys,

we're using a lot of legacy Scripts in our Packages without any issue. Now we have a Demand to execute a JavaScript-Script inside a Package but I won't get this thing running.

The Script works fine when I use "Send Script" but we want to deploy it as a Package (so also Filesync and / or Task Scheduler is actually not an option for us).

Is there any chance to get this running? Or it is actually not supported to use JS with MC-Studio?

Kind regards

a year ago
Android Scripting
ANSWERS
C
Chris
a year ago

Hello,

it works if you use as first line:

#!/usr/bin/env js

and you have to remove for example:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Post-Install Script File
; Date Created: Thursday, 07. September 2023
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

because that is not a javascript compatible comment.


MFG

Solution

also a possible way, true

D
Daniel
a year ago

Thx Chris. 

I already tested that, but forgot to remove the Comment-Block. Shame on me :-)

@Rafael: Your Solution works also, but i preferred to use the Package Script ;-)

Many Thanks to you all!

No problem, i even would do the same ;) I just didn't think of that by myself as I nearly never use scripts in packages and also try to avoid them.

T
TLMOD@SOTI
a year ago

I am glad that your question is answered now.

You should add this as a .js file.

This should work