Solved

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

Posted on 2004-09-14
7
151 Views
Last Modified: 2010-05-02
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
Comment
Question by:murryc
7 Comments
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 12059118
How large are the instructions? Could the text be incorporated in the MsgBox question?
0
 
LVL 4

Expert Comment

by:learning_t0_pr0gram
ID: 12059131
I suggest creating a form with a Textbox with the instructions in them
0
 

Author Comment

by:murryc
ID: 12059179
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Expert Comment

by:aParser
ID: 12059335
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
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 12059373
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
 
LVL 3

Accepted Solution

by:
domj earned 250 total points
ID: 12060246
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
 

Author Comment

by:murryc
ID: 12088387
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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Copy a row 12 69
Convert VB6 MSXML2.ServerXMLHTTP process to C# 2 66
How to make an ADE file by code? 11 99
Export PDF Form fields to Access  or Excel  in Tab order 16 110
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question