tausday

Objget same Classname

3 posts in this topic

Hello,

i have searched a long time but i don't find for my problem the right answer.

The Function ObjGet connect to the first classname in the ROT(running object table). Is that correct?

Now I have run the same Application two times and i want connect to the second object.

How can i do that?

My Command is:

$oRemedy = ObjGet("", "Remedy.User.1" )

I have try to insert an instance but it don't work:
 Instance of the object for ROT objects of the same (co)class.

 

I hope somebody can tell me how i can select the second class

 

Thx 4 help

example.jpg

Share this post


Link to post
Share on other sites



I use the following code in the Excel UDF to loop though the Excel application instances.

Func _Excel_BookAttach($sString, $sMode = Default, $oInstance = Default)
    Local $oWorkbook, $iCount = 0, $sCLSID_Workbook = "{00020819-0000-0000-C000-000000000046}" ; Microsoft.Office.Interop.Excel.WorkbookClass
    If $sMode = Default Then $sMode = "FilePath"
    While True
        $oWorkbook = ObjGet("", $sCLSID_Workbook, $iCount + 1)
        If @error Then Return SetError(1, @error, 0)
        If $oInstance <> Default And $oInstance <> $oWorkbook.Parent Then ContinueLoop
        Switch $sMode
            Case "filename"
                If $oWorkbook.Name = $sString Then Return $oWorkbook
            Case "filepath"
                If $oWorkbook.FullName = $sString Then Return $oWorkbook
            Case "title"
                If $oWorkbook.Application.Caption = $sString Then Return $oWorkbook
            Case Else
                Return SetError(2, 0, 0)
        EndSwitch
        $iCount += 1
    WEnd
EndFunc   ;==>_Excel_BookAttach

 


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Thanks for u're fast answer.

If I understand u're code right u have write an loop for the instance.

I have to it quick and dirty manuell with

$oRemedy = ObjGet("","{2CE86730-A954-11D1-94F6-00C04FE198D3}",1)
$oRemedy = ObjGet("","{2CE86730-A954-11D1-94F6-00C04FE198D3}",2)

I don't get an error but both instance communicate to the first Object.

If i insert 3 for the instance I get an error with :  Variable must be of type "Object".:

But it dont connect to the second application

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