Jump to content

Using DDE with AutoIT


Recommended Posts

Hi,

AutoIT can not, but the WIN-filehandler can. So I used the fileassociation and Shellexecute(....,verb) to work with DDE.

I set up an dde example how to open a PDF, print it and then close the application. It should work also with other applications.

Because it is the first time I used RegWrite, perhaps someone can improve it or has some tips for writing it better.

Thanks, Reinhard

DIM $PdfDefault = "Adobe Acrobat 7.0 Document"
DIM $PdfCommand =""

MsgBox(0,"Registry",GetDefaults())
MsgBox(0,"",$PDFDefault)
RegistryWrite()
ShellExecute("c:\Test.pdf","","","PrintDDETemp")


Func GetDefaults()
    $PdfDefault = RegRead("HKEY_CLASSES_ROOT\.pdf","")
    $PdfCommand =  RegRead("HKEY_CLASSES_ROOT\" & $PDFDefault & "\Shell\Open\Command","")
    return $PDFcommand
EndFunc

Func RegistryWrite()
;write the key
    RegWrite("HKEY_CLASSES_ROOT\" & $PDFDefault & "\Shell\PrintDDETemp");,"","REG_SZ","TestPrint")
    RegWrite("HKEY_CLASSES_ROOT\" & $PDFDefault & "\Shell\PrintDDETemp\command","","REG_SZ",$PdfCommand)
    RegWrite("HKEY_CLASSES_ROOT\" & $PDFDefault & "\Shell\PrintDDETemp\ddeexec","","REG_SZ","[FilePrintSilent(%1)][AppExit()]")
    RegWrite("HKEY_CLASSES_ROOT\" & $PDFDefault & "\Shell\PrintDDETemp\ddeexec\application","","REG_SZ","Acroview")
    RegWrite("HKEY_CLASSES_ROOT\" & $PDFDefault & "\Shell\PrintDDETemp\ddeexec\topic","","REG_SZ","Control")
endFunc
Edited by ReFran
Link to comment
Share on other sites

  • 2 months later...

II've just finished a generic UDF library for Windows DDE (client and server).

Here: DDEML.

Edited by doudou

UDFS & Apps:

Spoiler

DDEML.au3 - DDE Client + Server
Localization.au3 - localize your scripts
TLI.au3 - type information on COM objects (TLBINF emulation)
TLBAutoEnum.au3 - auto-import of COM constants (enums)
AU3Automation - export AU3 scripts via COM interfaces
TypeLibInspector - OleView was yesterday

Coder's last words before final release: WE APOLOGIZE FOR INCONVENIENCEĀ 

Link to comment
Share on other sites

II've just finished a generic UDF library for Windows DDE (client and server).

Here: DDEML.

Thanks for that.

I tried it but don't get it to work. Could you give an example how to use it with reader.

I think beside,

Thema: "control", Topic: "Acroview", Cmd: '[FileOpen("C:\Test.pdf")]'

I have to state the application: AcroRd32.exe.

But I don't know where.

Thanks in advance, Reinhard

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...