Sign in to follow this  
Followers 0
Prozac

Help rewriting VBA COM to AU3

4 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
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?

Share this post


Link to post
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..


Share this post


Link to post
Share on other sites

Thanks a lot for the help.

It really got me helped :)

Regards

Martin

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