Can you add some logging to determine where the script is failing?
The problem might be app.activeScript. Try using $.fileName instead; it always refers to the currently executing script.
thought about a possible 3 characters bom of the file¿ So may be your byte position is 10 + 3 ...
Another approach could be to add a label to the app, which is persistant from quitting ...
x = 0;
x = x+1;
app.insertLabel('launchCheck', '' + x);
Sorry, but none of these solutions seem to work. Does anyone has a solid solution for protecting a jsxbin file (usage number limit, date expiration, etc.)?
first script you've posted works here like expected if you user owns the rights for writing to the file ...
Labelscript works too. Though this approach will only protect your script on the target ID-installation.
So, what exactly is your problem? How did you try to implement the labeling?