Jump to content

How to use autoitX in .net (C#) without registering


evlo
 Share

Recommended Posts

Can you help me how to use AutoitX (ocx/activeX library) in .net c# application without registering it? I would like to create application with it without need to use administrator rights for installation.

I found some links on MS like this http://msdn.microsoft.com/en-us/library/ms973913.aspx about creating manifest files for dlls. I tried it and did not succeed. So maybe it is possible and i created it wrongly. Unfortunately i lost the xmls so i can't post it here.

Also i tried setting isolated and enable interop types in reference properties without success.

So if you managed to get autoitX working in C# without need for registering it please help me how to do it. I think it should be possible to use as DLL and not OCX but i don't know how exacly to do it in c#.

Thank you

currently i use it like

AutoItX3Lib.AutoItX3 autoit = new AutoItX3Lib.AutoItX3();
autoit.AutoItSetOption("WinTitleMatchMode", 2);

etc. So if i would go for direct dll calls how to do it then?

If i try to add DLL directly i get - "module was expected to contain an assembly manifest" "this file may not be a managed assembly". That manifest file is exactly file that i would like to have, filename should be "AutoItX3.manifest" or maybe AutoItX3.dll.manifest.

my manifest attempts - both don't work

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Copyright (c) Microsoft Corporation.  All rights reserved. -->
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <assemblyIdentity
    version="1.0.0.1"
    processorArchitecture="x86"
    name="AutoIt.AutoItX3"
    type="win32"
    />
    <file name="AutoItX3.dll">
    </file>
</assembly>

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Copyright (c) Microsoft Corporation.  All rights reserved. -->
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <assemblyIdentity
    version="3.3.6.1"
    processorArchitecture="x86"
    name="AutoIt.AutoItX3"
    type="win32"
    />
    <file name="AutoItX3.dll">
    </file>
</assembly>

and naming it AutoIt.AutoItX3.manifest

I also tried

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Copyright (c) Microsoft Corporation.  All rights reserved. -->
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <assemblyIdentity
    version="3.3.6.1"
    processorArchitecture="x86"
    name="AutoItX3"
    type="win32"
    />
    <file name="AutoItX3.dll">
    </file>
</assembly>

and

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Copyright (c) Microsoft Corporation.  All rights reserved. -->
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <assemblyIdentity
    version="3.3.6.1"
    processorArchitecture="x86"
    name="AutoItX3"
    type="win32"
    />
    <file name="AutoItX3.dll">
    </file>
</assembly>

and naming it AutoIt.manifest

Edited by evlo
Link to comment
Share on other sites

  • 2 years later...
  • 1 year later...

Download the beta and just include AutoItX.Assembly.dll into your c# program which gives you a nice easy interface without having to mess with DllImport.

Great!; I do it and works on C# Framework 3.5 and above.

The only thing; you should include the AutoItX.Assembly.dll as reference in your program; also, make a raw copy of the AutoItX3.dll in you debug folder (Where the main executable is located). After that; works like a charm!

Example:

private static void downloadData(string filePath)
{
    try
    {
        fw.fileDelete(filePath);

        System.Threading.Thread.Sleep(5000);
                
        string strWinSave = "Save As";

        do
        {
            System.Threading.Thread.Sleep(500);
            AutoIt.AutoItX.ControlSetText(strWinSave, "", "Edit1", "");
            System.Threading.Thread.Sleep(500);
            AutoIt.AutoItX.ControlSend(strWinSave, "", "Edit1", filePath);
            System.Threading.Thread.Sleep(500);
            AutoIt.AutoItX.ControlSend(strWinSave, "", "Edit1", "{ENTER}");
            System.Threading.Thread.Sleep(500);
        } while (AutoIt.AutoItX.WinExists(strWinSave, "") != 0);
    }
    catch (Exception ex) { throw new Exception("Error downloading information", ex); }
}
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...