Jump to content

Search the Community

Showing results for tags 'VB ByRef'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office


  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start






Found 1 result

  1. Hello AutoIt Forum, I am in need of some help working with an API using COM. I have been trying to figure this out for over a week, and have come to the conclusion that after much research, this is outside of my ability. Scenario; Software interfacing with is Tekla Structures. I have been using this application for about 10 years for engineering and construction solutions. I know it well, and recently (past few years) started using the API with Autoit. The API (Tekla Open API) is developed on the .NET framework and well documented. The API also fully supports COM technology, though the recommended interface is a .NET application. All example code is C# and VB. I have had great success "translating" from the API documentation and examples to AU3 thus far. My current problem involves returning a value from a method, or a method that modifies the value of a variable. I am not sure how this is "properly" described. For C# sharp it is a "ref" string. public bool GetReportProperty( string Name, ref string Value ) For VB it is a ByRef string. Public Function GetReportProperty ( _ Name As String, _ ByRef Value As String _ ) As Boolean Notation from the documentation; The following is a complete example in C#, note that I am trying to return GetReportProperty while the example is using GetUserProperty. The logic should not differ as both methods are the same (return string type) with the exception of what they are calling. using Tekla.Structures.Model; using System; using System.Windows.Forms; public class Example { public void Example1() { Model Model = new Model(); ModelObjectEnumerator ObjectEnum = Model.GetModelObjectSelector().GetAllObjects(); ObjectEnum.SelectInstances = false; // Set the "SelectInstances" to false to speed up the enquiry; possible because only report properties are asked. string Result = "CHECKED BY, CHECKED DATE, OBJECT LOCKED \n"; while(ObjectEnum.MoveNext()) { if(ObjectEnum.Current != null) { Beam BeamObject = ObjectEnum.Current as Beam; if(BeamObject != null) { string CheckedBy = ""; double DateCheckedValue = 0.0; int LockedStatus = -1; DateTime DateChecked = new System.DateTime(1970, 1, 1); BeamObject.GetUserProperty("CHECKED_BY", ref CheckedBy); BeamObject.GetUserProperty("CHECKED_DATE", ref DateCheckedValue); BeamObject.GetUserProperty("OBJECT_LOCKED", ref LockedStatus); if(CheckedBy.Length > 0 || DateCheckedValue > 0.0 || LockedStatus != -1) DateChecked = DateChecked.AddSeconds(DateCheckedValue); Result += CheckedBy; Result += ", "; Result += DateChecked.ToString("dd.MM.yyyy"); if(LockedStatus == 1) { Result += ", Locked\n"; } else { Result += ", Not locked\n"; } } } } MessageBox.Show(Result); } } The following is my testing script in AutoIt. #AutoIt3Wrapper_UseX64=n #include <Array.au3> $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 = "DATA:" While $ALL_OBJECTS.MoveNext() Dim $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("PROFILE", $R_VALUE) $DATA = $DATA & @CRLF & "*|PROFLE = " & $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) Everything works as expected with the exception of $R_VALUE does not get modified by the method. I assume (dangerously) that is because "ref". Anyone have an idea of how to handle this?
  • Create New...