Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Shareware protection system for macros
Using these functions, you can easily protect your commercial macros from using beyond the evaluation period.

You and your cutomers must have QM 2.1.5 or later.

Version 1.0.1.
Fixed bug causing the dialog to stop working when encrypted.

Version 1.0.2.
Computer-specific registration codes.
More clear and secure.

Version 1.0.3.
Can be used in exe too.
Uses registry hive HKEY_CURRENT_USER instead of HKEY_LOCAL_MACHINE. Using local machine would fail on Vista or when running as a limited (non admin) user. Please review registry variables in your SM_About and SM_CanRun. You probably have to change the value assigned to sm_registry_key_first_run.

Attached Files
.qml   Shareware macros.qml (Size: 18.48 KB / Downloads: 2,219)
I had a fast look through this and looks nice 8)

Now we need a way to retrive and test codes from a webpage and this system will be dynamic :wink:
Im looking forward to your solution to this approach :lol:
Well thats all for now, 3M
How exactly it should work?
Well uhmmm...
How about it accesses a URL with parameters, then captures some portion from the output?

That way it can send the used code to a preconfigured web address and let the website provide feedback about the validity of the code.

If that works the maintainer of the macro can have a script, javascript/CGI/whatever on a website with active codes he gave out.
And also have a posibility to revoke codes that way easyly and on the fly...

You know what i mean?
Well thats all for now, 3M
What if the user is disconnected from the Internet, or the url is temporarily unavailable? Other problem - delay, especially if the url is unavailable. In some cases, there may be delay of 10 - 30 seconds.

Maybe at first validate the regcode locally, then asynchronously access the url, and, if the regcode is invalid, lock later?
Well thats ofcourse up to the shareware writer....
He could also maybe set it to check once a week...
Besides its only checked at startup of the macro, so a small delay wont be a problem i think...

But incase of time-outs there should be a way to notice the user and let it retry...
Well thats all for now, 3M
Version 1.0.2.
Computer-specific registration codes.
More clear and secure.
Version 1.0.3.
Can be used in exe too.
Compatible with Vista.
How do u find the reg code in the clipboard?
thanks this looks like a great file
Can I change this to hours with 0.1 or whatever or do i need to make a new code for mins
never mind I know you cant use 0.1 I have looked through it and I was wondering if i may get a bit of help making it go by hours instead of days or mins instead of day.
never mind i figured it all out thanks for sharing this code it really is what i needed
How to change the code as below to get the network time not local time?
Function SM_CanRun
Select All      Help
DATE date_first date_now.getclock

Because I change the local time tor first day, the protection will fail and it can use again.

BTW, I want to modify the code to time limited macro, for example, one reg code will only use the macro 30 day(for example, 9/1 ~9/30, not real usage time), and the macro will need new reg code from me after 30 day, did you have any ideas or any macros?
Get time from internet? You can use function IntGetFile to download time from a time server or your website. But it is slow and unreliable, eg user can edit hosts file to disable connection to the webserver.

Instead you can use a counter and date-last-run. Save them in registry. When date-today is not = date-last-run, set date-last-run = date-today and increment counter. When counter is >30, disable your software.

I don't want to develop the shareware protection functions more.
Thanks for your advices. It was useful for me.

Other quesions as below,

1. From the same macro:
Function SM_About
Select All      Help
if(days_left>0) e11.format("UNREGISTERED. %i days left." days_left-1)

I want to show the time consisted of year, month, day, hour, minute...,how to modify the code?

2. I test code as below
Macro Macro3
Select All      Help
DATE DAY1.getclock
wait 5
DATE DAY2.getclock
DATE day_diff=DAY1-DAY2
out day_diff

why the result is
am 12:00:05?

3. from QM help:
Macro Macro3
Select All      Help
DATE d="4/1/2003"
;add 2 days
out d
;subtract 1 hour
out d.sub(st)
;get difference in hours
out d.diff("4.1.2003" st 1)
out "%i/%i/%i %i:%i:%i" st.wMonth st.wDay st.wYear st.wHour st.wMinute st.wSecond

the results:
2003/4/2 下午 11:00:00
Error (RT) in Macro3: 0x80020005, 類型不相符。. ?

and fail in

Macro Macro3
Select All      Help
out d.diff("4.1.2003" st 1)

why?and how to modify?
1. str function timeformat. Or floating toolbar -> Text -> Text with date/time.

2, 3. DATE variables should be used to store date, not date difference. Better use DateTime.
Select All      Help
DateTime DAY1.FromComputerTime
DateTime DAY2=DAY1; DAY2.AddParts(2) ;;+2 days
long day_diff
DateTime.TimeSpanGetPartsTotal(DAY2-DAY1 day_diff)
out day_diff

3. Probably the time string format is unavailable on your PC.
Thanks again, it is useful for me.

Forum Jump:

Users browsing this thread: 1 Guest(s)