Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Icons in the Windows messages #4

Open
gllanderas opened this issue Apr 25, 2019 · 0 comments
Open

Icons in the Windows messages #4

gllanderas opened this issue Apr 25, 2019 · 0 comments

Comments

@gllanderas
Copy link

Linux messages show icons that identify the type of the message, but Windows messages do not show any icon.

One solution may be to change the msgbox.vbs file as follows:

Function BrowseForFile( dialogText )
  Dim shell : Set shell = CreateObject("Shell.Application")
  Dim file : Set file = shell.BrowseForFolder(0, dialogTitle, 0)
  BrowseForFile = file.self.Path
End Function

Set objArgs = WScript.Arguments
dialogType = objArgs(0)
dialogTitle = objArgs(1)
dialogText = objArgs(2)

If dialogType = "information" Then
  MsgBox dialogText, vbInformation + vbOkOnly, dialogTitle
ElseIf dialogType = "warning" Then
  MsgBox dialogText, vbExclamation + vbOkOnly, dialogTitle
ElseIf dialogType = "error" Then
  MsgBox dialogText, vbCritical + vbOkOnly, dialogTitle
ElseIf dialogType = "question" Then
  answer = MsgBox( dialogText, vbQuestion + vbOKCancel, dialogTitle )
  Wscript.Stdout.Write answer
ElseIf dialogType = "entry" Then
  entryText = InputBox( dialogText, dialogTitle )
  Wscript.Stdout.Write entryText
ElseIf dialogType = "fileselect" Then
  fileName =  BrowseForFile(dialogTitle)
  WScript.echo fileName
Else
  WScript.Echo "unknown dialog type"
End If

And, in the index.js file, changing the calls to the vbs script to pass the type of the message:

...
    else if (OS === "win32")
    {
      cmd.push('cscript');
      cmd.push('//Nologo');
      cmd.push('msgbox.vbs');
      cmd.push('information');   // instead of 'notification'
      cmd.push(title);
      cmd.push(str);

      cb = function(code, stdout, stderr){
        if(callback)
          callback(code, retVal, stderr);
      }
    }
...

and similarly with the 'warning' and 'error' messages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant