Jump to content

Launch A .vbs File From Autoit?


Recommended Posts

Dear dudes and dudettes of much esteam,

what am I missing?

I've tried it two ways:

Run("\\server\share\file.Vbs")
RunWait(@ComSpec & " /c " & "\\server\share\file.Vbs")

neither one works, though it seems as though either of them should...

it seemed that I should be able to make it work by running

RunWait(@ComSpec & " /c " & "cscript.exe \\server\share\file.Vbs")

then I figured it out. and since I've already typed all this, I'm going to post it.

RunWait(@ComSpec & " /c " & 'cscript.exe "\\server\share\file.Vbs"')

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

It's Windows 2000, and there's a space in the file path, so that needs to be in quotes... and I'm getting an invalid directory error...

Run(@ComSpec & ' /s start "" "\\server\share\dir name\file.Vbs"')

(wouldn't I want this to be RunWait?

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

start /w "" "\\server\share\dir folder\file.vbs"
works from the command prompt, but
RunWait(@ComSpec & '/s start /w "" "\\server\share\dir folder\file.vbs"')
doesn't work from autoit.

Error message

---------------------------
AutoIt Error
---------------------------
Line 42  (File "\\spseprt1\windist\ITProcedures\autoit\cgp_install_src\Install CGP for DR.au3"):

RunWait(@ComSpec & '/s start /w "" "\\spseprt1\windist\ITProcedures\Application Setups\ETS Gas Install\CGP6.1.14\GMS.Vbs"')

Error: Unable to execute the external program.

The system cannot find the path specified.


---------------------------
OK   
---------------------------
Edited by emmanuel

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

but it is having a problem finding @comspec I imagine. This seems weird...

Not too much Lar. It happens often in W9x systems upgraded to W2000, the SO still rember the %comspec% value as Win98 did (command.com) instead of the new cmd.exe
Link to comment
Share on other sites

from the command prompt %comspec% finds cmd.com like it should.

I ran the whole %comspec% /c start /w "\\server\share\file.vbs" from the command prompt and it works... still doesn't work with the .au3 script.

once more, here's the code in my script

RunWait(@ComSpec & '/c start /w "" "\\server\share\folder\file.Vbs"')

which works from cmd prompt, but not the script...... :D

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

:D

---------------------------

AutoIt Error

---------------------------

Line 40 (File "\\spseprt1\windist\ITProcedures\autoit\cgp_install_src\Install CGP for DR.au3"):

RunWait(@ComSpec & " /c start /w " & '"\\spseprt1\windist\ITProcedures\Application Setups\ETS Gas Install\CGP6.1.14\GMS.Vbs"')

Error: Unable to execute the external program.

The directory name is invalid.

---------------------------

OK

---------------------------

I don't get it. the directory is valid, I can paste that same line into a run or do it from cmd and it works.

:iamstupid:

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

Try

RunWait(@ComSpec & " /c start /w "" "\\spseprt1\windist\ITProcedures\Application Setups\ETS Gas Install\CGP6.1.14\GMS.Vbs"','')

negatory

---------------------------

AutoIt Error

---------------------------

Line 41 (File "\\spseprt1\windist\ITProcedures\autoit\cgp_install_src\Install CGP for DR.au3"):

RunWait(@ComSpec & " /c start /w "" "\\spseprt1\windist\ITProcedures\Application Setups\ETS Gas Install\CGP6.1.14\GMS.Vbs"','')

RunWait(@ComSpec & " /c start /w "" "^ ERROR

Error: Unable to parse line.

---------------------------

OK

---------------------------

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

what happens with this?

RunWait(@ComSpec & " /c ")

Lar.

add pieces of the string and see what happens...

Lar.

RunWait(@ComSpec & " /c ")

got me a quick flash of a dos window.

RunWait(@ComSpec & " /c start ")

gets me the invalid path error.

:D

where is start located? Should I try putting in a full path to it? (using vars of course)

thank you Lar.

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

got same path not found error with your comspec line, so tried set of code, that got this error.

---------------------------

AutoIt Error

---------------------------

Line 45 (File "\\spseprt1\windist\ITProcedures\autoit\cgp_install_src\Install CGP for DR.au3"):

RunWait($run & ' "\\spseprt1\windist\ITProcedures\Application Setups\ETS Gas Install\CGP6.1.14\GMS.Vbs"')

Error: Unable to execute the external program.

The system cannot find the file specified.

---------------------------

OK

---------------------------

I went and checked the value of that key in the reg and it's:

%SystemRoot%\System32\WScript.exe "%1" %*

so, if I'm trying to figure out what the line of code starting "If StringInStr(" does, but I'm not sure if I'm getting it. Is it just removing any possible spaces from the begining of the $run value?

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

ahhh... I was confused by what the helpfile says about what stringleft does, or perhaps it's just the way that I'm not familiar with the more intricate methods of doing what you do... anyways, I put in a msgbox to make sure that $run is as it should be before going to the command. and still having this problem popup.

---------------------------

AutoIt Error

---------------------------

Line 46 (File "\\spseprt1\windist\ITProcedures\autoit\cgp_install_src\Install CGP for DR.au3"):

RunWait($run & ' "\\spseprt1\windist\ITProcedures\Application Setups\ETS Gas Install\CGP6.1.14\GMS.Vbs"')

Error: Unable to execute the external program.

The system cannot find the file specified.

---------------------------

OK

---------------------------

for grins, I've copied gms.vbs to c:\ to test my "long files with spaces suck" theory that's developing...

:twitch:

still happens

---------------------------

AutoIt Error

---------------------------

Line 46 (File "\\spseprt1\windist\ITProcedures\autoit\cgp_install_src\Install CGP for DR.au3"):

RunWait($run & ' "c:\GMS.Vbs"')

Error: Unable to execute the external program.

The system cannot find the file specified.

---------------------------

OK

---------------------------

and with only RunWait($run)

---------------------------

AutoIt Error

---------------------------

Line 46 (File "\\spseprt1\windist\ITProcedures\autoit\cgp_install_src\Install CGP for DR.au3"):

RunWait($run)

Error: Unable to execute the external program.

The system cannot find the file specified.

---------------------------

OK

---------------------------

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

  • Administrators

I am missing the problem here :huh2: When I run a vbs file I just do:

RunWait('cscript.exe "c:\long file\name\script.vbs"')

(notice the use of single and double quotes)

And that's it. Or I use wscript.exe instead of cscript.

:D

Link to comment
Share on other sites

I am missing the problem here  :huh2:  When I run a vbs file I just do:

RunWait('cscript.exe "c:\long file\name\script.vbs"')

(notice the use of single and double quotes)

And that's it.  Or I use wscript.exe instead of cscript.

:D

Jon, thanks.

I didn't know about cscript.exe/wscript.exe

I was using Comspec. I've now replaced it with cscript.exe and it works great here.

Lilla

Link to comment
Share on other sites

ok, that was the long way around... don't know why it was I thought that wasn't the best way to do it, but it works, so don't mess with it, right?

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...