Each and every single day since 2007 I visit
GiveawayOfTheDay (external link!) looking after commercial software available for free within a 24 hours window.
Now and then they offer a serial number that's valid for online versions and future versions, in some cases, allowing re-installation when needed.
Since it's wide open info you get right out of their installer, I believe they are aware that the user has the right to at least backup such keys, not infringing the concept at all (otherwise they could simply use another method they have for invisibly registering such software at user's machine).
I always wanted a way to easily tag, backup (I always store the info as a two-liner inside a document) and edit those things.
Now I can.
(Parts of the code by Serendipity. Thanks, man!)
Code: Select all
//New Text File with Path and Custom Date in Rename Mode
"Do Stuff"
// Filename before the (possible) suffix.
$prefix = 'GotDKey_' . RegExReplace("<curfolder>", '_+', '_') . "_<date yyyy-mm-dd>";
// Filename after the (possible) suffix.
$ext = '.txt';
/* Use the user defined suffix pattern.
* Note that the value is taken from the config file,
* which means if it has changed since last saved
* those changes will not be reflected here.
* You could call SaveSettings(); or #193; here to fix that.
*/
$suffix = GetKey('PostfixNum','General');
/* This splits the pattern into three parts
* pre: Anything before the last set of zeros.
* zed: The last set of zeros.
* suf: Anything after the last set of zeros.
*/
$suffix = RegExReplace("$suffix", '^(.*?[^0]?)(0+)([^0]*)$', "$1<crlf>$2<crlf>$3");
$suffix_pre = GetToken("$suffix", 1, "<crlf>");
$suffix_zed = GetToken("$suffix", 2, "<crlf>");
$suffix_suf = GetToken("$suffix", 3, "<crlf>");
$suffix = '';
// Check for collisions and increment suffix pattern.
$min_lead = StrLen("$suffix_zed");
$i = 0;
while (Exists("<curpath>\$prefix$suffix$ext") != 0) {
$i = $i + 1;
$suffix = "$suffix_pre" . StrRepeat('0', $min_lead - StrLen("$i")) . "$i$suffix_suf";
}
// Write clipboard's contents to file.
$textfooter="<crlf><crlf>===============<crlf><crlf>";
$text="$textfooter <clipboard>";
$err = WriteFile("<curpath>\$prefix$suffix$ext", "$text", 'n');
End($err != 1, "Could not write file:<crlf>$prefix$suffix$ext");
Focus('L');
Sel();
$i = 0;
while (GetInfo('CountSelected') == 0 and $i < 1000000000) {
Sel("[$prefix$suffix$ext]",,1);
$i = $i + 1;
}
open "<curitem>"
//open "<curpath>\<curitem>" //ERROR
//sendkeys"{F2}"; wait 100; sendkeys"{F2}"; wait 100; sendkeys"{F2}"; wait 100; //File -> Rename Mode