As titled. If yes, how can it be done?
If no, any other way to fulfil this situation?

Thanks a lot.

Re: Can a vbscript run first before opening an application (e.g. IE, Winword)? by Rick

Rick
Wed Jun 22 00:02:29 CDT 2005

Yes, easily.

You could change the target line in a shortcut to point to a VBS script and
change the icon assigned to the shortcut so it's the same as the original,
e.g. IE, Winword.

An example of a script which calls the run method using parameters follows:

--- Copy the following and paste into notepad, save as 'example.vbs' ----
Option Explicit

'Setup environment
Dim WSH ' To use Windows Scripting Host
Dim ProgName, Params

'Setup scripting environment
Set WSH = Wscript.CreateObject("WScript.Shell")

'Set the name of the program you want to run.
ProgName = "C:\Temp\aup.exe"
Params = "C:\Temp\aupscript.spt"

' Run the program with its parameters (including a space between the two)
WSH.Run ProgName & " " & Params

Set WSH = Nothing
Wscript.Quit()


"david" <davi@gmail.com> wrote in message
news:uozEjOudFHA.2212@TK2MSFTNGP14.phx.gbl...
> As titled. If yes, how can it be done?
> If no, any other way to fulfil this situation?
>
> Thanks a lot.
>
>



Re: Can a vbscript run first before opening an application (e.g. IE, Winword)? by david

david
Wed Jun 22 01:25:26 CDT 2005

Thanks a lot~
I am newbie of vbscript....I would like to know what is the used for the
"Params" below?

"Rick Corbett" <rick_corbett@blueyonder.co.uk> wrote in message
news:%23z0NdeudFHA.3880@tk2msftngp13.phx.gbl...
> Yes, easily.
>
> You could change the target line in a shortcut to point to a VBS script
and
> change the icon assigned to the shortcut so it's the same as the original,
> e.g. IE, Winword.
>
> An example of a script which calls the run method using parameters
follows:
>
> --- Copy the following and paste into notepad, save as 'example.vbs' ----
> Option Explicit
>
> 'Setup environment
> Dim WSH ' To use Windows Scripting Host
> Dim ProgName, Params
>
> 'Setup scripting environment
> Set WSH = Wscript.CreateObject("WScript.Shell")
>
> 'Set the name of the program you want to run.
> ProgName = "C:\Temp\aup.exe"
> Params = "C:\Temp\aupscript.spt"
>
> ' Run the program with its parameters (including a space between the two)
> WSH.Run ProgName & " " & Params
>
> Set WSH = Nothing
> Wscript.Quit()




Re: Can a vbscript run first before opening an application (e.g. IE, Winword)? by Rick

Rick
Sat Jun 25 05:29:47 CDT 2005

If you want to run a program like MS Word then you can just use something
like:

ProgName = "C:\Program Files\Microsoft Office\Office\Winword.exe"
WSH.Run ProgName

However, sometimes you want to run a program with startup switches. An
example would be if you wanted to run MS Word 2000 with the '/q' switch to
suppress the splash screen. The '/q' is a parameter that you want to add to
the RUN command. In this example you would change the script to:

ProgName = "C:\Program Files\Microsoft Office\Office\Winword.exe"
Params = "/q"
WSH.Run ProgName & " " & Params

You could write the script differently so Progname and Params wasn't used
but I keep it like this so I can just re-use the code quickly by just
changing the values for these 2 variables.

Hope this helps...

"david" <davi@gmail.com> wrote in message
news:uzXUvMvdFHA.3048@TK2MSFTNGP12.phx.gbl...
> Thanks a lot~
> I am newbie of vbscript....I would like to know what is the used for the
> "Params" below?
>
> "Rick Corbett" <rick_corbett@blueyonder.co.uk> wrote in message
> news:%23z0NdeudFHA.3880@tk2msftngp13.phx.gbl...
> > Yes, easily.
> >
> > You could change the target line in a shortcut to point to a VBS script
> and
> > change the icon assigned to the shortcut so it's the same as the
original,
> > e.g. IE, Winword.
> >
> > An example of a script which calls the run method using parameters
> follows:
> >
> > --- Copy the following and paste into notepad, save as
'example.vbs' ----
> > Option Explicit
> >
> > 'Setup environment
> > Dim WSH ' To use Windows Scripting Host
> > Dim ProgName, Params
> >
> > 'Setup scripting environment
> > Set WSH = Wscript.CreateObject("WScript.Shell")
> >
> > 'Set the name of the program you want to run.
> > ProgName = "C:\Temp\aup.exe"
> > Params = "C:\Temp\aupscript.spt"
> >
> > ' Run the program with its parameters (including a space between the
two)
> > WSH.Run ProgName & " " & Params
> >
> > Set WSH = Nothing
> > Wscript.Quit()
>
>
>



Re: Can a vbscript run first before opening an application (e.g. IE, Winword)? by Rick

Rick
Sat Jun 25 05:39:15 CDT 2005

Oops... I should have mentioned that file paths that include spaces can be a
problem. It's probably best to write:

ProgName = "C:\Program Files\Microsoft Office\Office\Winword.exe"

using the short name equivalent:

ProgName = "C:\Progra~1\Micros~1\Office\Winword.exe"

"Rick Corbett" <rick_corbett@blueyonder.co.uk> wrote in message
news:%23MWwRDXeFHA.3616@TK2MSFTNGP09.phx.gbl...
> If you want to run a program like MS Word then you can just use something
> like:
>
> ProgName = "C:\Program Files\Microsoft Office\Office\Winword.exe"
> WSH.Run ProgName
>
> However, sometimes you want to run a program with startup switches. An
> example would be if you wanted to run MS Word 2000 with the '/q' switch to
> suppress the splash screen. The '/q' is a parameter that you want to add
to
> the RUN command. In this example you would change the script to:
>
> ProgName = "C:\Program Files\Microsoft Office\Office\Winword.exe"
> Params = "/q"
> WSH.Run ProgName & " " & Params
>
> You could write the script differently so Progname and Params wasn't used
> but I keep it like this so I can just re-use the code quickly by just
> changing the values for these 2 variables.
>
> Hope this helps...
>
> "david" <davi@gmail.com> wrote in message
> news:uzXUvMvdFHA.3048@TK2MSFTNGP12.phx.gbl...
> > Thanks a lot~
> > I am newbie of vbscript....I would like to know what is the used for
the
> > "Params" below?
> >
> > "Rick Corbett" <rick_corbett@blueyonder.co.uk> wrote in message
> > news:%23z0NdeudFHA.3880@tk2msftngp13.phx.gbl...
> > > Yes, easily.
> > >
> > > You could change the target line in a shortcut to point to a VBS
script
> > and
> > > change the icon assigned to the shortcut so it's the same as the
> original,
> > > e.g. IE, Winword.
> > >
> > > An example of a script which calls the run method using parameters
> > follows:
> > >
> > > --- Copy the following and paste into notepad, save as
> 'example.vbs' ----
> > > Option Explicit
> > >
> > > 'Setup environment
> > > Dim WSH ' To use Windows Scripting Host
> > > Dim ProgName, Params
> > >
> > > 'Setup scripting environment
> > > Set WSH = Wscript.CreateObject("WScript.Shell")
> > >
> > > 'Set the name of the program you want to run.
> > > ProgName = "C:\Temp\aup.exe"
> > > Params = "C:\Temp\aupscript.spt"
> > >
> > > ' Run the program with its parameters (including a space between the
> two)
> > > WSH.Run ProgName & " " & Params
> > >
> > > Set WSH = Nothing
> > > Wscript.Quit()
> >
> >
> >
>
>



Re: Can a vbscript run first before opening an application (e.g. IE, Winword)? by david

david
Mon Jun 27 01:45:02 CDT 2005

oh~~ thz a lot :)
"Rick Corbett" <rick_corbett@blueyonder.co.uk> wrote in message
news:eDZHkIXeFHA.412@tk2msftngp13.phx.gbl...
> Oops... I should have mentioned that file paths that include spaces can be
a
> problem. It's probably best to write:
>
> ProgName = "C:\Program Files\Microsoft Office\Office\Winword.exe"
>
> using the short name equivalent:
>
> ProgName = "C:\Progra~1\Micros~1\Office\Winword.exe"
>
> "Rick Corbett" <rick_corbett@blueyonder.co.uk> wrote in message
> news:%23MWwRDXeFHA.3616@TK2MSFTNGP09.phx.gbl...
> > If you want to run a program like MS Word then you can just use
something
> > like:
> >
> > ProgName = "C:\Program Files\Microsoft Office\Office\Winword.exe"
> > WSH.Run ProgName
> >
> > However, sometimes you want to run a program with startup switches. An
> > example would be if you wanted to run MS Word 2000 with the '/q' switch
to
> > suppress the splash screen. The '/q' is a parameter that you want to add
> to
> > the RUN command. In this example you would change the script to:
> >
> > ProgName = "C:\Program Files\Microsoft Office\Office\Winword.exe"
> > Params = "/q"
> > WSH.Run ProgName & " " & Params
> >
> > You could write the script differently so Progname and Params wasn't
used
> > but I keep it like this so I can just re-use the code quickly by just
> > changing the values for these 2 variables.
> >
> > Hope this helps...
> >
> > "david" <davi@gmail.com> wrote in message
> > news:uzXUvMvdFHA.3048@TK2MSFTNGP12.phx.gbl...
> > > Thanks a lot~
> > > I am newbie of vbscript....I would like to know what is the used for
> the
> > > "Params" below?
> > >
> > > "Rick Corbett" <rick_corbett@blueyonder.co.uk> wrote in message
> > > news:%23z0NdeudFHA.3880@tk2msftngp13.phx.gbl...
> > > > Yes, easily.
> > > >
> > > > You could change the target line in a shortcut to point to a VBS
> script
> > > and
> > > > change the icon assigned to the shortcut so it's the same as the
> > original,
> > > > e.g. IE, Winword.
> > > >
> > > > An example of a script which calls the run method using parameters
> > > follows:
> > > >
> > > > --- Copy the following and paste into notepad, save as
> > 'example.vbs' ----
> > > > Option Explicit
> > > >
> > > > 'Setup environment
> > > > Dim WSH ' To use Windows Scripting Host
> > > > Dim ProgName, Params
> > > >
> > > > 'Setup scripting environment
> > > > Set WSH = Wscript.CreateObject("WScript.Shell")
> > > >
> > > > 'Set the name of the program you want to run.
> > > > ProgName = "C:\Temp\aup.exe"
> > > > Params = "C:\Temp\aupscript.spt"
> > > >
> > > > ' Run the program with its parameters (including a space between the
> > two)
> > > > WSH.Run ProgName & " " & Params
> > > >
> > > > Set WSH = Nothing
> > > > Wscript.Quit()
> > >
> > >
> > >
> >
> >
>
>