Skip to content

Icons in the Windows messages #4

Description

@gllanderas

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions