Jump to content
Sign in to follow this  
MrJustinMeyer

COM OBJECT - Translating C# METHOD Ref to AU3

Recommended Posts

I noticed that you reassign "ERROR" to $rValue every iteration.  I think that "ERROR" is assigned and then this evaluates to False: If $ALL_OBJECTS.Current.Name() = "BEAM" Then.  This will overwrite $rValue.  Try moving $rValue out of the loop.

Edited by jaberwocky6669

Share this post


Link to post
Share on other sites

I noticed that you reassign "ERROR" to $rValue every iteration.  I think that "ERROR" is assigned and then this evaluates to False: If $ALL_OBJECTS.Current.Name() = "BEAM" Then.  This will overwrite $rValue.  Try moving $rValue out of the loop.

 

Moved the $R_VALUE outside the loop, also tried giving it an empty string (= "") and the result is whatever I define the variable to be. The method does not supply the the queried information.

Current code below, also attached all msgbox photos in order of appearance.

#AutoIt3Wrapper_UseX64=n

Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc")

 $TSMm = ObjCreate("Tekla.Structures.Model.Model")
If @error Then
    MsgBox(1,"ERROR", "Tekla.Structures.Model.Model" & @CRLF & "Could not connect to Tekla, verify and rerun")
    Exit
EndIf

Sleep(1000)

If Not $TSMm.GetConnectionStatus() = "True" Then
    MsgBox(0, "Error", "Tekla Connection Failure")
    Exit
EndIf

$ALL_OBJECTS = $TSMm.GetModelObjectSelector().GetAllObjectsWithType(1) ;TYPE 1 = BEAM MODELOBJECTCLASS
If @error Then
    MsgBox(1,"ERROR", "Tekla.Structures.Model.Model" & @CRLF & "ObjectSelector")
    Exit
EndIf

MsgBox(0, "", "Object Interface Name: " & ObjName($ALL_OBJECTS, 1) & @CRLF & _
        "Object Description:    " & ObjName($ALL_OBJECTS, 2) & @CRLF & _
        "Object ProgID:      " & ObjName($ALL_OBJECTS, 3) & @CRLF & _
        "File Associated with Object:         " & ObjName($ALL_OBJECTS, 4) & @CRLF & _
        "Object Module Name:     " & ObjName($ALL_OBJECTS, 5) & @CRLF & _
        "CLSID:     " & ObjName($ALL_OBJECTS, 6) & @CRLF & _
        "IID of Objects Interface:        " & ObjName($ALL_OBJECTS, 7))

$COUNT = 0
$DATA = "DATA:"
Global $R_VALUE = "ERROR" ;Defined to show change from method below
While $ALL_OBJECTS.MoveNext()

    If $ALL_OBJECTS.Current.Name() = "BEAM" Then ;Only Objects with BEAM name - Works

        $PROP_REPORT = $ALL_OBJECTS.Current.GetReportProperty("PROFILE", $R_VALUE)
        $DATA = $DATA & @CRLF & "PROFILE = " & $PROP_REPORT & " VALUE = " & $R_VALUE
        ;$PROP_REPORT returns true unless first string is not found, $R_VALUE is not modified
        ;$DATA result is PROFILE = TRUE and VALUE = ERROR

    EndIf

    $COUNT = $COUNT + 1

WEnd

MsgBox(0, "OBJECT COUNT", $COUNT)
MsgBox(0, "DATA", $DATA)

Func _ErrFunc($oError)
    msgBox(0, "COM Error", "err.number is: " & @TAB & $oError.number & @CRLF & _
            "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
            "err.description is: " & @TAB & $oError.description & @CRLF & _
            "err.source is: " & @TAB & $oError.source & @CRLF & _
            "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
            "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
            "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
            "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
            "err.retcode is: " & @TAB & $oError.retcode)
EndFunc   ;==>_ErrFunc

post-82359-0-31039100-1381435289_thumb.p

post-82359-0-93498000-1381435293_thumb.p

post-82359-0-99996300-1381435297_thumb.p

Share this post


Link to post
Share on other sites
#AutoIt3Wrapper_UseX64=n

Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc")

 $TSMm = ObjCreate("Tekla.Structures.Model.Model")
If @error Then
    MsgBox(1,"ERROR", "Tekla.Structures.Model.Model" & @CRLF & "Could not connect to Tekla, verify and rerun")
    Exit
EndIf

Sleep(1000)

If Not $TSMm.GetConnectionStatus() = "True" Then
    MsgBox(0, "Error", "Tekla Connection Failure")
    Exit
EndIf

$ALL_OBJECTS = $TSMm.GetModelObjectSelector().GetAllObjectsWithType(1) ;TYPE 1 = BEAM MODELOBJECTCLASS
If @error Then
    MsgBox(1,"ERROR", "Tekla.Structures.Model.Model" & @CRLF & "ObjectSelector")
    Exit
EndIf

MsgBox(0, "", "Object Interface Name: " & ObjName($ALL_OBJECTS, 1) & @CRLF & _
        "Object Description:    " & ObjName($ALL_OBJECTS, 2) & @CRLF & _
        "Object ProgID:      " & ObjName($ALL_OBJECTS, 3) & @CRLF & _
        "File Associated with Object:         " & ObjName($ALL_OBJECTS, 4) & @CRLF & _
        "Object Module Name:     " & ObjName($ALL_OBJECTS, 5) & @CRLF & _
        "CLSID:     " & ObjName($ALL_OBJECTS, 6) & @CRLF & _
        "IID of Objects Interface:        " & ObjName($ALL_OBJECTS, 7))

