Ok I finally had some time and a clear head to experiment with this, and think it through.
I played with the Windmill object.
=====================================
Script execution on server, vs. client
The timer provides the capability to Take Control, or Leave Control.
When we click:
Take Control = Client takes control of timer.
Leave Control = Client relinquishes control of timer back to Server.
When client takes control of the timer, all script nodes connected to the timer
are executed by the client when the timer's Control Out connector goes Active.
When Client relinquishes control of the timer back to the server,
all script nodes connected to the timer are executed by the Server
when the timer's Control Out connector goes Active.
If we want a script to execute only once, we need to be able to toggle the timer using a single button click.
This is done similar to this, except '%THIS_NAME%' is replaced with a timer pathname, since it may need to
be executed from a script command node; need to test it to confirm it truly does create a One-Shot timer:
RsApp.TimerActivate('%THIS_NAME%',33);
RsApp.TimerDeactivate('%THIS_NAME%');
----------------------------------------------------------
We can enforce server execution of the script by loading a timer, setting
the Take Control / Leave Control to: Take Control (the server actually has control
of the timer when the button displays this message), then removing that button
from the timer. Then it's Locked In Place to: Server Control.
For security purposes:
We can use the Microsoft GUID Gen tool, which generates a unique GUID (alphanumeric code),
like this:
0A59E18E-4F36-4195-8790-D059FD31668F
We create a node, on the server, above the Space node, and rename it to this GUID.
This is a unique value which will never be created again.
This node is where we put our scripts, so they are protected.
ON THE SERVER: We export the Timer's Control Out node up above the scene node,
to where our new jscript node with the GUID name resides, and hook it up.
================================================
I Need To Test This, with other users at some point soon:
On the server, we set the priveleges of the timer (in the space) and the jscript node
(above the space) to ADMIN (Not User). User permissions have read only access; if they
try to delete the nodes and their connectors, or manipulate them in any way, nothing will happen.
And they cannot see the script up above the scene node, since it resides in the server's graph only.
They cannot even find out the node name, nor view its contents.
By setting permissions of the timer in this way, users cannot re-add the Take Control/Leave Control
button. Nor can they add another timer, and reconnect the Control Out of the timer, to their
newly added timer.
ADMIN rights include read/write/delete priveleges.
By setting the rights of the timer and script to ADMIN, only users with ADMIN priveleges
can edit/delete the timer, and the script node above the scene. In fact, the script node
above the scene is invisible to the user. They just see the results of the script execution.
Script Execution on Server vs. Client
-
froo
- Captain
- Posts: 2554
- Joined: 22 May 2009, 12:13
Script Execution on Server vs. Client
-
froo
- Captain
- Posts: 2554
- Joined: 22 May 2009, 12:13
Re: Script Execution on Server vs. Client
Hm I seem to recall having issues with this; executing scripts on the server, vs. on the client.
Using that windmill object, sometimes it works, sometimes it doesn't.
I don't think this was ever resolved.
Even using the Start button on the windmill does not always work.
I recall we were trying to use the RsApp.SendCustomEvent() to the server to get the script running all the time on the server,
but I don't think we had much luck with it.
Using that windmill object, sometimes it works, sometimes it doesn't.
I don't think this was ever resolved.
Even using the Start button on the windmill does not always work.
I recall we were trying to use the RsApp.SendCustomEvent() to the server to get the script running all the time on the server,
but I don't think we had much luck with it.
-
3dvisuals dude
- Chief Warrant Officer
- Posts: 643
- Joined: 03 Jun 2009, 02:53
- Type the number ten into the box: 0
Re: Script Execution on Server vs. Client
true, that was bacj before all the 7.6x development and related core access methods though. this would be a question for Vlad, may want to start itemizing a list of these.froo wrote:Hm I seem to recall having issues with this; executing scripts on the server, vs. on the client.
Using that windmill object, sometimes it works, sometimes it doesn't.
I don't think this was ever resolved.
Even using the Start button on the windmill does not always work.
I recall we were trying to use the RsApp.SendCustomEvent() to the server to get the script running all the time on the server,
but I don't think we had much luck with it.
-
froo
- Captain
- Posts: 2554
- Joined: 22 May 2009, 12:13
Re: Script Execution on Server vs. Client
yes, I was thinking the same thing. Need to bring in the big guns!
However, I also realize I have only been working with a single example: the windmill.
So, I created a space from scratch, in port 1111.
However, I also realize I have only been working with a single example: the windmill.
So, I created a space from scratch, in port 1111.
-
3dvisuals dude
- Chief Warrant Officer
- Posts: 643
- Joined: 03 Jun 2009, 02:53
- Type the number ten into the box: 0
Re: Script Execution on Server vs. Client
Great! will check it out in a bit here!froo wrote:yes, I was thinking the same thing. Need to bring in the big guns!
However, I also realize I have only been working with a single example: the windmill.
So, I created a space from scratch, in port 1111.
-
froo
- Captain
- Posts: 2554
- Joined: 22 May 2009, 12:13
Re: Script Execution on Server vs. Client
ahh this doesn't work so well. That's ok...
Maybe RsApp.SendCustomEvent would help?
Maybe RsApp.SendCustomEvent would help?