Sign in to follow this  
Followers 0

Syntax error running a COM object

6 posts in this topic

Posted (edited)

I'm in trouble with this expression

I don't know how It should be written in a autoit script,

in a .vbs I only need this:

Set WshShell = CreateObject(“Wscript.Shell)
WshShell.Run “Rundll32.exe advapi32.dll,ProcessIdleTasks”

and execute as myVBS.vbs $iniread[$j][1]

but in autoit syntax I got the error

what I wrote:

Run($WshShell.run & " " & '"Rundll32.exe advapi32.dll,ProcessIdleTasks"' & " " & $iniread[$j][1]

the error:

The requested action with this object has failed.:

Run($WshShell.run & " " & '"Rundll32.exe advapi32.dll,ProcessIdleTasks"' & " " & $iniread[$j][1])

Run($WshShell.run ^ ERROR

sorry if something like this was already answered ;)

EDIT: I set the $WshShell like this: $WshShell = ObjCreate("Wscript.Shell")

Edited by DiOgO

Share this post


Link to post
Share on other sites



Posted

in this way don't give me a error but stays without working

$WshShell.run ("Rundll32.exe advapi32.dll,ProcessIdleTasks" & $iniread[$j][1])

Share this post


Link to post
Share on other sites

Posted

First, why are you using WshShell.Run instead of just using Run? Second, did you create the object for WshShell in your script?

Share this post


Link to post
Share on other sites

Posted

First, why are you using WshShell.Run instead of just using Run? Second, did you create the object for WshShell in your script?

using the run would be something like: Run($WshShell "Rundll32.exe advapi32.dll,ProcessIdleTasks")?

I added the object in the topic EDIT...

Share this post


Link to post
Share on other sites

Posted

No, using run would be something like Run("C:\Windows\System32\rundll32.exe" & " advapi32.dll,ProcessIdleTasks").

If you wanted to directly convert that VBScript to AutoIt, you would do this.

Global $WshShell = ObjCreate("Wscript.Shell")
$WshShell.Run("Rundll32.exe advapi32.dll,ProcessIdleTasks")

Share this post


Link to post
Share on other sites

Posted

No, using run would be something like Run("C:\Windows\System32\rundll32.exe" & " advapi32.dll,ProcessIdleTasks").

If you wanted to directly convert that VBScript to AutoIt, you would do this.

Global $WshShell = ObjCreate("Wscript.Shell")
$WshShell.Run("Rundll32.exe advapi32.dll,ProcessIdleTasks")

from what I read here: http://social.technet.microsoft.com/Forums/en-US/mscomops/thread/83e1d0cb-ca82-4703-afe0-9b23d97d3df6

I was doing wrong the dll execution, 1st run the dll, after the software we want

thanks for the tips ;)

Share this post


Link to post
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
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.