$COUNT = 0
$DATA = "DATA:"

While $ALL_OBJECTS.MoveNext()

    Global $R_VALUE = "ERROR" ;Defined to show change from method below

    If $ALL_OBJECTS.Current.Name() = "BEAM" Then ;Only Objects with BEAM name - Works

        $PROP_REPORT = $ALL_OBJECTS.Current.GetReportProperty_2("PROFILE", $R_VALUE)
        $DATA = $DATA & @CRLF & "PROFILE = " & $PROP_REPORT & " VALUE = " & $R_VALUE
        ;$PROP_REPORT returns true unless first string is not found, $R_VALUE is not modified
        ;$DATA result is PROFILE = TRUE and VALUE = ERROR

    EndIf

    $COUNT = $COUNT + 1

WEnd

MsgBox(0, "OBJECT COUNT", $COUNT)
MsgBox(0, "DATA", $DATA)

Func _ErrFunc($oError)
    msgBox(0, "COM Error", "err.number is: " & @TAB & $oError.number & @CRLF & _
            "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
            "err.description is: " & @TAB & $oError.description & @CRLF & _
            "err.source is: " & @TAB & $oError.source & @CRLF & _
            "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
            "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
            "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
            "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
            "err.retcode is: " & @TAB & $oError.retcode)
EndFunc   ;==>_ErrFunc

Line 39 is:

If $ALL_OBJECTS.Current.Name() = "BEAM" Then

...That's not the line that you said that you have issues with.

Btw, "Name" is property, not method. Try without brackets.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

I am not sure where I may have caused the confusion, but the line I am having trouble with is;

$PROP_REPORT = $ALL_OBJECTS.Current.GetReportProperty("PROFILE", $R_VALUE)

To recap, the $R_VALUE is not getting the "PROFILE" from the current object.

I removed the brackets and the property is compared to the string "BEAM" as you said. Results are the same.

#AutoIt3Wrapper_UseX64=n

Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc")

 $TSMm = ObjCreate("Tekla.Structures.Model.Model")
If @error Then
    MsgBox(1,"ERROR", "Tekla.Structures.Model.Model" & @CRLF & "Could not connect to Tekla, verify and rerun")
    Exit
EndIf

Sleep(1000)

If Not $TSMm.GetConnectionStatus() = "True" Then
    MsgBox(0, "Error", "Tekla Connection Failure")
    Exit
EndIf

$ALL_OBJECTS = $TSMm.GetModelObjectSelector().GetAllObjectsWithType(1) ;TYPE 1 = BEAM MODELOBJECTCLASS
If @error Then
    MsgBox(1,"ERROR", "Tekla.Structures.Model.Model" & @CRLF & "ObjectSelector")
    Exit
EndIf

MsgBox(0, "", "Object Interface Name: " & ObjName($ALL_OBJECTS, 1) & @CRLF & _
        "Object Description:    " & ObjName($ALL_OBJECTS, 2) & @CRLF & _
        "Object ProgID:      " & ObjName($ALL_OBJECTS, 3) & @CRLF & _
        "File Associated with Object:         " & ObjName($ALL_OBJECTS, 4) & @CRLF & _
        "Object Module Name:     " & ObjName($ALL_OBJECTS, 5) & @CRLF & _
        "CLSID:     " & ObjName($ALL_OBJECTS, 6) & @CRLF & _
        "IID of Objects Interface:        " & ObjName($ALL_OBJECTS, 7))

$COUNT = 0
$DATA = "DATA:"
Global $R_VALUE = "ERROR" ;Defined to show change from method below
While $ALL_OBJECTS.MoveNext()

    If $ALL_OBJECTS.Current.Name = "BEAM" Then ;Only Objects with BEAM name - Works

        $PROP_REPORT = $ALL_OBJECTS.Current.GetReportProperty("PROFILE", $R_VALUE)
        $DATA = $DATA & @CRLF & "PROFILE = " & $PROP_REPORT & " VALUE = " & $R_VALUE
        ;$PROP_REPORT returns true unless first string is not found, $R_VALUE is not modified
        ;$DATA result is PROFILE = TRUE and VALUE = ERROR

    EndIf

    $COUNT = $COUNT + 1

WEnd

MsgBox(0, "OBJECT COUNT", $COUNT)
MsgBox(0, "DATA", $DATA)

Func _ErrFunc($oError)
    msgBox(0, "COM Error", "err.number is: " & @TAB & $oError.number & @CRLF & _
            "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
            "err.description is: " & @TAB & $oError.description & @CRLF & _
            "err.source is: " & @TAB & $oError.source & @CRLF & _
            "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
            "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
            "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
            "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
            "err.retcode is: " & @TAB & $oError.retcode)
EndFunc   ;==>_ErrFunc

Share this post


Link to post
Share on other sites

A few interesting developments, yet no solution.

I have made some changes to the code, the primary one being;

Attempting to retrieve "CHECKED_BY" via "GetUserProperty" vs "PROFILE" via "GetReportProperty" for two reasons, (1) I am trying to stick to the example I have in C# (First Post) and, (2) I was able to retrieve "PROFILE" another way (though that was not goal, I need to be able to get specified report poroperties), see code.

What I find very interesting is that $PROP_REPORT returns "True" only if a the "CHECKED_BY" property of a member in the model has been set, otherwise it is "False". See results below.

Unfortunately the $CBY variable is still not updated (with who it was checked by) by the method. FYI this was $R_VALUE in previous posts.

Code;

#AutoIt3Wrapper_UseX64=n

Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc")

$TSMm = ObjCreate("Tekla.Structures.Model.Model")
If @error Then
    MsgBox(1,"ERROR", "Tekla.Structures.Model.Model" & @CRLF & "Could not connect to Tekla, verify and rerun")
    Exit
EndIf

If Not $TSMm.GetConnectionStatus() = "True" Then
    MsgBox(0, "Error", "Tekla Connection Failure")
    Exit
EndIf

$ALL_OBJECTS = $TSMm.GetModelObjectSelector().GetAllObjectsWithType(1) ;TYPE 1 = BEAM MODELOBJECTCLASS
If @error Then
    MsgBox(1,"ERROR", "Tekla.Structures.Model.Model" & @CRLF & "ObjectSelector")
    Exit
EndIf

$COUNT = 0
$DATA = "NAME = BEAM:" & @CRLF

While $ALL_OBJECTS.MoveNext

    $CURRENT = $ALL_OBJECTS.Current
    Global $CBY = "*"

    If $CURRENT.Name = "BEAM" Then

        $PROFILE = $CURRENT.Profile.ProfileString
        $ID = $CURRENT.Identifier.ToString
        $GUID = $TSMm.GetGUIDByIdentifier($CURRENT.Identifier)

        $PROP_REPORT = $CURRENT.GetUserProperty("CHECKED_BY", $CBY)
        $DATA = $DATA & @CRLF & "GUID=" & $GUID & @CRLF & " PROP_REPORT=" & $PROP_REPORT & " CHECKED_BY=" & $CBY
        $DATA = $DATA & @CRLF & " PROFILE=" & $PROFILE

    EndIf

    $COUNT = $COUNT + 1

WEnd

ClipPut($DATA)
MsgBox(0, $COUNT & " OBJECTS", $DATA)

Func _ErrFunc($oError)
    msgBox(0, "COM Error", "err.number is: " & @TAB & $oError.number & @CRLF & _
            "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
            "err.description is: " & @TAB & $oError.description & @CRLF & _
            "err.source is: " & @TAB & $oError.source & @CRLF & _
            "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
            "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
            "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
            "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
            "err.retcode is: " & @TAB & $oError.retcode)
EndFunc   ;==>_ErrFunc

Results;

NAME = BEAM:

GUID=ID5252F41B-0000-41C4-3133-383131363833
 PROP_REPORT=True CHECKED_BY=*
 PROFILE=W12X58
GUID=ID524D5D86-000A-EF17-3133-383038313836
 PROP_REPORT=False CHECKED_BY=*
 PROFILE=W16X40
GUID=ID524D5D86-000A-EF13-3133-383038313836
 PROP_REPORT=True CHECKED_BY=*
 PROFILE=W12X40
GUID=ID524C72CC-0000-0004-3133-383037343138
 PROP_REPORT=False CHECKED_BY=*
 PROFILE=W12X40
GUID=ID524D5D86-0000-0004-3133-383038303139
 PROP_REPORT=False CHECKED_BY=*
 PROFILE=W16X40
GUID=ID524D5D86-000A-EF71-3133-383038313839
 PROP_REPORT=False CHECKED_BY=*
 PROFILE=W12X40
GUID=ID524D5D86-000C-AB8D-3133-383038323031
 PROP_REPORT=False CHECKED_BY=*
 PROFILE=W16X40
GUID=ID524D5D86-000C-EB28-3133-383038323032
 PROP_REPORT=True CHECKED_BY=*
 PROFILE=W16X40
GUID=ID524D5D86-000C-EB20-3133-383038323032
 PROP_REPORT=True CHECKED_BY=*
 PROFILE=W12X40
GUID=ID524D5D86-0002-3B01-3133-383038303838
 PROP_REPORT=False CHECKED_BY=*
 PROFILE=W16X40
GUID=ID524D5D86-0006-B239-3133-383038313137
 PROP_REPORT=False CHECKED_BY=*
 PROFILE=W16X40
GUID=ID524D5D86-0002-3AFD-3133-383038303838
 PROP_REPORT=True CHECKED_BY=*
 PROFILE=W12X40
GUID=ID524D5D86-0002-3B09-3133-383038303838
 PROP_REPORT=False CHECKED_BY=*
 PROFILE=W12X40
GUID=ID524D5D86-000A-EF5F-3133-383038313838
 PROP_REPORT=False CHECKED_BY=*
 PROFILE=W16X40
GUID=ID524D5D86-000C-AB89-3133-383038323031
 PROP_REPORT=False CHECKED_BY=*
 PROFILE=W12X40
GUID=ID524D5D86-0006-7280-3133-383038313135
 PROP_REPORT=True CHECKED_BY=*
 PROFILE=W16X40
