Posts: 136
Threads: 20
Joined: Jul 2015
Reputation:
0
Hi,
I would like to be able to force the execution of a Scheduled Script, is there a solution for that ?
If blablabla then
Scheduled_script > run
end
BR
Jean-Marc
Jean-Marc
Posts: 111
Threads: 14
Joined: Nov 2019
Reputation:
6
script.enable(Script_Name)
and
script.disable(Script_Name)
Posts: 7758
Threads: 42
Joined: Jun 2015
Reputation:
447
enable does not execute the scheduled script. One solution is to create a user library and move your code there. Then run it by calling require from scheduled and any other script. Make sure that auto load is disabled for this library.
Posts: 7758
Threads: 42
Joined: Jun 2015
Reputation:
447
Can you explain why this solution doesn't fit your needs?
Posts: 7758
Threads: 42
Joined: Jun 2015
Reputation:
447
Just use require('user.user_lib_name') in your code. Keep in mind that if you require the same library multiple times it will be executed only the first time. If you need to call it multiple times then you need to wrap your code into a function and then call this function. It's also good practice to use local variables in your library otherwise variables with same name in your main script will be overwritten.