LesFerch / WinSetView

Globally Set Explorer Folder Views
MIT License
1.07k stars 46 forks source link

Remove Reliance on vbscript #133

Open agentoranger opened 3 weeks ago

agentoranger commented 3 weeks ago

Notably, vbscript is on the way out, All the while, I am sure you are very busy. I would like to request that the reliance on vbscript is removed. On my current systems WinSetView is no longer functional. Thank you for your time and I appreciate the use I have enjoyed from WinSetView.

image

LesFerch commented 3 weeks ago

I'm currently working on converting the 2800+ lines of VBScript code to JScript and the longer term project is a full rewrite in C#. I hope to have the JScript conversion done in the next few months, but I may just move on to the C# project. It's tedious.

VBScript is to be uninstalled by default starting sometime in 2027. Therefore, I guess these are work computers and your IT department has decided to remove VBScript from them. Is that correct?

P.S. The GitHub code identifier only sees the VBScript code in a couple of scripts in the Tools folder, so it shows a small number of 1.7%. Those scripts don't even matter. The main WinSetView.htm and Modal.htm files are counted all as HTML, but are mostly VBScript. The real percentage is about 50% of the total code.

agentoranger commented 3 weeks ago

That's correct, I removed vbscript from my own system, this happens to be a Windows 11 24H2 install, so at very least, I know my problem is self created. I'm not great with vbscript, thought I might be able to help. Any interest in contribution?

LesFerch commented 3 weeks ago

Thanks, but the code really isn't set up for multiple contributors. It's a one-person project for now, although I've had a bit of help with the language files. I'll post back here with any updates.

idnovic commented 2 weeks ago

Hi! Also selfmade problem here. I am going to install vbscript temporarily.

Just wanted to suggest this https://www.vbsedit.com/faq/convertexe.asp

It may be possible to convert the vbscript to an exe in the meantime.

LesFerch commented 2 weeks ago

WinSetView is already a VbsEdit HTML application. The "convert to exe" is an illusion. Tools such as VbsEdit, Bat2Exe, PS2Exe, Py2Exe, WinRAR, etc. wrap an Exe shell around a script.

In the case of HTML applications, VbsEdit provides two modes. The basic mode is a simple self extracting archive that extracts an HTA file and then runs it via MSHTA. The advanced mode (used for WinSetView) provides an Exe shell that uses a webbrowser object (i.e. MSHTML) to run the HTML/CSS/VBScript code. The advanced mode eliminates the need for MSHTA and nothing is extracted to files (it all happens in memory) and it provides some improved functionality over MSHTA. The advanced mode requires Visual Studio to compile the Exe, but it's still a wrapper around a script.

The WinSetView VBScript code has to be carefully converted to JScript in order to run on machines where VBScript has been removed. ChatGPT helps, but it's non-trivial for so much code.

idnovic commented 2 weeks ago

Thank you for the explanation!

Why did you choose JScript? I have no experience with it.

Why not powershell? C# as choice does make sense to me.

LesFerch commented 2 weeks ago

JScript is the only language that is a direct drop in replacement for VBScript in an HTML application. The HTML and CSS code will not have to be touched. The interface will remain identical and the extensive logic that dynamically builds much of the interface will remain the same. Any other language choice means starting from scratch.

When and if I rebuild the interface from scratch, C# makes the most sense. Here's why:

  1. PowerShell does not directly provide GUI features. PowerShell programs that have a GUI rely on a third-party library or they use inline C# code. Either way, it's a hack that doesn't allow for a nice development cycle in an IDE. I don't see any point in using C# code in PowerShell when I can write directly in C#.

  2. I am now comfortable with C# and Visual Studio, so I can build a C# app with a GUI interface in a proper development environment which helps a lot when the amount of code gets into the hundreds or thousands of lines.

  3. A C# exe, using WinForms or WPF XAML on .Net 4.8, will run on Windows 7 through Windows 11 without installing any extra software. And the end-result exe is tiny. I like that.

agentoranger commented 1 week ago

PS2Exe

Fun fact, PS2EXE uses a custom PowerShell interpreter and converts the resultant code into C#, which is why I concur, its an illusion. It certainly failed to get PowerShell WPF forms working in Windows PE for me, but thats off topic.

LesFerch commented 1 week ago

I just tested PS2Exe to be sure and, as expected, it's a C# exe wrapper around the original script. It may replace PowerShell.exe, but not the System.Management.Automation.dll that actually interprets the script. It's very similar to the way a C++ or C# exe wrapper with a webbrowser object replaces MSHTA.exe, but still relies on MSHTML.dll, VBScript.dll, and JScript.dll.

LesFerch commented 4 days ago

I've completed the conversion from VBScript to JScript.

It's available now as a beta. You can find it here.

Please test and let me know results. Thanks.

LesFerch commented 1 day ago

@agentoranger Have you tested the JScript version?