Page 2 of 2 <12
Topic Options
#168448 - 2006-09-26 10:49 PM Re: KiXtart Learning Series - Round 02
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Correct, thank you Jooel.

WKIX32.EXE is a console-less version of KiXtart.

Top
#168449 - 2006-09-28 12:14 PM Re: KiXtart Learning Series - Round 02
Björn Offline
Korg Regular
*****

Registered: 2005-12-07
Posts: 953
Loc: Stockholm, Sweden.
hrm, ain't got the time to play currently.. will post some crap later on.
Top
#168450 - 2006-09-28 01:10 PM Re: KiXtart Learning Series - Round 02
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
Quote:


....
will post some crap later on
....





LOL Maybe someone can learn some crappy scripting this way
Nah, juts kidding Björn
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#168451 - 2006-09-28 01:37 PM Re: KiXtart Learning Series - Round 02
Björn Offline
Korg Regular
*****

Registered: 2005-12-07
Posts: 953
Loc: Stockholm, Sweden.
Mart, that was exacly my point
feels terrible not having the 'time' to do this. feels even dumber that I didn't understand what to do first at all ^^;

Top
#168452 - 2006-10-04 02:19 PM Re: KiXtart Learning Series - Round 02
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
No pressure Doc, but are we going to have another round?
Top
#168453 - 2006-10-04 06:49 PM Re: KiXtart Learning Series - Round 02
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Yeah, pretty soon. Just a bit busy. This next round though there will be a delay before any posting.

Seems better if there is at least some type of delay before posting.

Top
#168454 - 2006-10-05 11:13 AM Re: KiXtart Learning Series - Round 02
Björn Offline
Korg Regular
*****

Registered: 2005-12-07
Posts: 953
Loc: Stockholm, Sweden.
Agree about the delay - ain't got any time to do this stuff, too much going on at work and private right now..
I've got something working. will post at lunchtime (1,5h away)

ok, lunchtime and 2:nd post since my previous post seems to have failed
Notice : I'm not really happy with this - but cannot give it more time nor fix it better...
added: just noticed that my comments wasn't in this .. you'll have to live with it a few hours (removed those tags after my first post...)
ADDED AGAIN ... Well, after peeking at the other codes, I finally got to the point of REALLY knowing what was to be done... buggr. well, I'll be happy if I recive a 'f' for this

Code:

;enjoy my totally wrong code:
If NOT @LOGONMODE
Break On
EndIf

Dim $SO

$SO = SetOption("Explicit","On")
$SO = SetOption("NoVarsInStrings","On")
$SO = SetOption("NoMacrosInStrings","On")
;
dim $counter,$key,$val
dim $wr,$add,$wri
dim $split[],$c,$x
dim $sp[],$spl,$
;define values
$counter=0
$key='HKEY_CURRENT_USER\Software\Golfing'
$val='Round02'
$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,',')


for each $c in $split
select
case $counter = 2 $c = 'bc' Redim preserve $sp[$counter] $sp[$counter]=$c
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 endif
endselect
$counter=$counter+1
next

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



If you haven't noticed yet - this doesn't do what it was meant to do ...
and since this is the second time I cannot use my webbrowser and screwed up a third post / alterning of this post... gah, this is what I'll post and deliver, since this post I have peeked at others codes, and therefore I disqalify both my spelling and paricipation in this 'round'...
well, rewrote it quickly - or, did my 'own' version of the 'real' thing... this is more or less fresh from the drawingboard - not something I would put in production...
Code:


If NOT @LOGONMODE
Break On
EndIf

Dim $SO
Dim $wro[],$apa,$count,$counter,$wr,$wri,$key,$val,$to,$o,$
$SO = SetOption("Explicit","On")
$SO = SetOption("NoVarsInStrings","On")
$SO = SetOption("NoMacrosInStrings","On")
$key='HKEY_CURRENT_USER\Software\Golfing'
$val='Round02'
$count=0
$counter=0

$wri=readvalue($key,$val)

for $count=0 to 80 step 2
$o=right(ltrim(substr($wri, 1, $count)),2)
if $count=6 $o='bc' endif
Redim preserve $wro[$counter] $wro[$counter]=$o
$counter=$counter+1
next
Redim $counter
$counter=0

for $counter = 0 to ubound($wro)
$to= $to + $wro[$counter]
next

;$to ?
;$wri ?
if $to = $wri 'entry already altered' ? exit @error else $wr=writevalue($key,$val,$to,'reg_binary') if @error 'error: ' + @ERROR @SERROR + ' ' ? else 'altered key' ? endif endif



Edited by Björn (2006-10-09 02:10 PM)

Top
#168455 - 2006-10-09 09:33 AM Re: KiXtart Learning Series - Round 02
Björn Offline
Korg Regular
*****

