How to SendMessage to a Window Application

AutoHotkey supports sending of messages to other programs and ahk scripts. How can I send a message to an ahk script from within a c# UiPath workflow?

Additional Information:
PostMessage / SendMessage

Hi Gary

Do you mean that you wish to execute another program with an in-line command?
Or do you want to type text into an on-screen desktop application?
Or do you want to create a popup on-screen for a user?

If you want to perform clicks/typing into a desktop application the standard uipath activities should allow you to generate the selectors necessary to perform the action - you may need to play with the input type (simulate vs. hardware etc.).

@Kane_Baden1 For this question, I do NOT want to do any of the activities you have listed.

More specifically, I want to SENDMESSAGE as described in the links in my initial question. I want to be able to SENDMESSAGE from inside a UiPath workflow, and have the workflow wait for an acknowledgement from the receiving non-UiPath application (e.g. a Autohotkey.ahk script or some other application like notepad). I believe this will need to be done with some dll calls from a c# code block, however I do not know what they would be. That is why I am posting this question to the community.

Ah right ok.

Yeah so UiPath doesn’t really wait for a response, its only when an activity has a built in verification (such as an API call waiting for the response).

You can write custom activities using the extension available for Visual Studio pretty easily, just be aware it uses .Net Framework. Make sure you use the timeout function from the extension to prevent UiPath from either waiting infinitely or defaulting as a failure after X seconds.

You could then call you custom activity, which would invoke your script programmatically and wait for a response before handing back to UiPath.

Alternatively, you could have your external script generate a result file and have UiPath poll for the file being generated - be careful of infinite loops etc…

Visual Studio Extension : Using The Activity Creator

Edit - and in the case of things like typing something into Notepad, you can really only do verification after the fact.

Such as :

Action 1: Type into Notepad
Action 2: Read the notepad window
Action 3: If ContentsOfWindow == WhatYouTypedIn, continue.

ok, thank you for your suggestions. They are helpful.

To work around this, I have decided to synchronously call an AutoHotkey script, which then sends my windows message. This seems to work well, because UiPath waits for this autohotkey.exe and its associated ahk to finish its work.

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