Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

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

VbScript and the Shell object

I am working in VBScript and need to open a separate application and load a .dat file into it.  

The following code allows me to open the application:
               Sub CallLogPlot
            Dim appShell
            Set appShell = CreateObject("WScript.Shell")
            Call appShell.Run("C:\Progra~1\LogPlo~1\LP2003.exe", 1, True)
            Set appShell = Nothing
               End Sub

I need to open the file now.  It  can be opened using command line:

              "For example, to start up LogPlot and load the data file named "project_a.dat", you would use
               the following command line:

               Logplot2003.exe c:\data\project_a\project_a.dat"

I don't know how to run the command prompt programmatically and add this line.  What is the best way to accomplish this task?

Thanks in advance,
Sarah
0
sarahjackel
Asked:
sarahjackel
1 Solution
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
You can put the filename right into the Run() command then:

    Sub CallLogPlot
          Dim appShell
          Set appShell = CreateObject("WScript.Shell")
          Call appShell.Run("C:\Progra~1\LogPlo~1\LP2003.exe c:\data\project_a\project_a.dat", 1, True)
          Set appShell = Nothing
    End Sub

You may have to convert your filename into a short one as you have done with LP2003.exe or you may have to enclose the filename in quotes.

~IM
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

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