Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 157
  • Last Modified:

Need to add a question and answer action to an existing VBS Script

I need to add a question to the end of a script that asks this question. "Are you backing up data on shared or mapped network drives from this computer?"  The options are yes or no.  If yes then the script needs to open notepad or some word viewer and display instructions on what the user needs to do (lengthy instructions so a simple popup box like the questions use will not be enough).  If the answer is no then it needs to continue through to exit the script.  I am not able to include a text document with this script so I need to be able to include the text instructions within the script and display them with notepad or some viewer so that the user can read them and print them.  Is this possible?
0
murryc
Asked:
murryc
1 Solution
 
GrahamSkanCommented:
How large are the instructions? Could the text be incorporated in the MsgBox question?
0
 
learning_t0_pr0gramCommented:
I suggest creating a form with a Textbox with the instructions in them
0
 
murrycAuthor Commented:
the instructions could be a page long or more.  I must also mention that I do not have nay programming experience, the script I have was created by someone here on EE, I am just adding to it now.  Can someone give me a complete solution with coding and all and just tell me what areas I need to customize with my text.  Thanks.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
aParserCommented:
Dim intRC
intRC = MsgBox("Are you backing up data on shared or mapped network drives from this computer?", 4)
If intRC = 6 Then ' user answered "Yes"
  Dim objShell
  Set objShell = CreateObject("WScript.Shell")
  objShell.Run "notepad myfile.txt"
  Set objShell = Nothing
End If
0
 
GrahamSkanCommented:
Complete solution? possibly, but not from me.

This could be a solution outline:
Select Case MsgBox(SolutionText, vbYesNo)
      Case vbNo
              Shell "Notepad.exe " & "Myfile"
      Case vbYes
End select

I take the attitude that we are here to help developers with a particular problem, so that they can learn and apply the solution to future development
0
 
domjCommented:
This is slightly modified from something I wrote a couple of months ago. It will create a file InstallTemp.html in the users Temp folder and open in default Browser (Please note that my HTML coding is pretty poor so you could easily make it look nicer than it does). This will allow you to include the instructions within the script itself and only 'deploy' them if it is necessary.

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
set fso=CreateObject("Scripting.FileSystemObject")
set wshell=CreateObject("WScript.Shell")

strMsg="Are you backing up data on shared or mapped network drives from this computer?"

Select Case MsgBox(strMsg,vbYesNo)
Case vbYes
      tempDir=WShell.ExpandEnvironmentStrings("%TEMP%")

      set fsoFile=fso.CreateTextFile(tempDir & "\InstallTemp.html")

      strHTML="<HEAD><DIV ALIGN=CENTER><FONT FACE=TAHOMA SIZE=+4><B><U>Heading</U>"
      strHTML=strHTML & "</FONT><BR><FONT face=TAHOMA SIZE=+2>Subheading</font></b><P></DIV>"
      strHTML=strHTML & "<BODY bgcolor=CCFFFF><DIV align=center>Insert your instructions here<BR>"
      strHTML=strHTML & "Including line spanning to cut down the length of lines</div></BODY>"

      fsoFile.Write strHTML
      fsoFile.Close

      wshell.Run tempDir & "\InstallTemp.html"
End Select
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Hope this helps.

Dom
0
 
murrycAuthor Commented:
domj, perfect solution..exactly what I needed.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now