Reputation: 100
We are trying to launch a Citrix desktop instance using :
Set ICO = CreateObject("Citrix.ICAClient") ICO.Address = Addr ICo.TransportDriver = "TCP/IP" ICO.InitialProgram = "#testing- " ICo.WinstationDriver ="ICA 3.0" ICO.Username = "tester" ICo.Domain = "ASIA" ICO.SetProp "ClearPassword", "hello" ICO.SetProp "Launch", "TRUE" ICO.Connect ICO.Session.Mouse.SendMouseDown 1,0,400,400 'waitfor 30 secs ICO.Logoff
it generates error(Object required: 'ICO.Session') while using session object ICO.Session.Mouse.SendMouseDown 1,0,400,400
obviously it is not returning session object.
Simulation is enabled: [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Citrix\ICA Client\CCM] "AllowSimulationAPI"=dword:00000001 How to return the session object.
Upvotes: 1
Views: 1332
Reputation: 201
You need to wait for a session to be created. Right after connection session is not yet created. Either hardcode some timeout between calling ICO.Connect and SendMouse, or wait for an event, such as onConnect or onLogon.
Upvotes: 0
Reputation: 24617
Use EnumerateCCMSessions
to get the session objects, and iterate over the session objects using GetEnumNameCount
to get the session names:
Set icaClient = CreateObject("Citrix.ICAClient")
sessionHandle = icaClient.EnumerateCCMSessions()
numSessions = icaClient.GetEnumNameCount(sessionHandle)
For ct = 0 To numSessions - 1
sessionID = icaClient.GetEnumNameByIndex(sessionHandle, ct)
icaClient.StartMonitoringCCMSession sessionID, True
'SessionServer = 0,
'SessionUsername = 1
'SessionDomain = 2
sessionInfo = icaClient.GetSessionString(1)
If lcase(sessionInfo) <> lcase(strWindowsUser) Then
icaClient.Disconnect()
End If
icaClient.StopMonitoringCCMSession sessionID
Next
icaClient.CloseEnumHandle sessionHandle
A. EnumerateCCMSessions: API to enumerate all the sessions running on the machine returning the list of session IDs.
B. StartMonitoringCCMSession: API to start the live monitoring. You must pass the session ID of the session which you want to monitor. Once this is done, it is then possible to use other ICA Simulation APIs.
C. StopMonitoringCCMSession: API to stop monitoring the session. When finished with monitoring, this API should be called. Doing so cleans up any resources used by ICO.
References
VBS: ActiveX component can't create object: 'Citrix.ICAClient' errror on 64-bit
ICA Client Object Changes in the Version 11.2 XenApp Plug-in
ICA Object SDK: Citrix ICA Client Object API Specification Programmer’s Guide (pdf)
Upvotes: 1