How can I use Window Handle with Attach Window Activity?

How can I Use Attach Window activity to attach to a window using its Window Handle?

More specifically, how to I convert an workflow argument to UiPath.Core.Window type so it can be accepted in the Attach Window’s Input->Window property?

Additional Info:

  • I am passing the window handle’s value, when I invoke the workflow: (e.g. in_Handle (Int32) = 00001234). This value needs to be converted to a UiPath.Core.Window.
  • Subsequent workflow processing will use Trigger Scope and Element Attribute Change Trigger to monitor a Java selector’s “text” attribute for change, and on change, perform additional workflow activities.

This is not the correct way to attach to a window. Use the selectors.

The handle should be IntPtr. So you would need to convert your Int32 to an IntPtr:

New UiPath.Core.Window(CType(in_Handle, IntPtr))

@ptrobot This is exactly the solution I was looking for. Thank you!

1 Like

In the future, for anyone interested in using a Window Handle to Attach to a Window:

Use Case: Monitor a window for a change made interactively by the end user. Then invoke a different workflow or perform some additional workflow activities.

  • Note: in_Handle is a workflow input argument. in_Handle’s value (in my case e.g. 0x00010D46 or 68934), will change each time the window is created, so you need to use a different application or workflow to get the Window Handle’s value and pass this to the workflow: in_Handle.

  • Here are the Attach Window properties
    Notice that only the Window property is needed:

After the Attach Window activity successfully executes, other activities based in Selectors in the Attached Window, can occur. In my case, I monitor for updates: Here is my sample sandbox workflow:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.