|
|
|||||||
Only as a test (and don't call the long line police !) for those interested in it : It highlights by now only Comments and Strings Very messy [ 10. December 2002, 16:00: Message edited by: jpols ] |
||||||||
|
|
|||||||
Joeel ! I think I need some advice |
||||||||
|
|
|||||||
on what? |
||||||||
|
|
|||||||
If I Save the output as html file and open in ie it shows quite ok ... but look at the mess above First thing is the space between lines, It shouldn't be that big ... Then Somewhere after 'case $char = '>' the font changes to strikethrough |
||||||||
|
|
|||||||
well, you have syntax error in your code: code:also, I would not suggest you to write all whitespaces with NBSP. it makes the load a lot longer.<s pan style='color:#2E8B57'>'>'</span> you should do something like: code:$line=join(split($line," ")," ") |
||||||||
|
|
|||||||
Ok, but whhat about tabs ? |
||||||||
|
|
|||||||
what about tabs? |
||||||||
|
|
|||||||
ehhmmm , $line=join(split($line," ")," ") in conversion would also fill whitespaces with nbsp's , no ? Same in Green ? plus I would need to have another one for tabs in it |
||||||||
|
|
|||||||
jochen???? |
||||||||
|
|
|||||||
[ 10. December 2002, 16:18: Message edited by: jpols ] |
||||||||
|
|
|||||||
no. if you want colors, you can't use pre. this means, you need to code all whitespaces longer than 1 with " "+nbsp so, when you do that join-split on line and it has, say 6 whitespaces in the start, it would have then " "+nbsp+" "+nbsp+" "+nbsp for tabs, it depends, but hardcoding by your desicion, say 4-6 spaces is good. |
||||||||
|
|
|||||||
hahaa roflol!!! you have the PAN in there and I've never heard about such tag. |
||||||||
|
|
|||||||
I haven't got any pre's ??? My Orientation was Rogiers PostPrep 1.10 (well it converts much more characters than mine by now but it also uses those nbsps) What is really weird to me is the fact it shows correctly if saved to a html file but fubarred if pasted to topic reply [ 10. December 2002, 16:22: Message edited by: jpols ] |
||||||||
|
|
|||||||
you have a problem of converting... well, let's say you haven't use to it can I ask much as let me see your current code? maybe pm'ed if it's huge. |
||||||||
|
|
|||||||
No I haven't !! If I look after the line in my TextBox it says span not s pan ... That really pisses me off |
||||||||
|
|
|||||||
I will ... hmm, will email you because there is a ini file needed that is realy a long liner But first I will go home now ... (Hmm ... maybe killing some innocent on my way ) |
||||||||
|
|
|||||||
setascii("on") $a = 1 cls while $a < 5 ;Change this value to get more or less numbers $y = 1 while $y <= 80 $z = 1 while $z <= 20 at($z,$y) "$x " + chr($x) $z = $z + 1 $x = $x + 1 loop $y = $y + 10 loop ? shell "%comspec% /c pause" $a = $a + 1 loop exit [ 11. December 2002, 15:00: Message edited by: jpols ] |
||||||||
|
|
|||||||
looks quite ok, but still the gaps between lines are too large ... any ideas on how to control that ? (by the way If I try to edit the above post and try to add the text 'looks .. ' it says 'Sorry, we do not permit parenthesis in html tags' ) |
||||||||
|
|
|||||||
You've got two breaks between each line. You have "<BR>" followed by "<BR />". This will cause a blank line to be displayed. Remove one of the breaks to fix it. BTW does anyone know what "<BR />" is? It is not a standard HTML tag as far asd I know. I've seen it used as a kludge to force IE to render output immediately but I cannot find any references to it. |
||||||||
|
|
|||||||
Richard, that 'br /' tag thing didn't came from my conversion .. it was somehow added when posted MAYBE, because I have not all characters converted to html such as ( and ) ? [ 11. December 2002, 10:24: Message edited by: jpols ] |
||||||||
|
|
|||||||
Here is the same thing converted by Rogiers PostPrep : setascii("on") $a = 1 cls while $a < 5 ;Change this value to get more or less numbers $y = 1 while $y <= 80 $z = 1 while $z <= 20 at($z,$y) "$x " + chr($x) $z = $z + 1 $x = $x + 1 loop $y = $y + 10 loop ? shell "%comspec% /c pause" $a = $a + 1 loop exit will try to ammend mine as needed |
||||||||
|
|
|||||||
Errrrggg ... got rid of the 'br' tag completely ! Much better now Thanx Richard for pointing me to this [ 11. December 2002, 10:37: Message edited by: jpols ] |
||||||||
|
|
|||||||
Are you passing carriage returns and/or line feeds in the posted data? If so, try removing them. The submit process may be converting them to breaks, and if you include a break yourself you may end up with two per line. |
||||||||
|
|
|||||||
Yeah , thats why it did this Lookie above (Post #17) hmmm ... ok, no breaks at all if saved as html in my proggie now ... have to revamp [ 11. December 2002, 12:21: Message edited by: jpols ] |
||||||||
|
|
|||||||
Ok, got the save as html business doen with split/join There is a question left though : How can prevent breaking of long lines ? Maybe an addition to first span style tag ? But which ? Richard ? Joeel ? Anyone ? |
||||||||
|
|
|||||||
wait a sec. also you should still skip those spans |
||||||||
|
|
|||||||
I have ot rid of 'em too ... working also (ok the whitespaces are a bit puzzled by that , but sure they will get back in line with some research) Thanx! |
||||||||
|
|
|||||||
so what is the part that does work in spacing? I thought you didn't want no-wrap but you neither want wrap cold you help me on this? |
||||||||
|
|
|||||||
You should be able to simply wrap the whole thing in <NOBR> </NOBR> elements. NOBR==No Break. R. |
||||||||
|
|
|||||||
Haha , forget the spacing ... I took your advice and replaced only every second WhiteSpace by nbsp ! That works just fine , plus all 'span style' tags for color are replaced by 'font color' My final Issue now is to prevent it from wrapping long lines, as this reduces the readability J. |
||||||||
|
|
|||||||
sorry. if it does not wrap, it will also reduce readability. |
||||||||
|
|
|||||||
disagreed ... if one code in his favorite editor one would also disable Word-Wrap , no ? |
||||||||
|
|
|||||||
ok, I'll give you an example. this is the code for, you know without word-wrap say how readable your posts are after this:
same but little smaller:
{edit} forgot the font tags... [ 11. December 2002, 14:44: Message edited by: Lonkero ] |
||||||||
|
|
|||||||
Yeah, but that relies on the author of the code ! If one prefers to write one-liners or doesn't indent his code I can't help I will try it with 'nobr' tags , thanx ! |
||||||||
|
|
|||||||
what about option for wrap? or font resizer. check my above post again, added the same below the first with little smaller font. |
||||||||
|
|
|||||||
Yeah ! That will be definetly in the final Beta release .. But for now as Shawn said this morning 'concentrate on the important, add bells and whistles later' |
||||||||
|
|
|||||||
Here is a last update before I leave for my X-mas Vacation (below a sample code of BoxKite, converted in 1 second (too slow !) without recognising Operators yet, but it's going the right direction) setascii("on") $a = 1 cls while $a < 5 ;Change this value to get more or less numbers $y = 1 while $y <= 80 $z = 1 while $z <= 20 at($z,$y) "$x " + chr($x) $z = $z + 1 $x = $x + 1 loop $y = $y + 10 loop ? shell "%comspec% /c pause" $a = $a + 1 loop exit See you next year ! |
||||||||
|
|
|||||||
Whoa, whoa Captain ... 1) Wheres the code ? 2) Where you going ? Sailing the boat to Siberia or something ? You not going to be around the board ? -Shawn |
||||||||
|
|
|||||||
j, yes, where is updated code? especially the parser/translator part... me want to see. |
||||||||
|
|
|||||||
Well well well my friends, You want to see the Code ? It's (still) Alpha code which I am not very proud of ! The story of the last days : Shawn gave me the tip not to take the Output Textbox as buffer but a string variable ... That cut down the conversion time for the 600 lines (only strings and comments highlighted) from somewhat over 5 minutes down to 35 seconds (You never know how darn slow that COM business can be) Then while pushing the code forward to convert also Commands, Functions, Macros (Operators left to do, plus double occurances of Keyword per line not handled) I decided to take an Array of strings as buffer, which increases performance once again (converted 650 lines in 12 seconds) Now the actual code has got this ability but (by implementing commands, macros, functions) it slowed down to convert itself (821 lines) in 1 minute 20 seconds I am not happy with it (especially that it needs 128 kb when saved as html file !) Will spend some time at my In-Laws untill after 26th. Hopefully I have some time afterwards for rebuilding the Conversion algorithm(or should I say 'routine' ) If you want the code, just send me an email, I'll see If I find the reply button J. [ 18. December 2002, 20:49: Message edited by: jpols ] |
||||||||
|
|
|||||||
j, I'm not sure how much this will save time on your tests but on my code, which still is 76k in size, it saved 20seconds of processor time. so, this change does not speed up the conversion, just the load. I did some speeding thingies for conversion too but their benefit was not so huge. anyway, openclick with this code did wonders. readfile() is directly from udf-library. code:sorry for exposing part of the code but this seemed to be best way to get the message to youfunction btnOpen_Click() |
||||||||
|
|
|||||||
Mind if I chime in here? I am getting the following errors: Converting code: quote:Selecting the color chart: quote:An idea for this on a later implementation - Have a "recently used" file list for people to go back and grab recent files. Thanks, Kent |
||||||||
|
|
|||||||
Kent, Sure thing that it failed ! This was one of the reasons I didn't make it public yet : It uses intrinsic 4.20 Alpha ascan() ... The development is somehow stopped until after 26th of december as I am about to leave to visit my Mother-in-law with the family ... Please expect the following modifications in the first Beta release of UBB PostPrep : -> Optional colorizing for defined Keyword families (Just like Shawn did only specified a 'color' for Commands and Functions, but the others were in fact colored 'black' -> this will be skipped as selected in next release) -> Option page for Output, like 'Horizontal Line?' , Font , Fontsize etc ... Now for the last Time : Have a nice Christmas my friends ! Be careful when driving (especially you Jooel ), hope to see you all back then Jochen |
||||||||
|
|
|||||||
Jooel, I will definitely have a look on the open thing (after Christmas of course ... I don't think that it'd be a good Idea too take my Notebook with me ) |
||||||||
|
|
|||||||
j, you still living in the kixmas? it's over, if you didn't know |
||||||||
|
|
|||||||
Guess that'd depend on whether one follows the Gregorian or Julian calendar... |
||||||||
|
|
|||||||
Nah, The Julian is out of date ... we all live (except maybe in regions I don't know) after the Gregorian one Yeah, KiXmas is over (Thank God for that) But now it's Sylvester time ... be back in 2003 J. btw.: I didn't even manage to have a look on it |
||||||||
|
|
|||||||
Jooel, In reply to your readfile snippet above: In the mean time I had the same speed increases by just preventing to use the TextBox as Read buffer (yeah , same old story with slow COM ) J. |
||||||||
|
|
|||||||
ok, I could not make any sense of your code so, I did my own. hope you will be some day awake at the same time so could check these. surely, as you colorize all those control chars too, the size of file increases... anyway, here is something. currently only colors vars, comments and text. {edit} surely board screwed everything up... [ 19. January 2003, 07:50: Message edited by: Lonkero ] |
||||||||
|
|
|||||||
ok, other style abandoned too... this board seems to dislike me... |
||||||||
|
|
|||||||
ok, newist shit. time is increasing what more I add there. still lacks coloring on functions and commands... I decided also to skip colorizing the operands as that would double the size once again. {edit} j, what was the issue with this line spacing ???? {/edit} can't post that code which ran for 4s as it's not public. anyway, this 5,9k file took les than second: {edit 2} removed the code to fasten up the load of the page. [ 20. January 2003, 04:17: Message edited by: Lonkero ] |
||||||||
|
|
|||||||
k, it seems pretty much ok... that bloody line-spacing gets me also better colors could do |
||||||||
|
|
|||||||
k, jochen... ran my udf against postprep: quote:it is not inbuild currently, just made it work as standalone udf. {edit} removed the code to fasten up the load of the page. [ 20. January 2003, 03:54: Message edited by: Lonkero ] |
||||||||
|
|
|||||||
bad colors I have used... and seems that there might still be a bug or 2... |
||||||||
|
|
|||||||
WORKING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! man I'm happy. wasted the weekend on this but it was worth it... I quess... it does not understand UDFs yet, so it marks them as unkown (bold operator color) also, it was a horror to work with ascan and think it has to be fixed to work same way as normal kix functions. the "stats": quote:{edit} due to a request by shawn and les, enabled word-wrap {/edit} and the code: ; ; BBCodeParser - KiXtart Bulleting Board Code Parser ; ; Dependencies: ; Wkix32 - KiXtart 4.12 ; kixforms.dll - KiXForms (version 2.1.1) ; ; -Lonkero ; ; 3.1.1.4 main improvements: ; removed the winhttp from dependencies ; improved parsing ; removed the status display ; $VERSION = "3.1.1.7" $CRLF = @crlf $form = createobject("kixtart.form") $form.caption = "BBCodeParser" $form.width = $form.screen.width-100 $form.height = 530 $form.center $form.font.name = "arial" $form.font.size = 20 $form.forecolor = $form.rgb(200,200,200) $form.printxy(8,6,"BBCodeParser") $form.forecolor = $form.rgb(51,153,255) $form.printxy(6,4,"BBCodeParser") $form.font.size = 10 $form.font.bold = 1 $form.printxy(185,6,"$VERSION") $form.font.name = "arial" $form.font.size = 10 $form.forecolor = 0 $form.font.bold = 0 $form.printxy(8,48,"Topic:") $address = $form.textbox $address.top = 45 $address.left = 55 $address.width = $form.width-250 $address.height = 20 $address.text = "" $download = $form.commandbutton $download.caption = "Download!" $download.top = 42 $download.left = $form.width-175 $download.width = 75 $download.height = 25 $download.onclick = '$$=download() $$edit.text="Choose the script from left panel." $$save.enabled=1 $$print.enabled=1' $download.fontbold = 0 $download.default = 1 $edit = $form.textbox $edit.multiline = 1 $edit.scrollbars=3 $edit.wordwrap=0 $edit.top = 85 $edit.left = 215 $edit.width = $form.width - 220 $edit.height = 365 $edit.text = "Enter the URL of the page you want to retrieve code from to topic field and click download@crlfhint: easiest way is to cut'n paste it from your webbrowser!" $index = $form.listbox $index.top = 85 $index.left = 5 $index.width = 200 $index.height = $form.height - 120 $index.onclick = '$$edit.text = $$code[$$index.listindex]' $save = $form.commandbutton $save.top = 465 $save.left = 215 $save.width = 75 $save.height = 25 $save.caption = "Save" $save.onclick = "$$=save($$form.filesavedialog)" $save.enabled = 0 $print = $form.commandbutton $print.top = 465 $print.left = 310 $print.width = 75 $print.height = 25 $print.caption = "Print" $print.onclick = "$$=print()" $print.enabled = 0 $about = $form.commandbutton $about.top = 465 $about.left = $form.width-270 $about.width = 75 $about.height = 25 $about.caption = "About" $about.onclick = "$$=TkAboutBox($$VERSION)" $exit = $form.commandbutton $exit.top = 465 $exit.left = $form.width-175 $exit.width = 75 $exit.height = 25 $exit.caption = "Exit" $exit.onclick = "$$form.visible=0" $exit.cancel = 1 $form.show while $form.visible $=execute($form.doevents) loop exit 1 function download() dim $data,$,$c,$httpObj if not instr($address.text,"kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic") $ = messagebox("You didn't give kixBB url-address. This script supports only BB found at kixtart.org!","Usage error",48) return else $page="http://kixtart.org/cgi-bin/ultimatebb.cgi?ubb=print_topic"+substr($address.text,instr($address.text,"?ubb=")+14) endif $httpObj = createobject("microsoft.xmlhttp") $httpObj.open("GET",$page,not 1) $httpObj.send() $data=$httpObj.Responsetext $data=split($data,'<hr />Posted by <b>') for $=0 to ubound($data) $data[$]=split($data[$],'>code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">') if ubound($data[$]) $data[$][0]=left($data[$][0],instr($data[$][0],"</b>")-1) for $c=1 to ubound($data[$]) $index.additem($data[$][0]+" (post #"+$+")") $data[$][$c]=left($data[$][$c],instr($data[$][$c],"</pre><hr />")-1) if instr($data[$][$c],"<") $data[$][$c]=join(split($data[$][$c],"<"),"<") endif if instr($data[$][$c],">") $data[$][$c]=join(split($data[$][$c],">"),">") endif if instr($data[$][$c],""") $data[$][$c]=join(split($data[$][$c],"""),chr(32)) endif if instr($data[$][$c],"<br />") $data[$][$c]=join(split($data[$][$c],"<br />"),@crlf) endif $code=$code+$data[$][$c]+chr(7) next endif next $code=split($code,chr(7)) endfunction Function TkAboutBox($Version) $former = createobject("kixtart.form") $former.scalewidth = 500 $former.scaleheight = 180 $former.center $former.caption = "About "+$name $former.fontname = "times new roman" $former.fontsize = 14 $former.fontbold = 1 $former.printxy(10,20,"BBCodeParser") $former.fontsize = 8 $former.fontbold = 0 $former.printxy(10,40,"version "+$Version) $former.fontsize = 12 $former.fontbold = 1 $former.printxy(10,60,"created and authored since 2001 By Lonkero") $former.fontsize = 10 $former.fontbold = 0 $former.printxy(20,100,"Special thanks of bringing us kixforms and of great help to Shawn.") $former.printxy(40,120,"Thanks to also Ruud who has given us kiXtart!") $oker = $former.commandbutton $oker.onclick = "$$former.visible=0" $oker.center $oker.top = 150 $oker.left = 400 $oker.width = 75 $oker.height = 25 $oker.caption = "OK" $former.visible=1 while $former.doevents = 1 loop $former=0 EndFunction function save($file) dim $ if len($file) del $file $=open(1,$file,5) $=writeline(1,"; "+$index.text+" from topic "+$address.text+@crlf+@crlf) $=writeline(1,$edit.text) $=writeline(1,"@crlf@crlf; brought to you by BBCodeParser "+$VERSION+@crlf) $=close(1) $= $$form.msgbox("Code saved In:@crlf"+$file,"note",64) endif endfunction function print() dim $formi,$ $formi = createobject("kixtart.form") $formi.caption = "BBCodeParser"+$VERSION+" by Lonkero" $formi.width = 450 $formi.height = 100 $formi.center $formi.fontbold = 1 $formi.printxy(10,10,"Printing in Progress...") $formi.visible = 1 sleep 1 $=open(1,"%temp%\BBCodeParser "+$VERSION,5) $=writeline(1,"code:"+$index.text+" from topic "+$address.text+@crlf+@crlf) $=writeline(1,$line) $=close(1) shell "notepad /p %temp%\BBCodeParser "+$VERSION sleep 1 del "%temp%\BBCodeParser "+$VERSION endfunction [ 20. January 2003, 05:29: Message edited by: Lonkero ] |
||||||||
|
|
|||||||
wow - all that took less than a second to colorize ? |
||||||||
|
|
|||||||
Okay.. I have a question! How do you use it? Every page I post into the address bar comes back with an error that it only supports the KiXart BBS. Here is an example of the URL I posted into it. http://www.kixtart.org/board/ultimatebb.php?ubb=forum;f=2 Have tried UDFs, other KORG links and they all give the same error. So... what am I doing wrong? |
||||||||
|
|
|||||||
you mean the bbcodeparser? not sure it even has a working code just found one script that was long enough for testing and used it please see topic. what comes to codeparser, it is seriously in need of re-writing. wrote a new version some months ago but no one knows does it even work with current board software... |
||||||||
|
|
|||||||
Lonk , where have you been the whole Saturday ? Anyway, seems to happen that it was a good choice to send the stuff to ya Why did you colorize $vars ?? That is something I won't do (ok, I am a bit hooked to the colorize in my uedit ) What did you change anyway ? Send the crap back please ! J. |
||||||||
|
|
|||||||
I just somehow passed out... weird effect with that vodka. your code actually was so hard for me to understand that re-wrote the kix2html-converter totally. will send it you at once as these network problems stop and I get a change. |
||||||||
|
|
|||||||
ummmm .... so that what I understand is : You took the form(Controls, color chooser, textboxes etc.), left out the converter udf and wrote a new one ? I'd like to see that in advance of any publication well , If those network problems related to my provider, simply use : jochenpolster@hotmail.com or if this fails ibm.polster@smart.com [ 20. January 2003, 08:25: Message edited by: jpols ] |
||||||||
|
|
|||||||
sure, but I can't reach e-mail! |
||||||||
|
|
|||||||
It's looking pretty good! I noticed you've not colourised variables and macros which are in strings (there is a @crlf embedded in one of the strings in your example). It's probably quite hard to add to the parser, but it is useful to highlight what is a fairly common error. |
||||||||
|
|
|||||||
Yeah ... really nice , eh ? But it isn't added into the form yet ! Lonkero ... you somehow failed to send it ... My hotmail inbox is empty after the meeting (Thought you said you'll send it as it is ) J. |
||||||||
|
|
|||||||
Ok, here is again the old BoxKite sample of showing ASCII code (gets a standard for postprep checking more and more ) setascii("on") $a = 1 cls while $a < 5 ;Change this value to get more or less numbers $y = 1 while $y <= 80 $z = 1 while $z <= 20 at($z,$y) "$x " + chr($x) $z = $z + 1 $x = $x + 1 loop $y = $y + 10 loop ? shell "%comspec% /c pause" $a = $a + 1 loop exit What does this look like ? |
||||||||
|
|
|||||||
j, are you asking for opinions about the colors ? If yes - imho i really like the colors except for the comments - the green is too light. |
||||||||
|
|
|||||||
Green : setascii("on") $a = 1 cls while $a < 5 ;Change this value to get more or less numbers $y = 1 while $y <= 80 $z = 1 while $z <= 20 at($z,$y) "$x " + chr($x) $z = $z + 1 $x = $x + 1 loop $y = $y + 10 loop ? shell "%comspec% /c pause" $a = $a + 1 loop exit Is this better ? Or is the function color again too quirky ? |
||||||||
|
|
|||||||
better... the brown might have been better though for the vars |
||||||||
|
|
|||||||
ah damnit ! still can't understand what speaks against green coloured comments Still have them exactly with this color in Uedit (Ok, a bit darker maybe and the background is set to a light grey) J. Will be online later on for discussion and or verbal attacks |
||||||||
|
|
|||||||
TEST TEST... 060 milliseconds to complete Commands 16 Functions 7 Macros 2 break on ; this is a comment test for color GREEN ? "System Memory = "val(WMIQuery("TotalPhysicalMemory","Win32_LogicalMemoryConfiguration"))/1024 " MB" for each $dimm in Split(WMIQuery("Capacity","Win32_PhysicalMemory"),"|") ? "Dimm Size = "val($dimm) / 1048576 " MB" next FUNCTION WMIQuery($what,$where,) dim $strQuery, $objEnumerator, $value $strQuery = "Select $what From $where" $SystemSet = GetObject("winmgmts:{impersonationLevel=impersonate}!//@WKSTA") $objEnumerator = $SystemSet.ExecQuery($strQuery) For Each $objInstance in $objEnumerator If @Error = 0 and $objInstance <> "" $=execute("$$value = $$objInstance.$what") $WMIQuery="$value"+"|"+"$WMIQuery" EndIf Next $WMIQuery=left($WMIQuery,len($WMIQuery)-1) exit @error ENDFUNCTION TEST 2 TEST 2 ; arrayenumkey.kix break on $subkey='HKEY_LOCAL_MACHINE\SOFTWARE' $array=arrayenumkey($subkey) ? 'Number of software Packages:'+ubound($array) for $counter=0 to ubound($array) ? 'Software Package '+right(' '+$counter,2)+' = '+$array[$counter] next exit 0 function arrayenumkey($regsubkey) dim $retcode, $subkeycounter, $currentsubkey, $subkeyarray if not keyexist($regsubkey) $arrayenumkey='' return endif $subkeycounter=0 do $currentsubkey=enumkey($regsubkey,$subkeycounter) if $currentsubkey<>259 and @ERROR=0 redim preserve $subkeyarray[$subkeycounter] $subkeyarray[$subkeycounter]=$currentsubkey $subkeycounter=$subkeycounter+1 endif until $currentsubkey=259 or @ERROR $arrayenumkey=$subkeyarray endfunction [ 22. January 2003, 10:20: Message edited by: NTDOC ] |
||||||||
|
|
|||||||
To all those who are tired of copying code to Wordpad to preserve spacing : Try to copy Rons second code sample (the one with indentation) directly to any Editor |
||||||||
|
|
|||||||
Okay.. BIGGER Test TEST TEST #3 49K File size Convert time: 03 Seconds 996 milliseconds Commands: 281 Functions: 161 Macros: 16 ; Original date script downloaded: 05/10/2001 ; Registry Security Script (Kix32) ; Allows an administrator to set 46 security-related Registry edits for NT defined in 3 ; increasingly-secure (and modifiable) levels. Includes the ability to prompt the user for ; each edit or wholly automate the entire process. Also includes debug functions ; ; ; ************************************************************************************ ; ; REGSEC.KIX ; Registry Security Script ; rpuckett@snl.com ; Version 1.0.3 ; February 3, 2000 ; ; ************************************************************************************ ; ; This script is designed to provide Administrators with a mechanism for importing ; (currently) 46 individual Security-related Registry edits to systems on a network. ; The script employs 3 levels of security (DEFCON 1-3) that define a tailorable ; set of edits based on the level. I have segmented the edits as I would use them, ; but they can be moved into different DEFCON settings (and these can be expanded) ; to suit your needs by changing the $LEVEL value for each defined edit. You may ; also wish to provide a prompt to the User, providing them with a messagebox that ; defines the edit type which they can then accept or decline. This is set using the ; $QUERYUSR variable. If set to "1", a messagebox is displayed for each edit. This ; can also be expanded upon as the value can be placed in (and reset for) specific ; edits, while others can remain automated (with a setting of "0"). All of these ; variables can also be mixed and matched based on the use of the INGROUP function, ; allowing you to tailor the installation method(s) even further. ; ; Ex. IF INGROUP ("SYSTEMS") = 1 ; $QUERYUSR = "1" ; $DEFCON = 2 ; blah, blah, blah... ; ENDIF ; ; Finally, you can simply output the types of edits associated with each DEFCON level ; by setting the $DEGBUG variable to "1" ("0" actually runs the edits for each level). ; ; As this script employs looping through each edit, it is easily updated as new ; security edits become available. Simply add a new label (:SECREGxx - with the 'xx' ; representing the next available number after 46) and replace the $NEXT variable of ; the preceding label with the name of the new label. Finally, be sure to add a ; $NEXT variable to the last new :SECREGxx label with a value of "END". Make sure to ; set the $LEVEL value of each edit to identify it's DEFCON level. ; ; NOTE: The $SPECIAL variable, when set to "1", defines an additional action for the ; edit it is assigned to in the GOSUB 'ADDFUNT'. This can be used to run functions ; or options to preclude an edit. If you employ the $SPECIAL value in future edits, ; be sure to add the additional functions to the ADDFUNCT GOSUB routine by referencing ; the $REGVALUE as an added CASE value. All files referenced in special functions are ; copied from the $GETFILES value (currently @LSERVER\NETLOGON), but this can be ; changed to whatever location you desire. ; ; WARNING (and DISCLAIMER): ; Nothing replaces common sense, especially when it comes to the Registry and ; Security. The documentation added to each edit (along with the associated MSKB ; Article/Whitepaper Information) should help you to understand the basic function of ; the edit as well as to provide you with another location for more information. ; Avoid potentially serious consequences by reading everything available on a ; particular edit if it is unfamiliar to you. Do not use edits that are untested ; in your environment as they may have unforseeable (and undesireable) outcomes. ; ; ************************************************************************************ ; SCRIPT VARIABLES ; OPTIONAL SETTINGS - 0 or 1 ; 0 - Automatic Addition of Values ; 1 - Display Messagebox Query for each Setting $QUERYUSR = "1" ; OPTIONAL SETTINGS - 0 or 1 ; 0 - Run DEFCON Level Defined Registry Changes ; 1 - Display DEFCON Level Registry Information Only (No Changes Made) $DEBUG = "1" ; OPTIONAL SETTINGS - 1, 2, 3 ; 1 - DEFCON 1 / Basic Security (Good for most environments) ; 2 - DEFCON 2 / Enhanced Security (Disables connectivity to LM/9x Clients) ; 3 - DEFCON 3 / Advanced Security (Near C2 Settings) $DEFCON = "3" ; LOG LOCATION & NAME (Root of C:\ *not* recommended) $LOGNAME = "C:\@WKSTA.TXT" ; SERVER TO BE NOTIFIED OF ERRORS $NOTIFYSVR = "NOTIFY_SERVER_HERE" ; SPECIAL VARIABLE SETTING FOR REGISTRY CHANGES ; REQUIRING ADDITIONAL OPERATIONS $SPECIAL = "0" ; LOCATION FROM WHICH $SPECIAL FUNCTION FILES ARE COPIED (like PASSFILT.DLL, etc.) $GETFILES = "@LSERVER\NETLOGON" ; OPERATING SYSTEM TYPES ; IF THE SYSTEM IS NOT NT WORKSTATION 4.0, THEN EXIT THE SCRIPT... SELECT ; WINDOWS 95 CASE((@INWIN = 2) AND (@DOS = 4.0)) EXIT ; WINDOWS 98 CASE((@INWIN = 2) AND (@DOS >= 4.10)) EXIT ; WINDOWS 2000 CASE((@INWIN = 1) AND (@DOS = 5.0)) EXIT ; WINDOWS NT 4.0 CASE((@INWIN = 1) AND (@DOS = 4.0)) ; CHECK THE NT INSTALLATION TYPE... $NTREG = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ProductOptions" $NTTYPE = READVALUE($NTREG, "ProductType") IF @ERROR = 0 SELECT CASE $NTTYPE = "WinNT" $OS = "Windows NT Workstation 4.0" GOTO START CASE $NTTYPE = "ServerNT" $OS = "Windows NT Server 4.0 (Stand-Alone)" GOTO START CASE $NTTYPE = "LanmanNT" $OS = "Windows NT Server 4.0 (Domain Controller)" GOTO START CASE 1 $ERRCODE = SENDMESSAGE($NOTIFYSVR, "An unknown wersion of Windows NT [" + $NTTYPE + "] was detected on @WKSTA at @TIME on @DATE") EXIT ENDSELECT ENDIF IF @ERROR <> 0 $ERRCODE = SENDMESSAGE($NOTIFYSVR, "Unable to read the 'ProductType' value from the Registry on @WKSTA at @TIME on @DATE") EXIT ENDIF CASE 1 $ERRCODE = SENDMESSAGE($NOTIFYSVR, "Unable to determine the OS type installed on @WKSTA at @TIME on @DATE") EXIT ENDSELECT :START ; **OPTIONAL FUNCTION - PRIVILEGE CHECKING ; REMOVE IF UNNEEDED IN YOUR ENVIRONMENT ;$ACCESS = @PRIV ;SELECT ; CASE $ACCESS = "GUEST" ; ? "GUEST" ; ? "You must possess Administrative privileges to perform these security updates" ; SLEEP 4 ; EXIT ; CASE $ACCESS = "USER" ; ? "USER" ; ? "You must possess Administrative privileges to perform these security updates" ; SLEEP 4 ; EXIT ; CASE $ACCESS = "ADMIN" ; ? "ADMIN" ; ? "The required Administrative privileges are held, continuing..." ; ? " " ; CASE 1 ; ? "OTHER" ; ? "You must possess Administrative privileges to perform these security updates" ; SLEEP 4 ; EXIT ;ENDSELECT ; CHECK THE INSTALLED SERVICE PACK VERSION... $SPREG = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" $SPVER = READVALUE($SPREG, "CSDVersion") IF @ERROR = 0 ? "This system is running - " + $OS ? "Service Pack Version - " + $SPVER ENDIF IF @ERROR <> 0 $ERRCODE = SENDMESSAGE($NOTIFYSVR, "Unable to read the 'CSDVersion' value from the Registry on @WKSTA at @TIME on @DATE") ENDIF ; DISPLAY SELECTED DEFCON LEVEL ? "DEFCON Level " + $DEFCON + " Selected" ; SETUP SECURITY LOG IF OPEN(1, $LOGNAME, 5) = 0 $X = WRITELINE (1, Chr(13) + Chr(10) + "Security Log for @WKSTA" + Chr(13) + Chr(10) + "Time - @TIME / Date - @DATE" + Chr(13) + Chr(10) + "System is running - " + $OS + Chr(13) + Chr(10) + "Service Pack Version - " + $SPVER+ Chr(13) + Chr(10) + "Selected Security Level is DEFCON - " + $DEFCON + Chr(13) + Chr(10) + Chr(13) + Chr(10)) ELSE $ERRCODE = SENDMESSAGE($NOTIFYSVR, "Unable to write to the Security Log on @WKSTA at @TIME on @DATE") ENDIF IF CLOSE(1) = 0 ENDIF ; DEBUG MODE - Display DEBUG Header IF $DEBUG = "1" ? "In Debug Mode, No changes will be made..." ? "DEFCON LEVEL " + $DEFCON + " REGISTRY CHANGES:" ? " " ENDIF GOTO SECREG1 ; SECURITY REGISTRY EDITS ; These values are recursed through by passing into the CHECKSEC ; function the values of each desired change and using the $NEXT ; variable to send the function to the next desired change. ; NOTE: Registry edits that possess the $SPECIAL variable utilize ; the ADDFUNC GOSUB routine to perform additional required ; operations. :SECREG1 $DSCRIPTN = "Enable Auditing of Base Objects" ; Enable auditing of objects not in the File System or Registry. ; Useful in debugging or high-level security environments. The ; Audit Policy option "File and Object Access" must be enabled. ; WARNING - leads to high volume of event records recorded in the ; event log. $LEVEL = "3" $REGKEY = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" $REGVALUE = "AuditBaseObjects" $REGTYPE = "REG_DWORD" $GOOD = "1" $BAD = "0" $SPECIAL = "0" $NEXT = SECREG2 GOTO CHECKSEC :SECREG2 $DSCRIPTN = "Shutdown System with Full Event Log" ; Shut the system when the Security Event Log is full. Ensure that ; the Event Log is configured large enough to allow for long periods ; between shutdowns. ; See MSKB Article Q140058 for an explanation of the function ; See MSKB Articles Q232564, Q149393 & Q178208 for additional configuration ; issues and potential problems with this edit's use. $LEVEL = "3" $REGKEY = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" $REGVALUE = "CrashOnAuditFail" $REGTYPE = "REG_DWORD" $GOOD = "1" $BAD = "0" $SPECIAL = "0" $NEXT = SECREG3 GOTO CHECKSEC :SECREG3 $DSCRIPTN = "Restrict Anonymous Users from Enumerating Shared Resources" ; Restrict non-authenticated accounts (anonymous or NULL connections ; from enumerating Local/Domain User names or network shares (as well as obtaining ; the local system's password policy). This should be used in conjunction with the ; securing of the NullSessionShares & NullSessionPipes under HKLM\SYSTEM; CurrentControlSet\Services\LanmanServer\Parameters. Also, see SECREG37/ "Restrict ; All Null Session Access". See MSKB Article Q143474 for further details $LEVEL = "1" $REGKEY = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" $REGVALUE = "RestrictAnonymous" $REGTYPE = "REG_DWORD" $GOOD = "1" $BAD = "0" $SPECIAL = "0" $NEXT = SECREG4 GOTO CHECKSEC :SECREG4 $DSCRIPTN = "Enable Full Privilege Auditing" ; This enables the auditing of those privileges that are not normally ; in the NT audit schema, they are: ; 1. Bypass Traverse Checking(SeChangeNotifyPrivilege) ; 2. Debug Programs (SeDebugPrivilege) ; 3. Create a Token Object (SeCreateTokenPrivilege) ; 4. Replace a Process-Level Token (SeAssignPrimaryTokenPrivilege) ; 5. Generate Security Audits (SeAuditPrivilege) ; 6. Backup Files & Directories (SeBackupPrivilege) ; 7. Restore Files & Directories (SeRestorePrivilege) ; NOTE: Enabling this edit will lead to huge Security event logs (and slow ; server performance) as every backup and restore operation will be FULLY logged. ; See the Microsoft Security Whitepaper located on their \Security website for ; further information $LEVEL = "2" $REGKEY = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" $REGVALUE = "FullPrivilegeAuditing" $REGTYPE = "REG_BINARY" $GOOD = "1" $BAD = "0" $SPECIAL = "0" $NEXT = SECREG5 GOTO CHECKSEC :SECREG5 ; Restricts the installation of Printer Drivers to the members of the local ; Administrators group only. See the Microsoft Security Whitepaper located ; on their \Security website for further information $DSCRIPTN = "Restrict Print Driver Installation" $LEVEL = "1" $REGKEY = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Providers\LanMan Print Services\Servers" $REGVALUE = "AddPrintDrivers" $REGTYPE = "REG_DWORD" $GOOD = "1" $BAD = "0" $SPECIAL = "1" $NEXT = SECREG6 GOTO CHECKSEC :SECREG6 $DSCRIPTN = "Disable CD-ROM Auto-Run" ; This disables the automatic playing of CD-ROMs when they are inserted into ; the CD-ROM drive. Really a nuisance more than a security risk but there exists ; the potential for *someone* to create a CD that automatically runs (via ; AUTORUN.INF) a segment or series of code that can insert a trojan, destroy data, ; etc. From the TWEAKUI settings. $LEVEL = "2" $REGKEY = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Cdrom" $REGVALUE = "Autorun" $REGTYPE = "REG_DWORD" $GOOD = "0" $BAD = "1" $SPECIAL = "0" $NEXT = SECREG7 GOTO CHECKSEC :SECREG7 $DSCRIPTN = "Disable Caching of Logon Credentials" ; This edit disables the caching of credentials used to establish connections to ; remote systems. These credentials allow for seemless reconnection to resources ; during an active logon session should that session be broken for any reason. ; The danger is when a user stays logged onto a system and then walks away, leaving ; the cached credentials available to the next user if they had failed to logoff. ; See MSKB Article Q172931 for further details. $LEVEL = "2" $REGKEY = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" $REGVALUE = "CachedLogonsCount" $REGTYPE = "REG_DWORD" $GOOD = "0" $BAD = "1" $SPECIAL = "0" $NEXT = SECREG8 GOTO CHECKSEC :SECREG8 $DSCRIPTN = "Restrict Allocation of CD-ROMs" ; This, alone with SECREG9, restict the access to the CD and Floppy drives by remote ; users so that they can only be used by an interactively logged-on user. ; See MSKB Article Q172520 $LEVEL = "1" $REGKEY = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" $REGVALUE = "AllocateCDRoms" $REGTYPE = "REG_SZ" $GOOD = "1" $BAD = "0" $SPECIAL = "0" $NEXT = SECREG9 GOTO CHECKSEC :SECREG9 $DSCRIPTN = "Restrict Allocation of Floppy Drives" ; This, alone with SECREG8, restict the access to the CD and Floppy drives by remote ; users so that they can only be used by an interactively logged-on user. ; See MSKB Article Q172520 $LEVEL = "1" $REGKEY = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" $REGVALUE = "AllocateFloppies" $REGTYPE = "REG_SZ" $GOOD = "1" $BAD = "0" $SPECIAL = "0" $NEXT = SECREG10 GOTO CHECKSEC :SECREG10 $DSCRIPTN = "Disable Shutdown Button at Logon" ; This edit removes the Shutdown button from NT's logon screen. This denies an ; unauthenticated user the ability to shut a system down (though the power switch, reset ; button and power cable will also need to be secured to make this option effective). ; See MSKB Article Q114817 & 143164 for further details $LEVEL = "2" $REGKEY = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" $REGVALUE = "ShutdownWithoutLogon" $REGTYPE = "REG_SZ" $GOOD = "1" $BAD = "0" $SPECIAL = "0" $NEXT = SECREG11 GOTO CHECKSEC :SECREG11 $DSCRIPTN = "Disable Display of the Last Logged-on User" ; Security through obscurity. This edit ensures that the last logged-on username does ; not appear in the logon dialog box so that it might be used to attempt to gain ; unauthorized access to a system. See MSKB Article Q114463 for further details $LEVEL = "2" $REGKEY = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" $REGVALUE = "DontDisplayLastUserName" $REGTYPE = "REG_SZ" $GOOD = "1" $BAD = "0" $SPECIAL = "0" $NEXT = SECREG12 GOTO CHECKSEC :SECREG12 $DSCRIPTN = "Disable Caching of Roaming Profiles" ; This edit deletes a cached Roaming Profile once the user logs off of the system. This ; can be useful if you have an administrative profile that may contain sensitive data in ; the NTUSER.DAT file and you wish to secure it from prying eyes. The downside is that the ; profile will have to be reloaded from the server each time you logon, making it a long ; logon process if the profile is rather large. See MSKB Article Q173870 for further details $LEVEL = "1" $REGKEY = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" $REGVALUE = "DeleteRoamingCache" $REGTYPE = "REG_DWORD" $GOOD = "1" $BAD = "0" $SPECIAL = "0" $NEXT = SECREG13 GOTO CHECKSEC :SECREG13 $DSCRIPTN = "Disable Administrative Shares" ; This edit removes the default Administrative shares (C$, D$) on a workstation running ; the Server service. It can be replaced by a more stringent security policy and obscure ; hidden share names (appended with the $ at the end of the share name). See MSKB Articles ; Q156365 & Q185590 for further details. $LEVEL = "2" $REGKEY = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" $REGVALUE = "AutoShareWks" $REGTYPE = "REG_DWORD" $GOOD = "0" $BAD = "1" $SPECIAL = "0" $NEXT = SECREG14 GOTO CHECKSEC :SECREG14 $DSCRIPTN = "Secure Base System Objects" ; This enables a greater degree of protection on such objects as known System DLLs. It ; is recommended if you have interactive users who are *not* local Administrators who may ; be attempting to gain greater access to a system (such as with kiosk machines). See MSKB ; Article Q218473 for further details. $LEVEL = "3" $REGKEY = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager" $REGVALUE = "ProtectionMode" $REGTYPE = "REG_DWORD" $GOOD = "1" $BAD = "0" $SPECIAL = "0" $NEXT = SECREG15 GOTO CHECKSEC :SECREG15 $DSCRIPTN = "Clear the Pagefile at Shutdown" ; This edit clears the System Pagefile(s) at shutdown to ensure that potentially sensitive data ; is not written to it at shutdown (as some third-party products may do). See MSKB Article Q182086 ; for more information. $LEVEL = "3" $REGKEY = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" $REGVALUE = "ClearPageFileAtShutdown" $REGTYPE = "REG_DWORD" $GOOD = "1" $BAD = "0" $SPECIAL = "0" $NEXT = SECREG16 GOTO CHECKSEC :SECREG16 $DSCRIPTN = "Restrict Guest Access to the Application Event Log" ; This edit, along with SECREG17 & 18, remove the ability for members of Guests to view ; or manipulate the Event Log settings on the local station. $LEVEL = "1" $REGKEY = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Application" $REGVALUE = "RestrictGuestAccess" $REGTYPE = "REG_DWORD" $GOOD = "1" $BAD = "0" $SPECIAL = "0" $NEXT = SECREG17 GOTO CHECKSEC :SECREG17 $DSCRIPTN = "Restrict Guest Access to the Security Event Log" ; This edit, along with SECREG16 & 18, remove the ability for members of Guests to view ; or manipulate the Event Log settings on the local station. $LEVEL = "1" $REGKEY = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Security" $REGVALUE = "RestrictGuestAccess" $REGTYPE = "REG_DWORD" $GOOD = "1" $BAD = "0" $SPECIAL = "0" $NEXT = SECREG18 GOTO CHECKSEC :SECREG18 $DSCRIPTN = "Restrict Guest Access to the System Event Log" ; This edit, along with SECREG16 & 17, remove the ability for members of Guests to view ; or manipulate the Event Log settings on the local station. $LEVEL = "1" $REGKEY = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\System" $REGVALUE = "RestrictGuestAccess" $REGTYPE = "REG_DWORD" $GOOD = "1" $BAD = "0" $SPECIAL = "0" $NEXT = SECREG19 GOTO CHECKSEC :SECREG19 $DSCRIPTN = "Disable Source Routing of IP Packets" ; This key, while available since SP3, was apparently not doing it's job. The new hotfix ; IPSRFIXI.EXE resolves the vulnerability regarding the undesired routing of IP Source packets ; or for using non-routing systems to "bounce" packets off of (in order to make the traffic ; appear to be coming from that system). See MSKB Articles Q240382 & Q217336 for further details. $LEVEL = "1" $REGKEY = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" $REGVALUE = "DisableIPSourceRouting" $REGTYPE = "REG_DWORD" $GOOD = "1" $BAD = "0" $SPECIAL = "0" $NEXT = SECREG20 GOTO CHECKSEC :SECREG20 $DSCRIPTN = "Sign Secure Session Channel Traffic" ; This edit enables the signing of SSC traffic between members of a Domain to ensure that ; the sender/receiver of session authentication traffic (such as the $MACHINE.ACC & password) is ; verified. See MSKB Article Q183859 for further details. $LEVEL = "3" $REGKEY = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Netlogon\Parameters" $REGVALUE = "SignSecureChannel" $REGTYPE = "REG_DWORD" $GOOD = "1" $BAD = "0" $SPECIAL = "0" $NEXT = SECREG21 GOTO CHECKSEC :SECREG21 $DSCRIPTN = "Seal Secure Session Channel Traffic" ; This edit enables the encryption of SSC traffic, so that the machine name is encrypted and the ; password is doubly-encrypted, as well as all additional SSC-related traffic. See MSKB Article ; Q183859 for further details. $LEVEL = "3" $REGKEY = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Netlogon\Parameters" $REGVALUE = "SealSecureChannel" $REGTYPE = "REG_DWORD" $GOOD = "1" $BAD = "0" $SPECIAL = "0" $NEXT = SECREG22 GOTO CHECKSEC :SECREG22 $DSCRIPTN = "Require Sign/Seal of Secure Session Channel Traffic" ; this setting ensures that all SSC traffic is either signed or sealed. If enabled, all DCs ; MUST also have this value set. See MSKB Article Q183859 for further details. $LEVEL = "3" $REGKEY = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Netlogon\Parameters" $REGVALUE = "RequireSignOrSeal" $REGTYPE = "REG_DWORD" $GOOD = "1" $BAD = "0" $SPECIAL = "0" $NEXT = SECREG23 GOTO CHECKSEC :SECREG23 $DSCRIPTN = "Enable Forced Logoffs" ; By default, this value is set to 1 but is normally not visible under this subkey unless ; someone has run NET CONFIG SERVER /HIDDEN:YES|NO, in which case all of the values ; normally controlled dynamically by the operating system are written as static entries ; under this key. This key ensures that the server can force connections off of ; the system. $LEVEL = "2" $REGKEY = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" $REGVALUE = "EnableForcedLogOff" $REGTYPE = "REG_DWORD" $GOOD = "1" $BAD = "0" $SPECIAL = "0" $NEXT = SECREG24 GOTO CHECKSEC :SECREG24 $DSCRIPTN = "Disable Clear Text Passwords" ; See SP3 Documentation on this Registry edit. Some environments that support UNIX ; interoperability may require that authentication be allowed to be sent in the clear. ; This change ensures that if a system (such as a mobile/laptop NT user) has been in ; an environment such as this, the setting is checked (and disabled). $LEVEL = "1" $REGKEY = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Rdr\Parameters" $REGVALUE = "EnablePlainTextPassword" $REGTYPE = "REG_DWORD" $GOOD = "0" $BAD = "1" $SPECIAL = "0" $NEXT = SECREG25 GOTO CHECKSEC :SECREG25 $DSCRIPTN = "Disable 8.3 Name Generation for Win16/DOS" ; Not only a security issue but a performance enhancer as well, this edit disables ; the creation of short filenames/paths for use with DOS/Win16 applications. ; See MSKB Articles Q121007 & Q210638 for further details. $LEVEL = "3" $REGKEY = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem" $REGVALUE = "NtfsDisable8dot3NameCreation" $REGTYPE = "REG_DWORD" $GOOD = "1" $BAD = "0" $SPECIAL = "0" $NEXT = SECREG26 GOTO CHECKSEC :SECREG26 $DSCRIPTN = "Disable Caching of Encrypted Web Pages to Disk" ; Configurable through the Properties/ Advanced page of Internet Explorer, the value is ; actually listed as 'Do not save encrypted pages to disk'. This can be set under ; HKEY_USERS\.DEFAULT\.. to ensure that the value is added for all new users as well. $LEVEL = "1" $REGKEY = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" $REGVALUE = "DisableCachingOfSSLPages" $REGTYPE = "REG_DWORD" $GOOD = "1" $BAD = "0" $SPECIAL = "0" $NEXT = SECREG27 GOTO CHECKSEC :SECREG27 $DSCRIPTN = "Enable SMB Packet Signing on NT Workstations" ; This edit enables the signing of all CIFS/SMB traffic from the workstation verifying ; the originating address. This edit can produce significant overhead (greater than the ; 10-15% specified in the MSKB Article). See MSKB Article Q161372 for further details. $LEVEL = "3" $REGKEY = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Rdr\Parameters" $REGVALUE = "EnableSecuritySignature" $REGTYPE = "REG_DWORD" $GOOD = "1" $BAD = "0" $SPECIAL = "0" $NEXT = SECREG28 GOTO CHECKSEC :SECREG28 $DSCRIPTN = "Require SMB Packet Signing on NT Workstations" ; This edit enables the requirement of all CIFS/SMB traffic from the workstation to be signed. ; This edit can produce significant overhead (greater than the 10-15% specified in the ; MSKB Article). See MSKB Article Q161372 for further details. $LEVEL = "3" $REGKEY = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Rdr\Parameters" $REGVALUE = "RequireSecuritySignature" $REGTYPE = "REG_DWORD" $GOOD = "1" $BAD = "0" $SPECIAL = "0" $NEXT = SECREG29 GOTO CHECKSEC :SECREG29 ; If you are absolutely certain that you have clients that are NOT using DCOM, ; use this edit. Read the COM Security whitepaper or MSKB Article Q158508 for ; further details. $DSCRIPTN = "Disable DCOM" $LEVEL = "3" $REGKEY = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Ole" $REGVALUE = "EnableDCOM" $REGTYPE = "REG_SZ" $GOOD = "N" $BAD = "Y" $SPECIAL = "0" $NEXT = SECREG30 GOTO CHECKSEC :SECREG30 $DSCRIPTN = "Restrict All Null Session Access" ; This edit purportedly removes a Null session's ability to perform operations normally ; available to Null Sessions, it may cause problems with applications running as services that ; attempt to access UNC paths or some COM apps. See MSKB Article Q158508 for further details. ; NOTE: The edit is incorrectly referenced in the article as "RestrictNullSessionAccess". $LEVEL = "2" $REGKEY = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" $REGVALUE = "RestrictNullSessAccess" $REGTYPE = "REG_DWORD" $GOOD = "1" $BAD = "0" $SPECIAL = "0" $NEXT = SECREG31 GOTO CHECKSEC :SECREG31 $DSCRIPTN = "Enable PASSFILT/Complex Passwords" ; This edit sets up complex password requirements for the local station. ; 1. Passwords must be at least 6 characters long. ; 2. Passwords must contain characters from at least 3 of the following 4 classes: ; ; Class Examples ; ----- -------- ; English Upper Case Letters A, B, C, ... Z ; English Lower Case Letters a, b, c, ... z ; Westernized Arabic Numerals 0, 1, 2, ... 9 ; Non-alphanumeric characters .,;:*&%! ; ; 3. Passwords may not contain your user name or any part of your full name. ; This edit contains a GOSUB routine ($SPECIAL = "1") that runs the copy of ; PASSFILT.DLL from the NETLOGON directory of the authenticating server to ; the %SystemRoot%\System32 subdirectory of the local station. This edit should ; be used in conjunction with the NT Resource Kit tool PASSPROP.EXE on all NT Servers. ; See the SP3 documentation for more information on PASSFILT.DLL $LEVEL = "2" $REGKEY = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" $REGVALUE = "Notification Packages" $REGTYPE = "REG_MULTI_SZ" ; For those users of Netware, otherwise Nuke FPNWCLNT. ;$GOOD = "FPNWCLNT|PASSFILT|" $GOOD = "PASSFILT|" $BAD = "FPNWCLNT" $SPECIAL = "1" $NEXT = SECREG32 GOTO CHECKSEC :SECREG32 $DSCRIPTN = "Disable LM Authentication" ; This edit has several options that you can configure for your environment as you see ; fit. For the full functionality of this edit to be used, several conditions must be met. ; You must have SP4 or greater installed and for settings above 3, these values must ; exist on all DCs as well. As there are many configuration options involved here, you ; must be very careful when applying this value. The default established here is 2, disabling ; all LM activity (95 clients). ; ; Value: LMCompatibilityLevel ; Valid Range: 0-5 Default: 0 ; Description: This parameter specifies the type of authentication to be used. ; Level 0 - Send LM response and NTLM response; never use NTLMv2 session ; security Level 1 - Use NTLMv2 session security if negotiated ; Level 2 - Send NTLM authenication only ; Level 3 - Send NTLMv2 authentication only ; Level 4 - DC refuses LM authentication ; Level 5 - DC refuses LM and NTLM authenication (accepts only NTLMv2) ; ; WARNING: Read *ALL* of MSKB Article Q147706 before using this edit! $LEVEL = "3" $REGKEY = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" $REGVALUE = "LMCompatibilityLevel" $REGTYPE = "REG_MULTI_SZ" $GOOD = "2" $BAD = "0" $SPECIAL = "0" $NEXT = SECREG33 GOTO CHECKSEC :SECREG33 $DSCRIPTN = "Disable the OS/2 & Posix Subsystems" ; This edit removes both the OS/2 & Posix subsystem entries as well as the individual values ; for each (as denoted by the GOSUB $SPECIAL = "1" value) and the files OS2SS.EXE and PSXSS.EXE. ; These two subsystems leave a potentially exploitable hole in a Workstations security. |
||||||||
|
|
|||||||
Ron, all I won't post this , only for the stats : Conversion - 2668 lines Duration - 7 seconds, 861 milliseconds Commands - 1318 Functions - 493 Macros - 21 Jooel ! You did a hell of an improvement with your conversion engine !!! |
||||||||
|
|
|||||||
I think that was the plan in the first place, eh? but seems that doc is skeptic still does it work |
||||||||
|
|
|||||||
Heck no I'm not skeptic. I think it is a GREAT tool and can't hardly wait till you guys release it for general use. Darn good job Jooel and Jochen.... Hopefully Shawn will complete build 38 soon and you guys can finish up any other little minor glitches and the rest of us can then start using this new tool. Thanks Jochen and Jooel for spending the time on this so that we can all enjoy it. LOVE IT...LOVE IT...LOVE IT...LOVE IT...LOVE IT... |
||||||||
|
|
|||||||
k... as you guys wanted multiline text, here it is. only thing it did bring up was the execution time. which currently was for checker over 4s! not sure I like this change at all! anyway, here is the code... look for blocks of multiline green: {edit} code removed for saving space on the HD also the linefeed issues have been removed in current alpha. {/edit} [ 24. January 2003, 17:07: Message edited by: Lonkero ] |
||||||||
|
|
|||||||
jochen??? what has changed? why my code is with spread that way? |
||||||||
|
|
|||||||
k, got the code improved a little... now it took only 3s 876ms but with 417 lines that is much too. dunno. still, jochen, wasn't this script supposed not to write the lf-char to the html-file? for me it does and that screws it up. |
||||||||
|
|
|||||||
trying to optimize my code... does anyone have faster way of doing: case $c='"' $s=$s+$t+$c do if $=$_ $f[$a]=$s $a=$a+1 $i=$f[$a] $s='' $=0 $_=len($i) endif do $=$+1 $c=substr($i,$,1) $s=$s+$c until $c='"' or $=$_ until $c='"' $s=$s+$te all volunteers of helping me out are welcome |
||||||||
|
|
|||||||
Just to proof that you screwed setascii("on") $a = 1 cls while $a < 5 ;Change this value to get more or less numbers $y = 1 while $y <= 80 $z = 1 while $z <= 20 at($z,$y) "$x " + chr($x) $z = $z + 1 $x = $x + 1 loop $y = $y + 10 loop ? shell "%comspec% /c pause" $a = $a + 1 loop exit The script as is adds only on save as html an additional <_br> tag |
||||||||
|
|
|||||||
k, I don't need to proof that you screw more |
||||||||
|
|
|||||||
fight for better colors: $name="KiXWeeper v1.3" $author="1.0 unknown","1.1 Lonkero","1.2 Lonkero","1.3 Lonkero" $Form = CreateObject("Kixtart.Form") $Form.Caption = $name $Form.BackColor = 255,255,255 $Form.ForeColor = 50,0,170 $Form.FontName = "Courier New" $Form.FontBold = 1 $Form.FontSize = 10 $level=$form.slider(,15,12,75,25) $level.tooltip="Level: 0" $level.min=11 $level.onscroll="$$level.tooltip='Level: '+($$level.value-11)" $=11 for $height=390 to $form.screen.height step 25 $=$+1 next $level.max=$-1 ;<-if you remove this -1 you will get error every time! $thislevel=11 Global $Button[$,$], $mine $map=$Button $r=0 $b=0 For $Top = 50 To ($*25+25) Step 25 For $Left = 10 To ($*25-15) Step 25 $map[$r,$b] = $Form.label(,$left,$top,25,25) $map[$r,$b].hide $map[$r,$b].alignment=2 $map[$r,$b].FontSize=14 $map[$r,$b].BorderStyle=1 $Button[$r,$b] = $Form.button(,$left,$top,25,25) $Button[$r,$b].hide $Button[$r,$b].FontBold = 1 $Button[$r,$b].onclick="button_click($r,$b)" $b=$b+1 Next $b=0 $r=$r+1 Next $Time = $Form.Label $Time.Size = 75,30 $Time.Alignment = 1 $Time.BorderStyle = 4 $Time.Fontname = "Courier New" $Time.Fontsize = 14 $Time.Fontbold = 1 $Time.BackColor = 0 $Time.ForeColor = 255,255,0 $start=$form.button("New Game",225,10,75,25) $start.onclick="new($$level.value)" new(11) $Form.Show While $Form.Visible $=Execute($Form.DoEvents) Loop Exit 1 Function Button_Click($r,$b) $=$thislevel select case not $Button[$r,$b].visible case " "=$map[$r,$b].caption $Button[$r,$b].Hide $Score=$Score+1 $Button[$r,$b].hide if $b>0 and $r>0 button_click($r-1,$b-1) endif if $r>0 button_click($r-1,$b) endif if $b<$ and $r>0 button_click($r-1,$b+1) endif if $b>0 button_click($r,$b-1) endif if $b<$ button_click($r,$b+1) endif if $b>0 and $r<$ button_click($r+1,$b-1) endif if $r<$ button_click($r+1,$b) endif if $b<$ and $r<$ button_click($r+1,$b+1) endif case instr($map[$r,$b].caption,"X") $map[$r,$b].forecolor=255,0,0 $Button[$r,$b].Hide $map[$r,$b].show for $r=0 to $ for $b=0 to $ if $button[$r,$b].visible $Button[$r,$b].caption=$map[$r,$b].caption $Button[$r,$b].enabled=0 endif next next $timer=0 case 1 $map[$r,$b].forecolor=50,0,170 $Button[$r,$b].Hide $Score=$Score+1 endselect $map[$r,$b].show if $Score = ($+1)*($+1)-($+1)*($+1)/10 $timer=0 $=messagebox("GOOD! You made your way trough the mine fields!",$name) endif if $timer and $timer<>0 $timer=$Form.timer(1000) $timer.ontimer="$$time.caption=1+val($$time.caption)" endif EndFunction function new($size) $score=0 $thislevel=$size $timer=1 $Time.Caption = 0 $mine=" ," srnd(@ticks) do $=rnd(($size+1)*($size+1)) if not instr($mine,$) $mine="$mine ,"+$ endif until (($size+1)*($size+1)/10+1)<ubound(split($mine," ,")) for $r=0 to $level.max for $b=0 to $level.max if $b>$size or $r>$size $Button[$r,$b].hide else $Button[$r,$b].caption="" $Button[$r,$b].enabled=1 $Button[$r,$b].show endif $map[$r,$b].hide $map[$r,$b].caption="" next next $Form.Width = $size*25+50 $Form.Height = $size*25+115 $Form.Center $Time.Center $Time.Top = 10 $start.left=$form.width-95 $c=1 for $r=0 to $size for $b=0 to $size if instr($mine,",$c ,") $map[$r,$b].caption="X" endif $c=$c+1 next next for $r=0 to $size for $b=0 to $size if not instr($map[$r,$b].caption,"X") $=0 if $b>0 and $r>0 if instr($map[$r-1,$b-1].caption,"X") $=$+1 endif endif if $r>0 if instr($map[$r-1,$b].caption,"X") $=$+1 endif endif if $b<$size and $r>0 if instr($map[$r-1,$b+1].caption,"X") $=$+1 endif endif if $b>0 if instr($map[$r,$b-1].caption,"X") $=$+1 endif endif if $b<$size if instr($map[$r,$b+1].caption,"X") $=$+1 endif endif if $b>0 and $r<$size if instr($map[$r+1,$b-1].caption,"X") $=$+1 endif endif if $r<$size if instr($map[$r+1,$b].caption,"X") $=$+1 endif endif if $b<$size and $r<$size if instr($map[$r+1,$b+1].caption,"X") $=$+1 endif endif if $=0 $map[$r,$b].caption=" " else $map[$r,$b].caption=$ endif endif next next endfunction |
||||||||
|
|
|||||||
Ahh! Pretty! Perhaps you should include selectable colour "themes" |
||||||||
|
|
|||||||
FOR loops are not indented correctly, is there no indentation check/cleanup? |
||||||||
|
|
|||||||
jens, what is indent? there is already too much indention that I hate. I would like to remove all spaces longer than 1. but, jochen the project's executive officer didn't like the idea. anyway, I like it is now and it's indented correctly even though it does not fit to your eye |
||||||||
|
|
|||||||
ok, I admit that one would not call that indenting if they use editor. my editor is notepad and when there is multiple for loops lined up together it looks better. |
||||||||
|
|
|||||||
For loops are indented but Select Case constructs are not. |
||||||||
|
|
|||||||
...neither are Function constructs. |
||||||||
|
|
|||||||
sorry, they are. just in my way. I don't like wast strokes inside function to show on every line that it's inside a function I neither like that case should be indented below the level of select... or do you indent else below the level of if and endif? it's matter of everyone doing it their own way. I respect mine. |
||||||||
|
|
|||||||
k, there seems to have something different as now the layout does not worky properly... there indeed is some thing messing it. |
||||||||
|
|
|||||||
WHO said this then Les ? The correct indentation is always left to the Person who wrote the Script ! This is still a f**** free format language However, I took the freedom to replace TABS with 4 Spaces on Conversion (Just to keep the long line police a bit more in the Donut shop ) Whatever you like the colors to be, you can set them and they will be stored (as well as the Keywords that one may add from time to time) ... Shemes to store aren't (yet) implemented (Hey, the freaking script isn't released ) Also worth to mention is the disability to post in html disabled forums (like General Discussion), and the problems posting some forms events like On_Click (the underscore is just to be able to reply here) What else ? hmmm ... ah well you can post the conversion as well as save it as html file (Requests after release please ) One more thing : Richard .. I don't think its a good Idea to colorize keywords inside srings ! Or as the poets amongst us might say : A string is a string is a string mmm .. will get online now to discuss that crap with Lonk l8r Jochen |
||||||||
|
|
|||||||
jpols, No need to get your knickers in a twist. Anyway, the ribbing was directed at Jooel and last I saw, he can fend for himself. I can say without expletives that KiX is a free format language. Type it all on one line if you want but watch for the long-line cops if you post it here! Indenting is certainly a matter of choice. So is the use of descriptive vars and CODE tags. |
||||||||
|
|
|||||||
for $=1 to $_ $c=substr($i,$,1) $!="" select case $c='"' $s=$s+$t+$c do if $=$_ $f[$a]=$s $a=$a+1 $i=$f[$a] $s='' $=0 $_=len($i) endif do $=$+1 $c=substr($i,$,1) $s=$s+$c until $c='"' or $=$_ until $c='"' $s=$s+$te case $c="'" $s=$s+$t+$c do if $=$_ $f[$a]=$s $a=$a+1 $i=$f[$a] $s='' $=0 $_=len($i) endif do $=$+1 $c=substr($i,$,1) $s=$s+$c until $c="'" or $=$_ until $c="'" $s=$s+$te for $=1 to $_ $c=substr($i,$,1) $!="" select case $c='"' $s=$s+$t+$c do if $=$_ $f[$a]=$s $a=$a+1 $i=$f[$a] $s='' $=0 $_=len($i) endif do $=$+1 $c=substr($i,$,1) $s=$s+$c until $c='"' or $=$_ until $c='"' $s=$s+$te case $c="'" $s=$s+$t+$c do if $=$_ $f[$a]=$s $a=$a+1 $i=$f[$a] $s='' $=0 $_=len($i) endif do $=$+1 $c=substr($i,$,1) $s=$s+$c until $c="'" or $=$_ until $c="'" $s=$s+$te SPACING FIXED ! HOORAY! Another one : $txtTarget = $frm.TextBox $txtTarget.Left = 5 $txtTarget.Top = 5 + $txtSource.Bottom $txtTarget.Right = $frm.ClientWidth - 110 $txtTarget.Bottom = $frm.ClientHeight - 20 $txtTarget.ScrollBars = 3 $txtTarget.FontName = "Courier New" $txtTarget.FontSize = 8 $txtTarget.MultiLine = 1 [ 24. January 2003, 23:42: Message edited by: jpols ] |
||||||||
|
|
|||||||
$name="KiXWeeper v1.3" $author="1.0 unknown","1.1 Lonkero","1.2 Lonkero","1.3 Lonkero" $Form = CreateObject("Kixtart.Form") $Form.Caption = $name $Form.BackColor = 255,255,255 $Form.ForeColor = 50,0,170 $Form.FontName = "Courier New" $Form.FontBold = 1 $Form.FontSize = 10 $level=$form.slider(,15,12,75,25) $level.tooltip="Level: 0" $level.min=11 $level.onscroll="$$level.tooltip='Level: '+($$level.value-11)" $=11 for $height=390 to $form.screen.height step 25 $=$+1 next $level.max=$-1 ;<-if you remove this -1 you will get error every time! $thislevel=11 Global $Button[$,$], $mine $map=$Button $r=0 $b=0 For $Top = 50 To ($*25+25) Step 25 For $Left = 10 To ($*25-15) Step 25 $map[$r,$b] = $Form.label(,$left,$top,25,25) $map[$r,$b].hide $map[$r,$b].alignment=2 $map[$r,$b].FontSize=14 $map[$r,$b].BorderStyle=1 $Button[$r,$b] = $Form.button(,$left,$top,25,25) $Button[$r,$b].hide $Button[$r,$b].FontBold = 1 $Button[$r,$b].onclick="button_click($r,$b)" $b=$b+1 Next $b=0 $r=$r+1 Next $Time = $Form.Label $Time.Size = 75,30 $Time.Alignment = 1 $Time.BorderStyle = 4 $Time.Fontname = "Courier New" $Time.Fontsize = 14 $Time.Fontbold = 1 $Time.BackColor = 0 $Time.ForeColor = 255,255,0 $start=$form.button("New Game",225,10,75,25) $start.onclick="new($$level.value)" new(11) $Form.Show While $Form.Visible $=Execute($Form.DoEvents) Loop Exit 1 Function Button_Click($r,$b) $=$thislevel select case not $Button[$r,$b].visible case " "=$map[$r,$b].caption $Button[$r,$b].Hide $Score=$Score+1 $Button[$r,$b].hide if $b>0 and $r>0 button_click($r-1,$b-1) endif if $r>0 button_click($r-1,$b) endif if $b<$ and $r>0 button_click($r-1,$b+1) endif if $b>0 button_click($r,$b-1) endif if $b<$ button_click($r,$b+1) endif if $b>0 and $r<$ button_click($r+1,$b-1) endif if $r<$ button_click($r+1,$b) endif if $b<$ and $r<$ button_click($r+1,$b+1) endif case instr($map[$r,$b].caption,"X") $map[$r,$b].forecolor=255,0,0 $Button[$r,$b].Hide $map[$r,$b].show for $r=0 to $ for $b=0 to $ if $button[$r,$b].visible $Button[$r,$b].caption=$map[$r,$b].caption $Button[$r,$b].enabled=0 endif next next $timer=0 case 1 $map[$r,$b].forecolor=50,0,170 $Button[$r,$b].Hide $Score=$Score+1 endselect $map[$r,$b].show if $Score = ($+1)*($+1)-($+1)*($+1)/10 $timer=0 $=messagebox("GOOD! You made your way trough the mine fields!",$name) endif if $timer and $timer<>0 $timer=$Form.timer(1000) $timer.ontimer="$$time.caption=1+val($$time.caption)" endif EndFunction function new($size) $score=0 $thislevel=$size $timer=1 $Time.Caption = 0 $mine=" ," srnd(@ticks) do $=rnd(($size+1)*($size+1)) if not instr($mine,$) $mine="$mine ,"+$ endif until (($size+1)*($size+1)/10+1)<ubound(split($mine," ,")) for $r=0 to $level.max for $b=0 to $level.max if $b>$size or $r>$size $Button[$r,$b].hide else $Button[$r,$b].caption="" $Button[$r,$b].enabled=1 $Button[$r,$b].show endif $map[$r,$b].hide $map[$r,$b].caption="" next next $Form.Width = $size*25+50 $Form.Height = $size*25+115 $Form.Center $Time.Center $Time.Top = 10 $start.left=$form.width-95 $c=1 for $r=0 to $size for $b=0 to $size if instr($mine,",$c ,") $map[$r,$b].caption="X" endif $c=$c+1 next next for $r=0 to $size for $b=0 to $size if not instr($map[$r,$b].caption,"X") $=0 if $b>0 and $r>0 if instr($map[$r-1,$b-1].caption,"X") $=$+1 endif endif if $r>0 if instr($map[$r-1,$b].caption,"X") $=$+1 endif endif if $b<$size and $r>0 if instr($map[$r-1,$b+1].caption,"X") $=$+1 endif endif if $b>0 if instr($map[$r,$b-1].caption,"X") $=$+1 endif endif if $b<$size if instr($map[$r,$b+1].caption,"X") $=$+1 endif endif if $b>0 and $r<$size if instr($map[$r+1,$b-1].caption,"X") $=$+1 endif endif if $r<$size if instr($map[$r+1,$b].caption,"X") $=$+1 endif endif if $b<$size and $r<$size if instr($map[$r+1,$b+1].caption,"X") $=$+1 endif endif if $=0 $map[$r,$b].caption=" " else $map[$r,$b].caption=$ endif endif next next endfunction |
||||||||
|
|
|||||||
got rid of the errors now but does not look goodie... |
||||||||
|
|
|||||||
.onclick [ 25. January 2003, 01:49: Message edited by: Lonkero ] |
||||||||
|
|
|||||||
I HATE THIS F*****ING BOARD! |
||||||||
|
|
|||||||
$name="KiXWeeper v1.3" $author="1.0 unknown","1.1 Lonkero","1.2 Lonkero","1.3 Lonkero" $Form = CreateObject("Kixtart.Form") $Form.Caption = $name $Form.BackColor = 255,255,255 $Form.ForeColor = 50,0,170 $Form.FontName = "Courier New" $Form.FontBold = 1 $Form.FontSize = 10 $level=$form.slider(,15,12,75,25) $level.tooltip="Level: 0" $level.min=11 $level.onscroll="$$level.tooltip='Level: '+($$level.value-11)" $=11 for $height=390 to $form.screen.height step 25 $=$+1 next $level.max=$-1 ;<-if you remove this -1 you will get error every time! $thislevel=11 Global $Button[$,$], $mine $map=$Button $r=0 $b=0 For $Top = 50 To ($*25+25) Step 25 For $Left = 10 To ($*25-15) Step 25 $map[$r,$b] = $Form.label(,$left,$top,25,25) $map[$r,$b].hide $map[$r,$b].alignment=2 $map[$r,$b].FontSize=14 $map[$r,$b].BorderStyle=1 $Button[$r,$b] = $Form.button(,$left,$top,25,25) $Button[$r,$b].hide $Button[$r,$b].FontBold = 1 $Button[$r,$b].onclick="button_click($r,$b)" $b=$b+1 Next $b=0 $r=$r+1 Next $Time = $Form.Label $Time.Size = 75,30 $Time.Alignment = 1 $Time.BorderStyle = 4 $Time.Fontname = "Courier New" $Time.Fontsize = 14 $Time.Fontbold = 1 $Time.BackColor = 0 $Time.ForeColor = 255,255,0 $start=$form.button("New Game",225,10,75,25) $start.onclick="new($$level.value)" new(11) $Form.Show While $Form.Visible $=Execute($Form.DoEvents) Loop Exit 1 Function Button_Click($r,$b) $=$thislevel select case not $Button[$r,$b].visible case " "=$map[$r,$b].caption $Button[$r,$b].Hide $Score=$Score+1 $Button[$r,$b].hide if $b>0 and $r>0 button_click($r-1,$b-1) endif if $r>0 button_click($r-1,$b) endif if $b<$ and $r>0 button_click($r-1,$b+1) endif if $b>0 button_click($r,$b-1) endif if $b<$ button_click($r,$b+1) endif if $b>0 and $r<$ button_click($r+1,$b-1) endif if $r<$ button_click($r+1,$b) endif if $b<$ and $r<$ button_click($r+1,$b+1) endif case instr($map[$r,$b].caption,"X") $map[$r,$b].forecolor=255,0,0 $Button[$r,$b].Hide $map[$r,$b].show for $r=0 to $ for $b=0 to $ if $button[$r,$b].visible $Button[$r,$b].caption=$map[$r,$b].caption $Button[$r,$b].enabled=0 endif next next $timer=0 case 1 $map[$r,$b].forecolor=50,0,170 $Button[$r,$b].Hide $Score=$Score+1 endselect $map[$r,$b].show if $Score = ($+1)*($+1)-($+1)*($+1)/10 $timer=0 $=messagebox("GOOD! You made your way trough the mine fields!",$name) endif if $timer and $timer<>0 $timer=$Form.timer(1000) $timer.ontimer="$$time.caption=1+val($$time.caption)" endif EndFunction function new($size) $score=0 $thislevel=$size $timer=1 $Time.Caption = 0 $mine=" ," srnd(@ticks) do $=rnd(($size+1)*($size+1)) if not instr($mine,$) $mine="$mine ,"+$ endif until (($size+1)*($size+1)/10+1)<ubound(split($mine," ,")) for $r=0 to $level.max for $b=0 to $level.max if $b>$size or $r>$size $Button[$r,$b].hide else $Button[$r,$b].caption="" $Button[$r,$b].enabled=1 $Button[$r,$b].show endif $map[$r,$b].hide $map[$r,$b].caption="" next next $Form.Width = $size*25+50 $Form.Height = $size*25+115 $Form.Center $Time.Center $Time.Top = 10 $start.left=$form.width-95 $c=1 for $r=0 to $size for $b=0 to $size if instr($mine,",$c ,") $map[$r,$b].caption="X" endif $c=$c+1 next next for $r=0 to $size for $b=0 to $size if not instr($map[$r,$b].caption,"X") $=0 if $b>0 and $r>0 if instr($map[$r-1,$b-1].caption,"X") $=$+1 endif endif if $r>0 if instr($map[$r-1,$b].caption,"X") $=$+1 endif endif if $b<$size and $r>0 if instr($map[$r-1,$b+1].caption,"X") $=$+1 endif endif if $b>0 if instr($map[$r,$b-1].caption,"X") $=$+1 endif endif if $b<$size if instr($map[$r,$b+1].caption,"X") $=$+1 endif endif if $b>0 and $r<$size if instr($map[$r+1,$b-1].caption,"X") $=$+1 endif endif if $r<$size if instr($map[$r+1,$b].caption,"X") $=$+1 endif endif if $b<$size and $r<$size if instr($map[$r+1,$b+1].caption,"X") $=$+1 endif endif if $=0 $map[$r,$b].caption=" " else $map[$r,$b].caption=$ endif endif next next endfunction [ 25. January 2003, 01:56: Message edited by: Lonkero ] |
||||||||
|
|
|||||||
k, much better |
||||||||
|
|
|||||||
hehe ... looking forward to see how you shipped around OnCLIK will be online now ´... 3 - 2 - 1 |
||||||||
|
|
|||||||
as jpols is offline like usual, say it here. now also udf-collector seems to be "compatible" with postprep. I just wonder should it show the colors or not... |
||||||||
|
|
|||||||
I don't have a very strong view on highlighting variable and macros in strings for posting. For consistancy I think it would be better if they are, after all as us non-poets say, "a variable is a variable..." It's more important to highlight variables and macros in editors, as forgetting to double up $,@ and % characters is a common and easily fixed error. Here is an example from VIM with and without highlighting variables in strings:
If the processing or coding overhead is significant it is probably not worth the bother. On the issue of indenting shouldn't it simply respect whatever is in the original code? Or am I missing something? |
||||||||
|
|
|||||||
there is no indention. only place where that must occur is the onclick which needs to have space before equal sign. like I pasted your code in kixcryptGUI, is the indention messed up? the var in string, it actually was that way before and it's faster to execute and easier to code... but, string is a string is a string. |
||||||||
|
|
|||||||
Richard, Thank you for your response only so much : 90% of the errors in KiX coding are missing quotes (at least it was when when I started to code KiX and sometimes I do this still ), so the best approach to visualize these is consequently colorize strings whereever they occur : even those multilined execute statements I start to use more and more since this PostPrep coding (my Uedit btw. doesn't colorize ,multiline strings : one of the annoying facts about it ) ; That would get the best (IMHO) possibility to easy recognize those errors regards J. |
||||||||
|
|
|||||||
The VIM syntax file doesn't handle multi-line quoted strings either - I can't blame anyone else as I'm the maintainer LOL |
||||||||
|
|
|||||||
Maybe I should use the windowed vi version some day ... Is it free ? NO ! PLEASE DON'T ABUSE THIS AS AN EDITOR DISCUSSION |
||||||||
|
|
|||||||
You can download it (and get more info) here Yes it is free (including source code). It is covered by a "charityware" license, similar to KiXtart's "careware". And the maintainer Bram Moolenaar is Dutch I believe. Spooky, eh? It has a powerfull scripting language and a generic WIMP/GUI interface. It's probably most useful to people who already know VI and it's keystroke / regular expression / colon prompt commands. Someone who just wants a syntax highlighting editor on Windows is probably better off with something simpler. It has some great features that I'm only just discovering after years of using it. I recently discovered "folds", which allow you to collapse sections of code to a single line. I now "fold" functions and variable declaration areas in my code, and as the folding can be nested I fold large and complex SELECTs within the function folds. And of course it supports "convert to HTML" for any programming language syntax |
||||||||
|
|
|||||||
Oh well ... there is no need for PostPrep anymore then ? mmm .. only if it was as spreaded as $micronot$ |
||||||||
|
|
|||||||
there is. as postprep supports this board... IIRC that didn't |
||||||||
|
|
|||||||
Of course there is a need for post-prep, it is designed to to a specific job. VIM's HTML conversion is designed simply to convert the syntax coloured text to HTML format suitable for representing as a flat web page. Post-prep is designed to convert plain text to a format suitable to posting to the KiXtart forums which might require fiddling with the code slightly to get it to look right and to get around the "tag not allowed" and similar posting problems. Don't stop now! |