Jump to content

Help rewriting VBA COM to AU3


Prozac
 Share

Recommended Posts

Hi,

I hope some one can show me how this vba code will look like in au3.

CODE
Set objPropertyReader = CreateObject("DSOleFile.PropertyReader")

Set objDocument = objPropertyReader.GetDocumentProperties _

("C:\Scripts\Test.doc")

Set colCustomProperties = objdocument.CustomProperties

For Each strProperty in colCustomProperties

If strProperty.Name = "TestProperty" Then

strProperty.Value = "New value"

End If

Next

Im trying to find out how to use dsofile.dll COM Object inside a AU3 script. But COM is not my strong side.. Actually I have never used it :shocked:

Regards Martin

Edited by Prozac
Link to comment
Share on other sites

$objPropertyReader = CreateObject("DSOleFile.PropertyReader")
$objDocument = $objPropertyReader.GetDocumentProperties("C:\Scripts\Test.doc")
$colCustomProperties = $objdocument.CustomProperties

For $strProperty in $colCustomProperties
    If $strProperty.Name = "TestProperty" Then
        $strProperty.Value = "New value"
    EndIf
Next

Very similar, isn't?

Link to comment
Share on other sites

just the createobject should be objcreate

the rules for conversion are soooo simple...

1) variables in vb-code dont get a dollar, autoIT variables ALLWAYS get dollars (thats easier)

2) functions like createobject, getobject, are written differently, refer to help files for the correct name

3) vb code uses different comments, in vbscript a single quote is a comment, a double quote is a string.. autoIT doesnt care, both are strings,..

well thats about it..

for the rest I suggest you use the color coding to help you spot mistakes in your code..

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