Solved

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

Posted on 2004-09-14
7
153 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
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

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
Suggested Courses
Course of the Month4 days, 18 hours left to enroll

635 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