Disabling Script

The question is how can I turn off/on script in other script?
I tried this, but it doesn’t work

Hey @sAp , you can find the entity on which that script is attached and then can get the reference of it to disable it.

var entity = this.app.root.findByName("UIEntityName");
var scriptRef = entity.script.ui;
scriptRef.enabled = false;

Thank u! It works!

I found one more problem. The script I turn off/on is an html/css add script. So if I turn it on, then script works and displays my web content. But when I want to turn it off, the script turns off, but the content is still on the screen. What should I do?

html will not be disabled by disabling the script or the entity. You will have to find that html id and disable it’s display individually. Here is how you can do it.

document.getElementById("class id").style.display = "none";