Jump to content

Recommended Posts

Posted

Hi!

Could anyone help me out with converting simple vbs script to au3 script.

Here is the vbs script content:

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

Const ALL_USERS = True

Set objService = GetObject("winmgmts:")

Set objSoftware = objService.Get("Win32_Product")

errReturn = objSoftware.Install("C:\SomeApplication.msi", , ALL_USERS)

MsgBox "Done"

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

Here is my attempt to convert it to AutoIt:

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

Const $ALL_USERS = 1

$objService = ObjGet("winmgmts:")

$objSoftware = $objService.Get("Win32_Product")

$errReturn = $objSoftware.Install("C:\SomeApplication.msi", , $ALL_USERS)

MsgBox(0,"","Done")

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

This au3 script gives me an error.

I also used VBS2AutoIt_Converter to try to find my error, but VBS2AutoIt_Converter does pretty much what I did, so I could not detect the error.

If, however, I replace

$errReturn = $objSoftware.Install("C:\SomeApplication.msi", , $ALL_USERS)

with

$errReturn = $objSoftware.Install("C:\SomeApplication.msi")

it does work, but I would like to be able to keep ALL_USERS option. Anyone could help me find out what is wrong in line and how to correct it?

$errReturn = $objSoftware.Install("C:\SomeApplication.msi", , $ALL_USERS)

Thanks in advance,

Strah

Posted

You may be able to get better replies in the AutoItX / COM / DLLs forum instead of the General Support forum.

Sorry, but I do not know about AutoItX that much :shocked:

[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Posted

seems complicated for using an msi

why not something simple like

Run(@SystemDir & "\msiexec.exe /i C:\SomeApplication.msi /qb")

Thanks gafrost. This works and is nice way of doing it. Can you do installation completely without any interface this way though? With winmgmts services you can do installation with no dialog boxes whatsoever, and its seems tremendously shorter as compared with any other approach. Thanks again,

Strah

Posted

Thanks gafrost. This works and is nice way of doing it. Can you do installation completely without any interface this way though? With winmgmts services you can do installation with no dialog boxes whatsoever, and its seems tremendously shorter as compared with any other approach. Thanks again,

Strah

change /qb to /qn

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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
  • Recently Browsing   0 members

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