;Good to have these options set If NOT @LOGONMODE Break OnEndIf Dim $SO $SO = SetOption("Explicit","On")$SO = SetOption("NoVarsInStrings","On")$SO = SetOption("NoMacrosInStrings","On"); dim $counter,$key,$valdim $wr,$add,$wridim $split[],$c,$xdim $sp[],$spl,$;define values $counter=0; This is not the correct key for the Round/Lesson 2 ; I changed it from Round 1 to reflect the nature of these posts better $key='HKEY_CURRENT_USER\Software\Golfing'$val='Round02';Hard coding the value prevents you from altering similar code, you're stuck with ;only being able to update this specific entry vs a more dynamic approach to alter any ;similar binary values as show in some of the other examples. $add='28,00,00,00,ff,ff,ff,ff,02,00,00,00,03,00,00,00,3c,00,00,00,50,\ 00,00,00,fe,ff,ff,ff,b2,03,00,00,02,05,00,00,02,04,00,00'$wri='28000000ffffffff02000000030000003c00000050000000feffffffb20300000205000002040000' $wr=readvalue($key,$val)$split=split($add,',') ;Code layout / indenting could be improved to greatly enhance the readablilty of the code ;for other coders that might have to modify/update your code in the future. for each $c in $split;The use and indentation of SELECT could be improved for readability select case $counter = 2 $c = 'bc' Redim preserve $sp[$counter] $sp[$counter]=$c ;Don't need IF in this Select statement could just do Case InStr then supply another CASE 1 for ;instances where the expected results are not found. ie... what if anything you want to happen ;if your code just does not return what you expect. case 1 if instr($c,'\') $x=substr($c, len($c) - 1, 3) $=trim($x) Redim preserve $sp[$counter] $sp[$counter]=$x else Redim preserve $sp[$counter] $sp[$counter]=$c endifendselect$counter=$counter+1next ;Code naming should remain constant - ie... You use "redim" above and here you have "ReDim" not ;a critical issue but more attention to such details shows a more professional style of coding ReDim $counter$counter=0 for $counter = 0 to ubound($sp)$spl = $spl + $sp[$counter]next /*$wr ' Read value from reg' ?$wri ' should be equal to line above' ?$spl ' this is what we wanna write' ?*/if $wr = $spl 'entry already altered' ? exit @error else $wr=writevalue($key,$val,$spl,'reg_binary') if @error 'error: ' + @ERROR @SERROR + ' ' ? else 'altered key' ? endif endif ;Code was operational as posted, but lacked any real error checking and was limited ;in scope due to hard coding of the binary data instead of dynamically reading it. ;Code structure was not really commented on as to what the code is doing which should be ;a consideration for production coding in a business. ;Very unique method and glad to see you got it going Bjorn. ;Hope to see your code submission for Lesson 3 ;Thanks again for participating, if you have any questions please let us know.
Generated in 0.072 seconds in which 0.026 seconds were spent on a total of 13 queries. Zlib compression enabled.
") !=-1) { tempah=tempah.substring(tempah.indexOf("")+5,tempah.indexOf("")); codes[i].innerHTML="" + dotag(tempah.substring()) + ""; } } //var pres = document.getElementsByTagName("pre"); //for (var i=0, maxi = pres.length; i < maxi; i++) { // var tempah = pres[i].innerHTML; // if (tempah.indexOf("[postprep") !=-1) { // tempah=tempah.substring((tempah.indexOf("]",tempah.indexOf("[postprep"))+1)); // pres[i].innerHTML=dotag(tempah); // } //} function ytag(which_one) { var codes = document.getElementsByClassName("ubbcode-body"); var thisone = codes[which_one].innerHTML; codes[which_one].innerHTML = "" + dotag(thisone.substring(5+thisone.indexOf(""),thisone.indexOf(""))) + ""; var heads = document.getElementsByClassName("ubbcode-header"); heads[which_one].innerHTML = "Code:" + ' '; } function ttag(which_one) { var codes = document.getElementsByClassName("ubbcode-body"); var thisone = ""; if (codes[which_one].innerText != undefined) { thisone += codes[which_one].innerText; } else { thisone += codes[which_one].textContent; } codes[which_one].innerHTML = thisone + ""; var heads = document.getElementsByClassName("ubbcode-header"); heads[which_one].innerHTML = "Code:" + ' '; }
")+5,tempah.indexOf("
" + dotag(tempah.substring()) + "
" + dotag(thisone.substring(5+thisone.indexOf(""),thisone.indexOf(""))) + "
"),thisone.indexOf("
"; if (codes[which_one].innerText != undefined) { thisone += codes[which_one].innerText; } else { thisone += codes[which_one].textContent; } codes[which_one].innerHTML = thisone + "