Js Beautify From VB6 or C#


Author: Dave
Date: 08.05.10 - 4:40pm



There is a cool script from jsbeautifier.org that does a really good job of straightening out run together javascript.

They also offer a js file that implements this code. With the MS Script Control, you can trivially include this functionality in your VB6 apps (or any COM aware language that can host the script control)

I have included samples for VB6 and C# in the download zip.

VB6 example below. sc is a script control object with language=jscript.

Update: Demo project download

sc.AddObject "text1", Text1, True
sc.AddCode ReadFile(App.Path & "\beautify.js")
sc.AddCode "text1.text = js_beautify(text1.text);"
text1 = replace(text1, vblf, vbcrlf)




(syntax highlighting control is devcontrol that ships with sleuth)






Comments: (5)

On 07.12.13 - 5:18pm john wrote:
Doesnt work with the latest versions of JSBeautifier Im afraid.

On 07.13.13 - 5:07am Dave wrote:
Hi, the current beautify script still works with a slight modification. Remove the first line: "(function() {" and last line "}());"

On 08.28.13 - 4:13pm Joseph wrote:
Thanks for the tip! I was wondering why it didnt work too. Keep up the good work!

On 12.22.17 - 1:02am rosebk wrote:
It has been just unfathomably liberal with you to give straightforwardly what precisely numerous people wouldve promoted for an eBook to wind up making some money for their end, basically given that you could have attempted it in the occasion you needed.

On 12.22.17 - 8:32am Dave wrote:
Hi Rose, I know I could try to make money off of all of the knowledge I have assembled and work I have done.

I am very thankful I am not hungry and do not have to try to scramble to make a living.

I learned most everything I know by researching topics on the internet and experimenting and learning how to make things work.

Sharing my knowledge and things I enjoy is my way of giving back to the world. Build the world you wish you live in is my thought, even if it is in our own small little way where we can contribute. The ocean is made but of drops.

I dislike the thought of trying to squeeze every cent you can out of others through embedded ads or restricted information.

 
Leave Comment:
Name:
Email: (not shown)
Message: (Required)
Math Question: 58 + 74 = ? followed by the letter: Z 



About Me
More Blogs
Main Site
Posts: (All)
2024 ( 1 )
2023 ( 9 )
2022 ( 4 )
2021 ( 2 )
2020 ( 4 )
2019 ( 5 )
2018 ( 6 )
2017 ( 6 )
2016 ( 22 )
2015 ( 15 )
2014 ( 25 )
2013 ( 4 )
2012 ( 10 )
2011 ( 7 )
2010 (11)
     Dll Not Found in IDE
     Advanced MSScript Control
     random tip
     Clipart / Vector Art
     VB6 Callback from C#
     Binary data from VB6 to C#
     CSharp and MsScriptControl
     HexDumper functions
     Js Beautify From VB6 or C#
     vb6 FormPos
     Inline Asm w VB6
2009 (3)
     The .NET Fiasco
     One rub on computers
     Universal extractor