Solved

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

Posted on 2004-09-14
7
149 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
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

803 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