GUID=ID524D5D86-0002-3B05-3133-383038303838
 PROP_REPORT=True CHECKED_BY=*
 PROFILE=W16X40
GUID=ID524D5D86-000A-EF85-3133-383038313839
 PROP_REPORT=False CHECKED_BY=*
 PROFILE=W16X40
GUID=ID524D5D86-0000-3F8B-3133-383038303230
 PROP_REPORT=False CHECKED_BY=*
 PROFILE=W16X40
GUID=ID524D5D86-0006-7283-3133-383038313136
 PROP_REPORT=False CHECKED_BY=*
 PROFILE=W12X40
GUID=ID524D5D86-0006-B23D-3133-383038313137
 PROP_REPORT=False CHECKED_BY=*
 PROFILE=W12X40
GUID=ID524D5D86-000C-EB24-3133-383038323032
 PROP_REPORT=True CHECKED_BY=*
 PROFILE=W16X40
GUID=ID5253F579-0000-00E0-3133-383132333436
 PROP_REPORT=False CHECKED_BY=*
 PROFILE=W16X40

Share this post


Link to post
Share on other sites

I am not sure where I may have caused the confusion

That's very simple to answer, you posted the wrong code. I asked of you to post the code that caused the error and you posted some other code which would cause error to be displayed on another line. Don't do that if you want serious help.

So, if you don't mind, could you run this exact code and post the error you get:

#AutoIt3Wrapper_UseX64=n

Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc")

$TSMm = ObjCreate("Tekla.Structures.Model.Model")
If @error Then
    MsgBox(1,"ERROR", "Tekla.Structures.Model.Model" & @CRLF & "Could not connect to Tekla, verify and rerun")
    Exit
EndIf

If Not $TSMm.GetConnectionStatus() = "True" Then
    MsgBox(0, "Error", "Tekla Connection Failure")
    Exit
EndIf

$ALL_OBJECTS = $TSMm.GetModelObjectSelector().GetAllObjectsWithType(1) ;TYPE 1 = BEAM MODELOBJECTCLASS
If @error Then
    MsgBox(1,"ERROR", "Tekla.Structures.Model.Model" & @CRLF & "ObjectSelector")
    Exit
EndIf

$COUNT = 0
$DATA = "NAME = BEAM:" & @CRLF

While $ALL_OBJECTS.MoveNext

    $CURRENT = $ALL_OBJECTS.Current
    Global $CBY = "*"

    If $CURRENT.Name = "BEAM" Then

        $PROFILE = $CURRENT.Profile.ProfileString
        $ID = $CURRENT.Identifier.ToString
        $GUID = $TSMm.GetGUIDByIdentifier($CURRENT.Identifier)

        $PROP_REPORT = $CURRENT.GetUserProperty_2("CHECKED_BY", $CBY)
        $DATA = $DATA & @CRLF & "GUID=" & $GUID & @CRLF & " PROP_REPORT=" & $PROP_REPORT & " CHECKED_BY=" & $CBY
        $DATA = $DATA & @CRLF & " PROFILE=" & $PROFILE

    EndIf

    $COUNT = $COUNT + 1

WEnd

ClipPut($DATA)
MsgBox(0, $COUNT & " OBJECTS", $DATA)

Func _ErrFunc($oError)
    msgBox(0, "COM Error", "err.number is: " & @TAB & $oError.number & @CRLF & _
            "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
            "err.description is: " & @TAB & $oError.description & @CRLF & _
            "err.source is: " & @TAB & $oError.source & @CRLF & _
            "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
            "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
            "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
            "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
            "err.retcode is: " & @TAB & $oError.retcode)
EndFunc   ;==>_ErrFunc

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

That's very simple to answer, you posted the wrong code. I asked of you to post the code that caused the error and you posted some other code which would cause error to be displayed on another line. Don't do that if you want serious help.

So, if you don't mind, could you run this exact code and post the error you get:

#AutoIt3Wrapper_UseX64=n

Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc")

$TSMm = ObjCreate("Tekla.Structures.Model.Model")
If @error Then
    MsgBox(1,"ERROR", "Tekla.Structures.Model.Model" & @CRLF & "Could not connect to Tekla, verify and rerun")
    Exit
EndIf

If Not $TSMm.GetConnectionStatus() = "True" Then
    MsgBox(0, "Error", "Tekla Connection Failure")
    Exit
EndIf

$ALL_OBJECTS = $TSMm.GetModelObjectSelector().GetAllObjectsWithType(1) ;TYPE 1 = BEAM MODELOBJECTCLASS
If @error Then
    MsgBox(1,"ERROR", "Tekla.Structures.Model.Model" & @CRLF & "ObjectSelector")
    Exit
EndIf

$COUNT = 0
$DATA = "NAME = BEAM:" & @CRLF

While $ALL_OBJECTS.MoveNext

    $CURRENT = $ALL_OBJECTS.Current
    Global $CBY = "*"

    If $CURRENT.Name = "BEAM" Then

        $PROFILE = $CURRENT.Profile.ProfileString
        $ID = $CURRENT.Identifier.ToString
        $GUID = $TSMm.GetGUIDByIdentifier($CURRENT.Identifier)

        $PROP_REPORT = $CURRENT.GetUserProperty_2("CHECKED_BY", $CBY)
        $DATA = $DATA & @CRLF & "GUID=" & $GUID & @CRLF & " PROP_REPORT=" & $PROP_REPORT & " CHECKED_BY=" & $CBY
        $DATA = $DATA & @CRLF & " PROFILE=" & $PROFILE

    EndIf

    $COUNT = $COUNT + 1

