Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

COM support using Perl


  • Please log in to reply
1 reply to this topic
antonyb
  • Members
  • 61 posts
  • Last active: Mar 07 2006 09:24 AM
  • Joined: 26 May 2004
Hello,

If you've played around with this, you may have already figured this out, but using thomasl's brilliant Perl integration stuff with AutoHotkey, its possible to call arbitrary methods on COM objects from AutoHotkey.

The following example sends a message to a Konfabulator widget using AHK, Perl and COM:
#Include %A_ScriptDir%\perl.ahk
PerlInit()
PerlEval(
(
"use Win32::OLE;
$k=Win32::OLE->GetActiveObject('Konfabulator.Application');
$k=Win32::OLE->new('Konfabulator.Application') if $k==undef;
$k->tellWidget('New Mail', 'close') unless $k==undef;")
)
PerlExit()

perl.ahk is the library of Perl functions included in the perlahk.zip
Win32::OLE is a standard ActiveState Perl module.
Konfabulator.Application is the COM Id of Konfabulator.
tellWidget is a method on Konfabulator's COM interface.

Have fun!

Ant.

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
Innovative solution for achieving COM support. Thanks for sharing it.