https://www.neowin.net/news/vbscript-on-...y-vba-projects/

Since Microsoft was in the news again today reminding everyone that VBScript is being depreciated, I finally sat down and started trying to figure where I might feel this.

Inputbox(), WSHPipe(), and WSHShortCut() are the ones I immediately noticed.

Rarely, I need Inputbox, which was so slickly covered by scriptcontrol. After a ton of work (no thanks to Microsoft Copilot) here is a version using Powershell.


 Code:
Function InputBox($sPrompt, Optional $sTitle, Optional $sDefault)
    dim $PSCommand, $FH, $RC, $TempFile
    If Not $sTitle
      $sTitle = "Input Prompt"
    EndIf
    $TempFile = "%TEMP%\ps_inputbox.txt"
    if exist($TempFile)
      DEL $TempFile
    endif
    $PSCommand = 'powershell -Command "Add-Type -AssemblyName Microsoft.VisualBasic; '
    $PSCommand = $PSCommand + "$input = [Microsoft.VisualBasic.Interaction]::InputBox('" + $sPrompt + "','" + $sTitle + "','" + $sDefault + "'); "
    $PSCommand = $PSCommand + "$input | Out-File -FilePath '" + $TempFile + "' -Encoding ASCII"
    ;$PSCommand = "%COMSPEC% /c " + $PSCommand
    SHELL $PSCommand
    $fh = FreeFileHandle()
    If Open($fh, $TempFile) = 0
      $InputBox = ReadLine($fh)
      $RC=Close($fh)
    EndIf
EndFunction


Would someone mind checking this out and see if you can find issues with it and or report back if works for you?

I'm digging into details about the other two functions.