WEnd

ClipPut($DATA)
MsgBox(0, $COUNT & " OBJECTS", $DATA)

Func _ErrFunc($oError)
    msgBox(0, "COM Error", "err.number is: " & @TAB & $oError.number & @CRLF & _
            "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
            "err.description is: " & @TAB & $oError.description & @CRLF & _
            "err.source is: " & @TAB & $oError.source & @CRLF & _
            "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
            "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
            "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
            "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
            "err.retcode is: " & @TAB & $oError.retcode)
EndFunc   ;==>_ErrFunc

 

The attached image below is the error of the code your quoting.

I understand that you are very involved (and likely busy) so, not only do I want yours and others "serious help", I truly appreciate it. I am trying to come up with a solution myself along with the help of others. I can not and will not just wait for someone else to tell me how to do it. The code will likely change, hourly, but most importantly the question will remain the same until the thread is answered.

post-82359-0-06847400-1381631500_thumb.p

Share this post


Link to post
Share on other sites

Ok thanks. Now run this and post the error and the result:

#AutoIt3Wrapper_UseX64=n

Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc")

$TSMm = ObjCreate("Tekla.Structures.Model.Model")
If @error Then
    MsgBox(1,"ERROR", "Tekla.Structures.Model.Model" & @CRLF & "Could not connect to Tekla, verify and rerun")
    Exit
EndIf

If Not $TSMm.GetConnectionStatus() = "True" Then
    MsgBox(0, "Error", "Tekla Connection Failure")
    Exit
EndIf

$ALL_OBJECTS = $TSMm.GetModelObjectSelector().GetAllObjectsWithType(1) ;TYPE 1 = BEAM MODELOBJECTCLASS
If @error Then
    MsgBox(1,"ERROR", "Tekla.Structures.Model.Model" & @CRLF & "ObjectSelector")
    Exit
EndIf

$COUNT = 0
$DATA = "NAME = BEAM:" & @CRLF

While $ALL_OBJECTS.MoveNext

    $CURRENT = $ALL_OBJECTS.Current
    Global $CBY = "*"

    If $CURRENT.Name = "BEAM" Then

        $PROFILE = $CURRENT.Profile.ProfileString
        $ID = $CURRENT.Identifier.ToString
        $GUID = $TSMm.GetGUIDByIdentifier($CURRENT.Identifier)
    $CURRENT.SetUserProperty("CHECKED_BY", "Something")
        $PROP_REPORT = $CURRENT.GetUserProperty("CHECKED_BY", $CBY)
        $DATA = $DATA & @CRLF & "GUID=" & $GUID & @CRLF & " PROP_REPORT=" & $PROP_REPORT & " CHECKED_BY=" & $CBY
        $DATA = $DATA & @CRLF & " PROFILE=" & $PROFILE

    EndIf

    $COUNT = $COUNT + 1

WEnd

ClipPut($DATA)
MsgBox(0, $COUNT & " OBJECTS", $DATA)

Func _ErrFunc($oError)
    msgBox(0, "COM Error", "err.number is: " & @TAB & $oError.number & @CRLF & _
            "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
            "err.description is: " & @TAB & $oError.description & @CRLF & _
            "err.source is: " & @TAB & $oError.source & @CRLF & _
            "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
            "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
            "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
            "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
            "err.retcode is: " & @TAB & $oError.retcode)
EndFunc   ;==>_ErrFunc

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

Ok thanks. Now run this and post the error and the result:

#AutoIt3Wrapper_UseX64=n

Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc")

$TSMm = ObjCreate("Tekla.Structures.Model.Model")
If @error Then
    MsgBox(1,"ERROR", "Tekla.Structures.Model.Model" & @CRLF & "Could not connect to Tekla, verify and rerun")
    Exit
EndIf

If Not $TSMm.GetConnectionStatus() = "True" Then
    MsgBox(0, "Error", "Tekla Connection Failure")
    Exit
EndIf

$ALL_OBJECTS = $TSMm.GetModelObjectSelector().GetAllObjectsWithType(1) ;TYPE 1 = BEAM MODELOBJECTCLASS
If @error Then
    MsgBox(1,"ERROR", "Tekla.Structures.Model.Model" & @CRLF & "ObjectSelector")
    Exit
EndIf

$COUNT = 0
$DATA = "NAME = BEAM:" & @CRLF

While $ALL_OBJECTS.MoveNext

    $CURRENT = $ALL_OBJECTS.Current
    Global $CBY = "*"

    If $CURRENT.Name = "BEAM" Then

        $PROFILE = $CURRENT.Profile.ProfileString
        $ID = $CURRENT.Identifier.ToString
        $GUID = $TSMm.GetGUIDByIdentifier($CURRENT.Identifier)
    $CURRENT.SetUserProperty("CHECKED_BY", "Something")
        $PROP_REPORT = $CURRENT.GetUserProperty("CHECKED_BY", $CBY)
        $DATA = $DATA & @CRLF & "GUID=" & $GUID & @CRLF & " PROP_REPORT=" & $PROP_REPORT & " CHECKED_BY=" & $CBY
        $DATA = $DATA & @CRLF & " PROFILE=" & $PROFILE

    EndIf

    $COUNT = $COUNT + 1

