Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[enhancement]: add "object script path" to a block #1798

Open
darkiop opened this issue Jan 12, 2025 · 7 comments
Open

[enhancement]: add "object script path" to a block #1798

darkiop opened this issue Jan 12, 2025 · 7 comments
Labels

Comments

@darkiop
Copy link

darkiop commented Jan 12, 2025

Describe the solution you'd like
image

add the path of the current script to this block (first below "System"), like

javascript.0.scriptEnabled.example-script

Why? If the script (start, restart) itself is used as a trigger, you are more flexible with an automatically determined script path in case the script is renamed.

@klein0r
Copy link
Collaborator

klein0r commented Jan 13, 2025

But javascript.0.scriptEnabled.example-script is not the ID of the script. I don't get the use case of this request.
Name of script already provides the object id

@darkiop
Copy link
Author

darkiop commented Jan 13, 2025

Hi Matthias, for something like this, for example - a block that generates javascript.0.scriptEnabled.PRODUKTIV.VIS.Statustexte.01_Muell, the script name in the script itself would be dynamic (if renamed). I have a few scripts like this that should trigger initially when the script is restarted.

image
image

@klein0r
Copy link
Collaborator

klein0r commented Jan 14, 2025

Example: The object id of a script is script.js.Web.Instagram-Followers. You can use the following Block to get this ID:

Screenshot 2025-01-14 at 10 40 56

If you want to know the current state of the script (running), you need to use this state: javascript.0.scriptEnabled.Web.Instagram-Followers. Just replace the parts in the string.

Screenshot 2025-01-14 at 10 43 39

the script name in the script itself would be dynamic

The name is not the problem. The object ID is the problem. And there is no option to "rename" an object. It's always delete + create new. So there is technically no solution for your problem.

@klein0r
Copy link
Collaborator

klein0r commented Jan 14, 2025

You could use message to other script when the script starts (which has a trigger). In that case you don't need to know the object id of the other script.

@darkiop
Copy link
Author

darkiop commented Jan 14, 2025

Thanks for you help Matthias.

With
Image
i get what i need. But I should have come up with the solution myself ;)

I just thought that thematically this output would fit well into the mentioned block.

@klein0r
Copy link
Collaborator

klein0r commented Jan 15, 2025

But in which case is a trigger (on the enabled state) useful for the current script?

@darkiop
Copy link
Author

darkiop commented Jan 15, 2025

The script above generates a text from various DPs from different sources. On the one hand, the trigger directly on the script makes it easier to work on the script (make adjustments, restart script, texts are generated) and on the other hand, it also ensures that the texts are up-to-date when the JS instance or the entire system is restarted. This has worked quite well so far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants