Jump to content

Delphi Wrapper Advanced


Melloware
 Share

Recommended Posts

I know Tianpeng Wang wrote a Delphi DLL wrapper for AutoItX but I have also written one that I think is just slightly more robust.

The advantages of the wrapper I have created are:

1. Dynamically loaded so no error with be thrown if DLL is not found on the path. You can query boolean AutoItXDLLLoaded property to find out if it is loaded. This will allow your application to function normally if the DLL is not found. The other wrapper is statically linked to the DLL and throws a cryptic error when the DLL is not found.

if AutoItXDLLLoaded then
 ...
else
 ...
end;

2. Defaults for integer parameters as listed in the API spec. So instead of:

AU3_WinWaitActive('Untitled - Notepad', '', 0);

you can use:

AU3_WinWaitActive('Untitled - Notepad', '');

if you want the default.

3. Ability to query for the version of the DLL you are using by the method AutoItXVersion() which return 3.2.8.4 or whatever the version of the AutoItXDll you are using.

4. Has latest procedures and functions from the DLL including the new RegDeleteKey and RegDeleteValue where the old .PAS file has the old API calls.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Melloware Inc.

www.melloware.com

=-=-=-=-=-=-=-=-=-=-=-=-=-=-

autoitx_delphi.zip

autoitx33_delphi.zip

Edited by Melloware

----------------------------------------------------------------------------------------Melloware Inchttp://www.melloware.comHome of Intelliremote, take back control of your HTPC!www.intelliremote.com-----------------------------------------------------------------------------------------

Link to comment
Share on other sites

  • 5 months later...

I know Tianpeng Wang wrote a Delphi DLL wrapper for AutoItX but I have also written one that I think is just slightly more robust.

The advantages of the wrapper I have created are:

1. Dynamically loaded so no error with be thrown if DLL is not found on the path. You can query boolean AutoItXDLLLoaded property to find out if it is loaded. This will allow your application to function normally if the DLL is not found. The other wrapper is statically linked to the DLL and throws a cryptic error when the DLL is not found.

2. Defaults for integer parameters as listed in the API spec.

3. Ability to query for the version of the DLL you are using by the method AutoItXVersion() which return 3.2.8.4 or whatever the version of the AutoItXDll you are using.

4. Has latest procedures and functions from the DLL including the new RegDeleteKey and RegDeleteValue where the old .PAS file has the old API calls.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Melloware Inc.

www.melloware.com

=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Nice wrapper!

Is it 'Freeware' like AutoIt itself?

Hans-Peter

Link to comment
Share on other sites

  • 2 weeks later...

Nice wrapper!

Is it 'Freeware' like AutoIt itself?

Hans-Peter

Yes! I just wanted to give something back to the AutoIT community since I wrote this wrapper to be used in my Intelliremote application. Feel free to use it unencumbered!

----------------------------------------------------------------------------------------Melloware Inchttp://www.melloware.comHome of Intelliremote, take back control of your HTPC!www.intelliremote.com-----------------------------------------------------------------------------------------

Link to comment
Share on other sites

Thanks for the compliments!

I don't see a "WinList" function in the AutoITX C header. Is it possible you want this function and its not supported by AutoITX. I think I have implemented every method call available in the DLL?

Edited by Melloware

----------------------------------------------------------------------------------------Melloware Inchttp://www.melloware.comHome of Intelliremote, take back control of your HTPC!www.intelliremote.com-----------------------------------------------------------------------------------------

Link to comment
Share on other sites

  • 1 year later...

I'm sorry, but I tried to use your Warapper with AutoItX3.dll in Delphi7, but the only thing your "TestAutoItX.dpr" managed to do was to write pointless sequences of questionmarks into my delphi - I commented the "WinWaitActive" part because it didn't work either.

I only get the DLL to send single Chars, but that isn't enough for what I need it to.

Did anybody of you encounter similar problems?

This is the Code I tested your wrapper with:

if not AutoItXDLLLoaded then //Returned True.
   begin
      MessageDlg('AutoItX3 DLL is not found in the path!', mtError, [mbOK], 0);
   end
   else
   begin
      AU3_Sleep(1000); // Only Thing that worked^^
      AU3_Run('notepad.exe', ''); //didn't work...
      //AU3_WinWaitActive('Untitled - Notepad', ''); //Commented: The notepad wasn't opened.
      AU3_Send(PAnsiChar('DLL Version: ' + AutoItXVersion + ' {ENTER}')); //wrote sequencves like '???????4????' into my codeeditor 
      AU3_Send(PAnsiChar('DLL Description: ' + AutoItXDescription)); //Didn't work either
      AU3_Sleep(5000); // Only Thing that worked^^
      AU3_WinClose('Untitled - Notepad', ''); // I stopped execution at this point.
      AU3_WinWaitActive('Notepad', '&No');
      AU3_Send('!n');
   end;

Thx in advance,

The LDer.

P.S.: I found this topic: http://www.autoitscript.com/forum/index.ph...1&hl=delphi

But it does't solve my problems.

Can anybody of you upload his working set of DLL and delphi-wrapper? Or is mine a problem with Delphi7?

Plz help me, I'm just about to become desperate ^_^

Link to comment
Share on other sites

Why do you call AU3_Run? Use CreateProcess instead. It'll call it internally anyway. If I'm not wrong I think that the second parameter in AU3_Run has to be specified to point to the current working directory... And also AU3_* functions are working with unicode strings so I guess that this the reason why you're getting ???????4???? string. ;]

Edited by Authenticity
Link to comment
Share on other sites

I'm sorry, but I tried to use your Warapper with AutoItX3.dll in Delphi7, but the only thing your "TestAutoItX.dpr" managed to do was to write pointless sequences of questionmarks into my delphi - I commented the "WinWaitActive" part because it didn't work either.

I only get the DLL to send single Chars, but that isn't enough for what I need it to.

Did anybody of you encounter similar problems?

This is the Code I tested your wrapper with:

if not AutoItXDLLLoaded then //Returned True.
    begin
       MessageDlg('AutoItX3 DLL is not found in the path!', mtError, [mbOK], 0);
    end
    else
    begin
       AU3_Sleep(1000); // Only Thing that worked^^
       AU3_Run('notepad.exe', ''); //didn't work...
       //AU3_WinWaitActive('Untitled - Notepad', ''); //Commented: The notepad wasn't opened.
       AU3_Send(PAnsiChar('DLL Version: ' + AutoItXVersion + ' {ENTER}')); //wrote sequencves like '???????4????' into my codeeditor 
       AU3_Send(PAnsiChar('DLL Description: ' + AutoItXDescription)); //Didn't work either
       AU3_Sleep(5000); // Only Thing that worked^^
       AU3_WinClose('Untitled - Notepad', ''); // I stopped execution at this point.
       AU3_WinWaitActive('Notepad', '&No');
       AU3_Send('!n');
    end;

Thx in advance,

The LDer.

P.S.: I found this topic: http://www.autoitscript.com/forum/index.ph...1&hl=delphi

But it does't solve my problems.

Can anybody of you upload his working set of DLL and delphi-wrapper? Or is mine a problem with Delphi7?

Plz help me, I'm just about to become desperate ^_^

I'm a bit confused by your post because your give a link to a thread where the answer to you rp[roblewm is given but the code you post doesn' take any notice of that. Are you saying you tried the solution and it didn't work? Either way, why does your script include code which was pointed out as being faulty by Valik?
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

  • 2 weeks later...

I'm a bit confused by your post because your give a link to a thread where the answer to you rp[roblewm is given but the code you post doesn' take any notice of that. Are you saying you tried the solution and it didn't work? Either way, why does your script include code which was pointed out as being faulty by Valik?

LDer,

I am using Delphi 7 and I just ran it and it worked fine for me on both a Vista x64 and XP x32 machines. What version of the AutoItX DLL are you using?

I am using 3.2.12.1 and it works. I have not upgraded to 3.3 but from that other post it looks like it has to do with Ansi strings vs Unicode Strings which is new in 3.3

Edited by Melloware

----------------------------------------------------------------------------------------Melloware Inchttp://www.melloware.comHome of Intelliremote, take back control of your HTPC!www.intelliremote.com-----------------------------------------------------------------------------------------

Link to comment
Share on other sites

OK so AutoItX 3.3 is now using Unicode strings. All I had to do was update the code to use PWideChar instead of PChar and now you have to wrap strings you call it with StrToOleStr() like so...

AU3_Send(StringToOleStr('DLL Description: ' + AutoItXDescription));

See attached code for use in AutoItX 3.3+.

autoitx33_delphi.zip

----------------------------------------------------------------------------------------Melloware Inchttp://www.melloware.comHome of Intelliremote, take back control of your HTPC!www.intelliremote.com-----------------------------------------------------------------------------------------

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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