WEnd

ClipPut($DATA)
MsgBox(0, $COUNT & " OBJECTS", $DATA)

Func _ErrFunc($oError)
    msgBox(0, "COM Error", "err.number is: " & @TAB & $oError.number & @CRLF & _
            "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
            "err.description is: " & @TAB & $oError.description & @CRLF & _
            "err.source is: " & @TAB & $oError.source & @CRLF & _
            "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
            "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
            "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
            "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
            "err.retcode is: " & @TAB & $oError.retcode)
EndFunc   ;==>_ErrFunc

 

No errors, results from $DATA below.

NAME = BEAM:

GUID=ID5253F579-0000-00E0-3133-383132333436
 PROP_REPORT=True CHECKED_BY=*
 PROFILE=W16X40
GUID=ID524D5D86-000C-EB24-3133-383038323032
 PROP_REPORT=True CHECKED_BY=*
 PROFILE=W16X40
GUID=ID524D5D86-0006-B23D-3133-383038313137
 PROP_REPORT=True CHECKED_BY=*
 PROFILE=W12X40
GUID=ID524D5D86-0006-7283-3133-383038313136
 PROP_REPORT=True CHECKED_BY=*
 PROFILE=W12X40
GUID=ID524D5D86-0000-3F8B-3133-383038303230
 PROP_REPORT=True CHECKED_BY=*
 PROFILE=W16X40
GUID=ID524D5D86-000A-EF85-3133-383038313839
 PROP_REPORT=True CHECKED_BY=*
 PROFILE=W16X40
GUID=ID524D5D86-0002-3B05-3133-383038303838
 PROP_REPORT=True CHECKED_BY=*
 PROFILE=W16X40
GUID=ID524D5D86-0006-7280-3133-383038313135
 PROP_REPORT=True CHECKED_BY=*
 PROFILE=W16X40
GUID=ID524D5D86-000C-AB89-3133-383038323031
 PROP_REPORT=True CHECKED_BY=*
 PROFILE=W12X40
GUID=ID524D5D86-000A-EF5F-3133-383038313838
 PROP_REPORT=True CHECKED_BY=*
 PROFILE=W16X40
GUID=ID524D5D86-0002-3B09-3133-383038303838
 PROP_REPORT=True CHECKED_BY=*
 PROFILE=W12X40
GUID=ID524D5D86-0002-3AFD-3133-383038303838
 PROP_REPORT=True CHECKED_BY=*
 PROFILE=W12X40
GUID=ID524D5D86-0006-B239-3133-383038313137
 PROP_REPORT=True CHECKED_BY=*
 PROFILE=W16X40
GUID=ID524D5D86-0002-3B01-3133-383038303838
 PROP_REPORT=True CHECKED_BY=*
 PROFILE=W16X40
GUID=ID524D5D86-000C-EB20-3133-383038323032
 PROP_REPORT=True CHECKED_BY=*
 PROFILE=W12X40
GUID=ID524D5D86-000C-EB28-3133-383038323032
 PROP_REPORT=True CHECKED_BY=*
 PROFILE=W16X40
GUID=ID524D5D86-000C-AB8D-3133-383038323031
 PROP_REPORT=True CHECKED_BY=*
 PROFILE=W16X40
GUID=ID524D5D86-000A-EF71-3133-383038313839
 PROP_REPORT=True CHECKED_BY=*
 PROFILE=W12X40
GUID=ID524D5D86-0000-0004-3133-383038303139
 PROP_REPORT=True CHECKED_BY=*
 PROFILE=W16X40
GUID=ID524C72CC-0000-0004-3133-383037343138
 PROP_REPORT=True CHECKED_BY=*
 PROFILE=W12X40
GUID=ID524D5D86-000A-EF13-3133-383038313836
 PROP_REPORT=True CHECKED_BY=*
 PROFILE=W12X40
GUID=ID524D5D86-000A-EF17-3133-383038313836
 PROP_REPORT=True CHECKED_BY=*
 PROFILE=W16X40
GUID=ID5252F41B-0000-41C4-3133-383131363833
 PROP_REPORT=True CHECKED_BY=*
 PROFILE=W12X58

Share this post


Link to post
Share on other sites

You are trying with latest beta AutoIt, right? You should if you aren't.

If you are using beta AutoIt and it still doesn't work then download version 3.3.9.12 (or older) from here, uninstall current beta and then try with that one.

3.3.9.13 was apparently version with mentioned bad changes. It's not like I don't trust Jon for correctly reverting the changes he did on my code, it's only that I trust him less after he has chosen to make the changes.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

You are trying with latest beta AutoIt, right? You should if you aren't.

If you are using beta AutoIt and it still doesn't work then download version 3.3.9.12 (or older) from here, uninstall current beta and then try with that one.

3.3.9.13 was apparently version with mentioned bad changes. It's not like I don't trust Jon for correctly reverting the changes he did on my code, it's only that I trust him less after he has chosen to make the changes.

 

