Jump to content

Run AutoIT executable from .Net


md9
 Share

Recommended Posts

I am trying to start an AUTOIT executable, which is supposed to open an notepad and pass some keystrokes, but it starts notepad.exe(I can see it in taskmanager) but doenst display the UI.

ProcessStartInfo psi = new ProcessStartInfo("c:\startAutoITNotepad.exe");

Process proc = Process.Start(psi);

Is there a parameter that I need to pass in order to see the UI and all the operations it performs.? Based on this experiment I have to accomplish much more operations in a mmc console.

I Look forward for any replies.

Thanks,

Link to comment
Share on other sites

Not an expert myself on .Net but could you check under which credentials the notepad.exe is running? If the autoIT program is started by a service it might happen that is not able to interact with your desktop & therefore won't display the UI

In the task manager, what session ID is given to notepad.exe? (you may need to add the Session ID column from the View menu) Is it the same session ID as other programs running by the currently logged in user?

just my 5 cts.

Why crabs don't give money to charity..... because they are shell-fish!! PS: Don't be a crab and share your scripts with the community! ;-)
Link to comment
Share on other sites

This worked on my machine - but that doesn't prove anything, I'm afraid. How did your approach differ?

AutoItTestFile

Run( "notepad" )
WinWait( "Untitled - Notepad" )
WinActivate( "Untitled - Notepad" )
Send("Test")

C#

using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;

namespace ThrowAway
{
    class Program
    {
        static void Main(string[] args)
        {
            ProcessStartInfo psi = new ProcessStartInfo(@"c:\startAutoITNotepad.exe");
            Process proc = Process.Start(psi);
            proc.WaitForExit();
        }
    }
}
Edited by zfisherdrums
Link to comment
Share on other sites

Thanks Tunasalad, ZFisherdrum,

I do the same thing on my local machine. It works without any problem. But when I try to execute this exe file remotely. I open a TCP channel and using .NET remoting i kickoff AUTOIT exe file, it doesnt work - I can see it running in the taskmanager but it doesnt open any window and type the text im passing. I am confused with the behavior

Any ideas. Thanks

Link to comment
Share on other sites

Thanks Tunasalad, ZFisherdrum,

I do the same thing on my local machine. It works without any problem. But when I try to execute this exe file remotely. I open a TCP channel and using .NET remoting i kickoff AUTOIT exe file, it doesnt work - I can see it running in the taskmanager but it doesnt open any window and type the text im passing. I am confused with the behavior

Any ideas. Thanks

Cannot remember exactly where I read it, but windows does not allow a remote process to run interactively. I recall that my attempts to launch app remotely via VBScript came across the same limitation.

Link to comment
Share on other sites

Link to comment
Share on other sites

Thanks guys,

Your responses are encouraging. I am looking into AutoITX dll and COM Interface. Is there a way to access tree control using ControlTreeView in A3X? Can you post some links to examples for my reference. I was wondering if there are restrictions on A3X: things that can be done with AutoIT but not with A3x..

Thnx.

@all

Maybe this might give you some inspiration.

Yuo can run an EXE from Dot Net using the A3x COM interface, like I didi here.

See example here RegFreeCOM Au3X Example

Regards

ptrex

Link to comment
Share on other sites

Thanks guys,

Your responses are encouraging. I am looking into AutoITX dll and COM Interface. Is there a way to access tree control using ControlTreeView in A3X? Can you post some links to examples for my reference. I was wondering if there are restrictions on A3X: things that can be done with AutoIT but not with A3x..

Thnx.

There are some limitations to A3X versus Native AutoIt. Most of them have been discussed at great lengths elsewhere, so I'll spare us all the bandwidth. Suffice it to say, UDFs are not available and there are a few unavailable commands.

In regards to ControlTreeView capability, I do see a section on it in the AutoITX Help file.

Edited by zfisherdrums
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...