Registered: 2005-12-07
Posts: 953
Loc: Stockholm, Sweden.
Just understood the task... will post something working today - got some spare time over for education
Top
#168456 - 2006-10-09 12:34 PM Re: KiXtart Learning Series - Round 02
Björn Offline
Korg Regular
*****

Registered: 2005-12-07
Posts: 953
Loc: Stockholm, Sweden.
This is what I finally came up with - no real errorchecking tho =/ And man, I've used things I've never touched before.. and the redim preserve, that took like ages to acctually figure out how to do it.
Code:
If NOT @LOGONMODE
	Break On
EndIf

Dim $SO

$SO = SetOption("Explicit","On")
$SO = SetOption("NoVarsInStrings","On")
$SO = SetOption("NoMacrosInStrings","On")
;
dim $counter,$key,$val
dim $wr,$add,$wri
dim $split[],$c,$x
dim $sp[],$spl,$
;define values
$counter=0
$key='HKEY_CURRENT_USER\Software\Golfing'
$val='Round02'
$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='28000000ffffffff02000000030000003c00000050000000feffffffb203'+
'00000205000002040000'


$wr=readvalue($key,$val)
$split=split($add,',')


for each $c in $split
select 
case $counter = 2 $c = 'bc' Redim preserve $sp[$counter] $sp[$counter]=$c 
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 endif
endselect
$counter=$counter+1
next

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


I just noticed that my fifth edit of this post has gone a-wall, and my final part that acctually did what it more or less was supposed to is gone..
Provided below:
Code:
If NOT @LOGONMODE
	Break On
EndIf

Dim $SO
Dim $wro[],$apa,$count,$counter,$wr,$wri,$key,$val,$to,$o,$
$SO = SetOption("Explicit","On")
$SO = SetOption("NoVarsInStrings","On")
$SO = SetOption("NoMacrosInStrings","On")
$key='HKEY_CURRENT_USER\Software\Golfing'
$val='Round02'
$count=0
$counter=0

$wri=readvalue($key,$val)

 for $count=0 to 80 step 2
  $o=right(ltrim(substr($wri, 1, $count)),2)
  if $count=6 $o='bc' endif
  ReDim preserve $wro[$counter] $wro[$counter]=$o 
  $counter=$counter+1
 next
ReDim $counter
$counter=0

 for $counter = 0 to ubound($wro)
  $to= $to + $wro[$counter]
 next 

 ;$to ?
 ;$wri ?
if $to = $wri 'entry already altered' ? exit @error 
else 
$wr=writevalue($key,$val,$to,'reg_binary') 
if @error 'error: ' + @ERROR @SERROR + ' ' ? 
else 
'altered key' ? endif endif

This still lacks errorchecking - and uses the wrong key-structure.., but should be the code-snippet that you could comment. Interesting that you didn't notice that it didn't do the job correctly

Top
#168457 - 2006-10-09 09:49 PM Re: KiXtart Learning Series - Round 02
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Hi Bjorn,

Okay I'll try to take a look and provide feedback later this evening.

I found that the forum was still set to not allow posting until approved. I've modified that so you can now post okay.

Please remove the long lines in your posts though.

Top
#168458 - 2006-10-10 04:35 AM Re: KiXtart Learning Series - Round 02
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
I've left the long lines to comment on your code better.

In the future though please modify you code to prevent
the long lines.


;Good to have these options set 
If NOT @LOGONMODE
Break On
EndIf

Dim $SO

$SO = SetOption("Explicit","On")
$SO = SetOption("NoVarsInStrings","On")
$SO = SetOption("NoMacrosInStrings","On")
;
dim $counter,$key,$val
dim $wr,$add,$wri
dim $split[],$c,$x
dim $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 endif
endselect
$counter=$counter+1
next

;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.

Top
#168459 - 2006-10-10 08:24 AM Re: KiXtart Learning Series - Round 02
Björn Offline
Korg Regular
*****

Registered: 2005-12-07
Posts: 953
Loc: Stockholm, Sweden.
Thanks for the input Doc, sorry for the long lines, but my postings were screwed up all the time, and all my alterings is totally gone.. just edited it again and if you just changed so I can alter I hope you can verify my second snippet.
_________________________
as long as it works - why fix it?
If it doesn't work - kix-it!

Top
#168460 - 2006-10-13 04:02 PM Re: KiXtart Learning Series - Round 02
Björn Offline
Korg Regular
*****

Registered: 2005-12-07
Posts: 953
Loc: Stockholm, Sweden.
I do have a question, but I will rewrite my second submission / perhaps my first as well edited more in the lines of the rules and the way it should be written. Note, this is only for my own, I need to get a grip on handeling this more correct as you might have noticed. Will also try to participate in lesson #3 and hopefully submit something this weekend.
Top
Page 2 of 2 <12


Moderator:  NTDOC, ShaneEP, Mart, Radimus, Glenn Barnas, Jochen, Allen 
Hop to:
Shout Box

Who's Online
0 registered and 248 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.067 seconds in which 0.026 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org