Jump to content

How do i generate Control Command function in C# application for automation?


Recommended Posts

Hello dear forum members.

I am building a program with Visual Studio C #, but I could not build and do a function that I easily made in AutoIT in C # programming language.

My autoit function is

Func sendCommandForThis($komut)
    $title = "Program Title"
    ControlCommand($title, "", "Edit1", "EditPaste", $komut)
    Sleep(10)
    ControlSend($title, "", "Edit1", "{ENTER}{ENTER}")
EndFunc

My C# function is


IntPtr zero = IntPtr.Zero;
for (int i = 0; (i < 60) && (zero == IntPtr.Zero); i++)
{
    Thread.Sleep(150);
    zero = FindWindow(null, title);
}
if (zero != IntPtr.Zero)
{
    SetForegroundWindow(zero);
    Clipboard.Clear();
    Clipboard.SetText(command.ToString().Trim());
    SendKeys.SendWait("^v{ENTER}{ENTER}");
    SendKeys.Flush();
}

 

As I said, the function I did on C # is not healthy enough, I have listed the codes.

How can I do the same for C # as Autoit ControlCommand function that sends code to another program in the background? 

Thanks for everyone.

Link to post
Share on other sites
  • Developers

You clearly didn't read the forum rules I pointed you to: 

this is the exact same question with some minor changes. Consider this your final warning!

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to post
Share on other sites
  • Jos locked this topic
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...