I am using the latest beta.

I typically do not use an installed version, and just run from my flash drive. But through this ordeal I have tried the installed version, the installed beta, and now 3.3.9.12 version as well.

Share this post


Link to post
Share on other sites

Is there any possibility that I get in touch with that objects myself? Do I need to pay thousands of dollars and have or work for multi-million dollar business or is there anything available for developers?

Btw, yesterday you posted at 04:44 AM and today at 03:33 AM according to my forum time. That's cool :D.

If you post tomorrow at 02:22 AM then what will happen when you hit zeroes? Will the world we know cease to exist? Should we get drunk or something before that? Damn Tekla :cry:


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

 

Is there any possibility that I get in touch with that objects myself?

 

That is questionable...

 

Do I need to pay thousands of dollars and have or work for multi-million dollar business

 

It helps...

 

or is there anything available for developers?

 

If you pay thousands of dollars and have or work for multi-million dollar business...

The API and its documentation are extremely well maintained, and their is a great developer network. Unfortunately you have to be a member of the very expensive "maintenance" club to get access. And even then, if you don't follow the way of C#, no support.

Share this post


Link to post
Share on other sites

Hi

Sorry to dig up an old thread....well its not old old, but it's old enough. But from what I can tell there is not a lot of *new* info on this topic. I am not a developer by any means, but I do come across some interesting finds on the web from time to time.

This may or may not be appropriate for this subject, but I see that it was causing some grief.

Could this be a solution or even of interest to anyone here?

 Get AutoIt reference working in C# http://stackoverflow.com/questions/14644258/get-autoit-reference-working-in-c-sharp

Solution based off this here -> How to use a 32 bit COM object on Windows Server 2008 (works on 2008 R2 but non 2008) http://stackoverflow.com/questions/4043954/how-to-use-a-32-bit-com-object-on-windows-server-2008-works-on-2008-r2-but-non
 

Edit: For the sake of broken links and lost content here:
 

 

Okay the solution was:

  1. Open up regedit*32 (c:windowssyswow64regedit)
  2. Search for AutoItX in HKEY_CLASSES_ROOTAppID
  3. I found it in HKEY_CLASSES_ROOTAppID{6E8109C4-F369-415D-AF9A-2AEEFF313234}
  4. Create a blank REG_SZ (String) entry called DllSurrogate

For some reason, this completely solved the issue.

 

If so then a minor update to the AutoIT installation could be a solution?

