Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Syntax error running a COM object


  • Please log in to reply
5 replies to this topic

#1 DiOgO

DiOgO

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 331 posts

Posted 14 May 2012 - 05:28 PM

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, 14 May 2012 - 05:29 PM.

Heroes, there is no such thing








#2 DiOgO

DiOgO

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 331 posts

Posted 14 May 2012 - 05:55 PM

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

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

Heroes, there is no such thing


#3 BrewManNH

BrewManNH

    באָבקעס מיט קודוצ׳ה

  • MVPs
  • 10,012 posts

Posted 14 May 2012 - 06:37 PM

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

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to an XP machine, and I'm not going to.

 

Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude

 

How to ask questions the smart way!

 

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.
Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.
_FileGetProperty - Retrieve the properties of a file SciTE Toolbar - A toolbar demo for use with the SciTE editorGUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.
GUIToolTip UDF Demo - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips. Latin Square password generator

 

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.


#4 DiOgO

DiOgO

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 331 posts

Posted 14 May 2012 - 10:41 PM

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

Heroes, there is no such thing


#5 BrewManNH

BrewManNH

    באָבקעס מיט קודוצ׳ה

  • MVPs
  • 10,012 posts

Posted 14 May 2012 - 10:51 PM

No, using run would be something like Run("C:WindowsSystem32rundll32.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")

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to an XP machine, and I'm not going to.

 

Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude

 

How to ask questions the smart way!

 

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.
Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.
_FileGetProperty - Retrieve the properties of a file SciTE Toolbar - A toolbar demo for use with the SciTE editorGUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.
GUIToolTip UDF Demo - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips. Latin Square password generator

 

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.


#6 DiOgO

DiOgO

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 331 posts

Posted 15 May 2012 - 09:08 PM

No, using run would be something like Run("C:WindowsSystem32rundll32.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 ;)

Heroes, there is no such thing





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users