Jump to content

Launch a VBScript from AutoIt


zeno
 Share

Recommended Posts

Hi........

I'm working on launching a VBScript from within an AutoIT file. This is b/c Vbs doesn't have a blockinput function I can use.

Therefore what I'm trying to do is have an AutoIT file do the inputblock for me and then within the autoIT call the vbscript that does some other things for me. However I can't seem to get it to work....

My actual script is as below

BlockInput(1)

run("c:\temp\testscript.vbs", "", @SW_HIDE)

But it doesn't seem to work.... whats the actual proper way of launching a vbs from an autoIT script.....

Please help.....

Zeno

Link to comment
Share on other sites

you have 2 methods for working with VBS, the first is by:

1.

run(@Comspec & " /c cscript.exe c:\temp\testscript.vbs", "", @SW_HIDE)

2. you can download the latest beta & run vbscript from within Autoit

look into the COM objects

option 1 should get you out of trouble but option 2 maybe the way to go in the future

Link to comment
Share on other sites

Thanks for the reply........ that did the job.........

However another thing.........how can I blockinput() while the vbs script is running. B/c I'm actually using VBS to install some software and I would like to disable input during that time hence the reason I'm calling a vbs from within autoit.

The code I use now is

SplashTextOn("Blocking keys")

Blockinput(1)

run(@Comspec & " /c cscript.exe c:\script.vbs", "", @SW_HIDE)

SplashOff()

Blockinput(0)

Can this be done..........?

Cheers

Link to comment
Share on other sites

you have 2 methods for working with VBS, the first is by:

1.

run(@Comspec & " /c cscript.exe c:\temp\testscript.vbs", "", @SW_HIDE)

2. you can download the latest beta & run vbscript from within Autoit

look into the COM objects

option 1 should get you out of trouble but option 2 maybe the way to go in the future

3. Windows Scripting Host.

RunWait('wscript.exe "c:\temp\testscript.vbs"')
Edited by MHz
Link to comment
Share on other sites

One more question......

How do I include spaces for the path..... b/c i have this script residing here

C:\Program Files\Common Files\PWC\Wiz-Kit\Installscripts

and it doesn't seem to be executing properly.....with the following command

runwait(@Comspec & " /c cscript.exe C:\Program Files\Common Files\PWC\Wiz-Kit\Installscripts\ToolbxCleanup.vbs", "", @SW_HIDE)

I tried placing " " within the path but that didn't seem to work.........

Thanks.....

Link to comment
Share on other sites

If you wrap an AutoIt string in single quotes, you can then use double quotes within it:

runWait(@comSpec & ' /c cscript.exe "C:\Program Files\Common Files\PWC\Wiz-Kit\Installscripts\ToolbxCleanup.vbs"', '', @SW_HIDE)
Link to comment
Share on other sites

  • 4 years later...

If you wrap an AutoIt string in single quotes, you can then use double quotes within it:

runWait(@comSpec & ' /c cscript.exe "C:\Program Files\Common Files\PWC\Wiz-Kit\Installscripts\ToolbxCleanup.vbs"', '', @SW_HIDE)

I am trying to use the code given here to call a vbs script that I am working with. It calls the vbs script just fine, but I need to be using a RunAs so the vbs script is being run as an administrator. As soon as I add RunAs, the script stops working.

Can you help?

Link to comment
Share on other sites

Hi........

I'm working on launching a VBScript from within an AutoIT file. This is b/c Vbs doesn't have a blockinput function I can use.

Therefore what I'm trying to do is have an AutoIT file do the inputblock for me and then within the autoIT call the vbscript that does some other things for me. However I can't seem to get it to work....

My actual script is as below

BlockInput(1)

run("c:\temp\testscript.vbs", "", @SW_HIDE)

But it doesn't seem to work.... whats the actual proper way of launching a vbs from an autoIT script.....

Please help.....

Zeno

...\AutoIt3\AutoItX\ActiveX\VBScript

ShellExecute("calculator.vbs")

Edited by wolf9228

صرح السماء كان هنا

 

Link to comment
Share on other sites

If you use AutoItX, which is an ActiveX version of AutoIt then you can call the BlockInput from within the VBS. all you have to do is create the AutoItX as an object.

For an explicit example see the last post on this page, by our old buddy torgeir

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

I am trying to use the code given here to call a vbs script that I am working with. It calls the vbs script just fine, but I need to be using a RunAs so the vbs script is being run as an administrator. As soon as I add RunAs, the script stops working.

Can you help?

Hi and Welcome to the forums!

We are not mind-readers. Show some code of we can't do anything.

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...