Edited by DigitalFacade82

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By tarretarretarre
      About AutoIt-API-WS
      AutoIt-API-WS is a light weight web server with expressive syntax, with the sole purpose of wrapping your existing AutoIt app with little to no effort.
      With AutoIt-API-WS you can send and receive data between any application or framework, as long they can handle HTTP requests, which is an industry standard today.
      Like my other communcations UDF AutoIt-Socket-IO AutoIt-API-WS is heavily inspired from the big boys, but this time its Laravel and Ruby on Rails.
      Features Highlights
      No external or internal dependencies required RESTful mindset when designed Expressive syntax Small codebase Heavy use of Michelsofts Dictionary object Limitations
      Not complient with any RFC, so something important could be missing. Time will tell! One persons slow loris attack will kill the process forever. Example of implemetnation (With screenshots)
      This is a basic cRud operation with the RESTful mindset in use.
      #include "API.au3" #include <Array.au3> _API_MGR_SetName("My APP DB adapter") _API_MGR_SetVer("1.0 BETA") _API_MGR_SetDescription("This adapter allows you to get this n that") _API_MGR_Init(3000) _API_MGR_ROUTER_GET('/users', CB_GetUsers, 'string sortBy', 'Get all users, sortBy can be either asc or desc. asc is default') _API_MGR_ROUTER_GET('/users/{id}', CB_GetUsersById, 'int id*', 'Get user by id') While _API_MGR_ROUTER_HANDLE() WEnd Func DB_GetUsers() Local $userA = ObjCreate("Scripting.Dictionary") Local $userB = ObjCreate("Scripting.Dictionary") $userA.add('id', 1) $userA.add('name', 'TarreTarreTarre') $userA.add('age', 27) $userB.add('id', 2) $userB.add('name', @UserName) $userB.add('age', 22) Local $aRet = [$userA, $userB] Return $aRet EndFunc Func CB_GetUsers(Const $oRequest) Local $aUsers = DB_GetUsers() If $oRequest.exists('sortBy') Then Switch $oRequest.item('sortBy') Case Default Case 'asc' Case 'desc' _ArrayReverse($aUsers) EndSwitch EndIf Return $aUsers EndFunc Func CB_GetUsersById(Const $oRequest) Local Const $aUsers = DB_GetUsers() Local $foundUser = Null For $i = 0 To UBound($aUsers) -1 Local $curUser = $aUsers[$i] If $curUser.item('id') == $oRequest.item('#id') Then $foundUser = $curUser ExitLoop EndIf Next If Not IsObj($foundUser) Then Return _API_RES_NotFound(StringFormat("Could not find user with ID %d", $oRequest.item('#id'))) EndIf return $foundUser EndFunc When you visit http://localhost:3000 you are greeted with this pleasent view that will show you all your registred routes and some extra info you have provided.

      When you visit http://localhost:3000/users the UDF will return the array of objects as Json
       
      And here is an example of http://localhost:3000/users/1

       
      More examples can be found here
       
       
      Autoit-API-WS-1.0.0-beta.zip (OLD!)
      Autoit-API-WS-1.0.1-beta.zip (NEWEST 2020-06-29)
    • By nacerbaaziz
      goodmorning autoit team
      today am comming with some winhttp problems, i hope that you can help me to solve them.
      the first problem
      is when opening a request
      my forums api allow me to delete any post using the api key
      all functions work, i mean post / get
      but when i tried to use the delete verb it's gave me an html 404 error
      here is what am tried
      #include "WinHttp.au3" ; Open needed handles Global $hOpen = _WinHttpOpen() Global $hConnect = _WinHttpConnect($hOpen, "xxxxxxxx.com") ; Specify the reguest: Global $hRequest = _WinHttpOpenRequest($hConnect, "Delete", "/vb/Api/posts/10447/?hard_delete=true", default, default) _WinHttpAddRequestHeaders($hRequest, "XF-Api-Key:xxxxx") _WinHttpAddRequestHeaders($hRequest, "XF-Api-User:xxxxx") ; Send request _WinHttpSendRequest($hRequest) ; Wait for the response _WinHttpReceiveResponse($hRequest) Global $sHeader = 0, $sReturned = 0 ; If there is data available... If _WinHttpQueryDataAvailable($hRequest) Then $sHeader = _WinHttpQueryHeaders($hRequest, $WINHTTP_QUERY_CONTENT_DISPOSITION) ;Or maybe: ; $sHeader = _WinHttpQueryHeaders($hRequest, BitOR($WINHTTP_QUERY_RAW_HEADERS_CRLF, $WINHTTP_QUERY_CUSTOM), "Content-Disposition") Do $sReturned &= _WinHttpReadData($hRequest) Until @error msgBox(64, "", $sReturned) endIf ; Close handles _WinHttpCloseHandle($hRequest) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen)  
      and here is the error message
      <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>403 Forbidden</title> </head><body> <h1>Forbidden</h1> <p>You don't have permission to access /vb/Api/posts/10447/ on this server.<br /> </p> </body></html>  
      i hope you can help me 
      thanks in advance
    • By argumentum
      I can TCP/IP in AutoIt, hence, make a HTTP deamon. Now, how can I HTTPS to use SSL !??
      Well, Apache has this "mod_proxy.so" module that can let me have SSL and what not is in Apache.
      All that is needed is to tell Apache what I wanna do by editing httpd.conf .
      # Implements a proxy/gateway for Apache. # 1. Open /Applications/XAMPP/etc/httpd.conf # 2. Enable the following Modules by removing the # at the front of the line. # - LoadModule rewrite_module modules/mod_rewrite.so # - LoadModule proxy_module modules/mod_proxy.so # - LoadModule proxy_http_module modules/mod_proxy_http.so # # 3. Copy and Paste below to the bottom of httpd.conf # <IfModule mod_proxy.c> ProxyRequests On <Proxy *> Order deny,allow Allow from all </Proxy> ProxyVia Off ProxyPreserveHost Off ProxyPass /home/ http://127.0.0.1:84/home/ ProxyPassReverse /home/ http://127.0.0.1:84/home/ SetEnv proxy-nokeepalive 1 # ..since we are not using "keep-alive", we are using "close" </IfModule> ...et voila  
      I'm using XAMPP ( https://www.apachefriends.org/download.html )
      and this is my solution to avoid coding in PHP, as I feel more comfortable coding in AutoIt.
      A "muli-thread or concurrency" can be done by forking the socket ( https://www.autoitscript.com/forum/topic/199177-fork-udf-ish/ )
      but responses are under 20 ms., so I feel fine with a single thread.
      I modified an example ( attached below ), so can try out the concept.
      PS: I am not an Apache guru. I just discovered this and it opens a world of possibilities. In my case, I'm thinking of an API to query SQLite 
      PS2: I'm not gonna make Poll but do click like if you do  
       
      201673-json-http-post-serverlistener.au3
    • By MichaelSDeVries
      Has anyone successfully developed  integration with the E*TRADE API in AutoIt?


       
      If so, then would you be willing and able to share some of your AutoIt code to do so with me? and/or help me successfully develop an AutoIt interface with the E*TRADE API?

       
      Please also Reply at: http://blog.thevcf.com/forums/topic/etrade-api/#post-4032

       
      Thank You and Have a Great Day!
      - Michael S. DeVries
    • By Colduction
      Hello again, i have a code that changes username to favorite, my problem is how to use ObjEvent() function to catch errors, i've red Help File and Forum's Topics but i can't understand too much😐

      Here is a code (I've copied this codes from a user of AutoIt Forum):
       
      $sOldUser = "Administrator" $sNewUser = "Admin" $oUser = ObjGet("WinNT://" & @ComputerName & "/" & $sOldUser & ",user") $oComputer = ObjGet("WinNT://" & @ComputerName) $oNewUser = $oComputer.MoveHere($oUser.ADsPath, $sNewUser) Thanks for your care, I'm new to AutoIt and days should be passed with my coding and practicing to don't bother you :)❤
×
×
  • Create New...