Solved

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

Posted on 2004-09-14
7
146 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
Comment Utility
How large are the instructions? Could the text be incorporated in the MsgBox question?
0
 
LVL 4

Expert Comment

by:learning_t0_pr0gram
Comment Utility
I suggest creating a form with a Textbox with the instructions in them
0
 

Author Comment

by:murryc
Comment Utility
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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 3

Expert Comment

by:aParser
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
domj, perfect solution..exactly what I needed.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now