Making a standalone that will only run a few times ?

    May 28 2017 | 11:32 am
    Is there a way of making a standalone (exe) that will basically stop working after it sbeen opened a few times. Is there a way of the max patch recording how many times its been opened and then rewriting some element that would stop it working again ? I guess like demo software....

    • May 28 2017 | 4:01 pm
      [loadbang] and [counter] could help. Someone knowing Max could overcome any such scheme, of course.
    • May 28 2017 | 4:33 pm
      will the count be saved though for when you close and open the exe again... or will it just go back to zero - it needs to autosave the new count somehow....
    • May 28 2017 | 5:04 pm
      You're right: you'd need to write the number in a file on disk. Security with modern OS will allow you to write only in certain places, but not in the Application package itself: you'd write this number in a file stored in a Preferences folder I guess.
    • May 28 2017 | 6:22 pm
      The pattr object is useful in this regard. You can store the count in it, and it's embedded within the file itself. If you copy and paste this example code into your patch and save it, you will then only be able to open the patch 5 times.
      Of course, a knowledgable person can hold down shift-command to defeat loadbang, or can open the patch as text and edit it, but it will effectively frustrate most non-expert users. To reset it, you'll need to do one of those things, then put 0 in the pattr and save.
    • May 28 2017 | 6:29 pm
      storing the evaluation timeout in a textfile is about as safe as usi8ng a dialog warning the user that his evaluation period is over.
    • May 28 2017 | 8:04 pm
      Have you got any other suggestions Roman ?
    • May 28 2017 | 8:06 pm
      Thanks Christopher - a knowledgable person can get into any software - like you say I guess its just about making things inconvenient. TBH I pity the poor sod that breaks into one of my max patches - I hardly know whats going on in them myself - seeings as they'often eveolved out or previous patches....
    • May 29 2017 | 5:39 pm
      Hmm Christopher this doesnt seem to work for exe or mxf standalones, at least not on windows....
    • May 29 2017 | 5:45 pm
      Yeah, it occurs to me that, since it relies on re-saving the patcher, it probably isn't so suitable for standalone apps. So saving the count in a file (possibly encrypted in some simple way, if you want to go to the trouble), and then reading it back in when the patch is opened is probably the way to go.
    • May 29 2017 | 8:25 pm
      How would I do that ?
    • May 29 2017 | 8:58 pm
      Same idea as in the previous example, except the count is stored in a separate file. Note my oh-so-sophisticated encryption/decryption scheme: simply offsetting the count by the magic number 74. That number is stored in a .jxf file, read in when the patch is loaded, has 74 subtracted to it, has 1 added to it, has 74 added to it, and gets stored in the same file.
    • May 29 2017 | 10:04 pm
      Hi Christopher thanks again - but as an exe it doesnt seem to write to the jxf - just says the same number everytime I open the exe....
    • May 29 2017 | 10:41 pm
      It works for me as a .app file for Macintosh if I don't include the .jxf file as part of the application but just keep it in the same folder as the application. Sorry, I can't test that on a Windows machine.