tausday Posted May 17, 2016 Posted May 17, 2016 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
water Posted May 17, 2016 Posted May 17, 2016 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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
tausday Posted May 17, 2016 Author Posted May 17, 2016 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now