Hello,
i have a problem. how to make trial version.meybe 30 days trial script.
Thank you
Javascript time limit(trial)
- jaydoubleyou80
- Posts: 21
- Joined: Mon Oct 17, 2016 1:41 pm
- Location: USA
Re: Javascript time limit(trial)
There's a way to encrypt your script after this that I don't recall as I've never done it, but if you use this code, you can determine the system date and then run your script if it is within your predefined date range.
Code: Select all
var endDate=new Date();
endDate.setFullYear(2017,6,26);//note that the month is 6, not seven because January is zero
var today = new Date();
if (endDate>today)
{
alert("insert your script where this alert is")
}
else
{
alert("Your trial has expired, please contact the developer to purchase the script");
}
Re: Javascript time limit(trial)
Not quite. You can convert it into a jsxbin file which is a binary encoded form of your PSJS but it is not encrypted. Somebody wrote a jsxbin to jsx converter that didn't involve decryption, more like decompiling.There's a way to encrypt your script
-
- Posts: 3
- Joined: Tue Jul 25, 2017 5:04 pm
Re: Javascript time limit(trial)
Ok. thank you so much. but script continues. it must stop.
var endDate=new Date();
endDate.setFullYear(2017,7,26);//note that the month is 6, not seven because January is zero
var today = new Date();
if (endDate>today)
{
alert("insert your script where this alert is")
}
else
{
alert("Your trial has expired, please contact the developer to purchase the script");
}
#target photoshop
function main(){function setup_doc(){var idslct=charIDToTypeID("slct");.....
......
var endDate=new Date();
endDate.setFullYear(2017,7,26);//note that the month is 6, not seven because January is zero
var today = new Date();
if (endDate>today)
{
alert("insert your script where this alert is")
}
else
{
alert("Your trial has expired, please contact the developer to purchase the script");
}
#target photoshop
function main(){function setup_doc(){var idslct=charIDToTypeID("slct");.....
......
-
- Posts: 3
- Joined: Tue Jul 25, 2017 5:04 pm
Re: Javascript time limit(trial)
Code: Select all
var endDate=new Date();
endDate.setFullYear(2017,7,26);//note that the month is 6, not seven because January is zero
var today = new Date();
if (endDate>today)
{
alert("insert your script where this alert is")
}
else
{
alert("Your trial has expired, please contact the developer to purchase the script");
}
#target photoshop
function main(){function setup_doc(){var idslct=charIDToTypeID("slct"); ......
- jaydoubleyou80
- Posts: 21
- Joined: Mon Oct 17, 2016 1:41 pm
- Location: USA
Re: Javascript time limit(trial)
Ahh, right. Thanks for the clarification 

- jaydoubleyou80
- Posts: 21
- Joined: Mon Oct 17, 2016 1:41 pm
- Location: USA
Re: Javascript time limit(trial)
Memetaltin, If you only call on that function with the if, the else will take care of anything out of the date range. So for instance, if you set the end date to 8/31/2017, once that date hits, the else will alert them the script can't be used. During the time period that the date is prior to 8/31, it will run the function. It shouldn't continue unless you are somehow calling on the function outside of the if statement.
Code: Select all
#target photoshop
var endDate=new Date();
endDate.setFullYear(2017,7,31);//note that August is seven, not eight, because January is zero
var today = new Date();
if (endDate>today) {
yourFunction ()
}
else {
alert("Your trial has expired, please contact the developer to purchase the script");
}
function yourFunction() {
function setup_doc(){var idslct=charIDToTypeID("slct"); ......
}
- Jaroslav Bereza
- Posts: 38
- Joined: Tue Dec 27, 2016 7:22 pm
Re: Javascript time limit(trial)
Could you use "Socket" class and comunicate with server? It should be able create TCP/IP connection. So you could send data and return value and verify valid licence.
-
- Posts: 16
- Joined: Thu Oct 27, 2016 9:56 am
Re: Javascript time limit(trial)
I found a problem
If you put your computer's date before expiration
The trial continues to work
Can you overcome this problem?
If you put your computer's date before expiration
The trial continues to work
Can you overcome this problem?
- jaydoubleyou80
- Posts: 21
- Joined: Mon Oct 17, 2016 1:41 pm
- Location: USA
Re: Javascript time limit(trial)
luis miguel wrote:I found a problem
If you put your computer's date before expiration
The trial continues to work
Can you overcome this problem?
Well, probably. But you'd only ever know to do that if you also knew how the script was identifying the date. I'm not sure how you might be able to work around it, but possibly following Jaroslav Bereza's suggestion. I'm pretty sure you'd need to verify off the user's computer to be absolutely sure, but I'm not sure how that's achievable.