| Article Index |
|---|
| Copy protecting MaxScripts - Making the license file |
| making the ui |
| license routine |
| Final script |
| All Pages |
Page 3 of 4
On the button, place the follwing code:
--begin code
makedir "c:\locktemp"
f = createFile "c:\locktemp\lock.tmp"
format edt1.text to:f
if edt1.text == "" then MessageBox "Please fill in HwLockID" title:"Error"
else
close f
encryptFile "c:\locktemp\lock.tmp" "c:\locktemp\lock.dat" 5476557 -- the numbers is the encryption keystring..
deleteFile "c:\locktemp\lock.tmp"
shellLaunch "Explorer.exe" "c:\locktemp"
--end code
Breakdown:
- makedir "c:\locktemp" -- Creates a directory at c:\locktemp
- f = createFile "c:\locktemp\lock.tmp" -- creates a file named "lock.tmp" in the directory
- format edt1.text to:f -- formats and inputs the text from the textbox into the file
- if edt1.text == "" then MessageBox "Please fill in HwLockID" title:"Error" -- if textbox is empty, then give error
- else -- if user has entered text into the textbox the do->
- close f -- closes and releases the file (lock.tmp)
- encryptFile "c:\locktemp\lock.tmp" "c:\locktemp\lock.dat" 5476557 -- encrypts the file "lock.tmp" to "lock.dat" with the key: "5476557"
- deleteFile "c:\locktemp\lock.tmp" -- deletes the lock.tmp file
- shellLaunch "Explorer.exe" "c:\locktemp" --opens the folder in explorer.
Try the following code, start it, enter some numbers, and see if it creates the lock.dat and places it in the directory.
open the file in notepad, and it'll show a bunch of garbage data (because of encryption).
Next article will make an easy script that uses this license file to unlock itself.





