How to protect source of your precious scripts
Hi all,
This short topic is dedicated to all script writters, who wants to keep their scripts out of reach for third persons.
The main framework we'll be talking about is the simple directive called #targetengine.
As we all know, even some of the simplest scripts we made can be really powerfull and lucrative. This is the main reason why we may want to keep them out of range for other people and our employers.
This is the moment where #targetengine directive comes handy.
OK, lets get started.
#targetengine is getting two (as far as I know) basic parameters.
- main (which destroys all the variables/function definitions after scripts is executed)
- session (which keeps all the stuff while application is still running).
You can also make your own global spaces and call them whatever you want to, but we'll be working on just two of these.
In first place, try to copy and paste this simple script to your extended toolscript and try to run it.
#target illustrator
#targetengine "main"
alert(msg);
alert(var1);
safeFunction();
It does not work! You will get a message that both of these variables are not defined and safeFunction is not a function, and thats good.
Now, try to run this script and then run the other one.
#target illustrator
#targetengine "session"
var msg = "this is a message";
var var1 = 4345;
function safeFunction()
{
showMsg();
}
function showMsg()
{
alert(msg +"\n"+ var1);
}
![]()
As you have probably already noticed, the 2nd script works like a charm now.
No matter how experienced coders you are, I suggest you to always keep your property safe, and this is the best way of making your scripts safe.
Have a nice day,
Igor
PS. excuse me my english.