DDE (Dynamic Data Exchange) is one Microsoft way of communicating between applications that support that (e.g. Word does, but Wordpad/Notepad don't). Messages are strings that express commands. It looks like for Word the commands have to be bracketed, so put braces around to prevent the Tcl parser from seeing them. Tcl (for Windows) of course has dde support - see the dde page in Tcl Help. http://tcl.activestate.com/man/tcl8.4/TclCmd/dde.htm From a posting by Bill Schongar, at http://groups.google.com/groups?oi=djq&ic=1&selm=an_490725194 , you can control '''Microsoft Word''' from the dde command. First: be sure Word is running, then try a command like the following to insert text into the current document: package require dde dde execute -async Winword System {[Insert "Text from Tcl."]} To quit Word, or close a document, use the following commands as a guide: dde execute Winword System {[FileExit 2]} dde execute Winword System {[FileClose 2]} In these examples, 2 = close without saving, 1 = save first, 0 = prompt. For documentation on accessing Word, see the "wrdbasic.hlp" file, which you can choose to install when you install Word. Peter G. Baum presented this example for '''Matlab''': dde execute Matlab Engine "s = ones(5);" ---- To open a web page in '''Internet Explorer''': dde execute iexplore WWW_OpenURL "http://www.tcltk.com/" See http://support.microsoft.com/support/kb/articles/Q160/9/57.ASP?LN=EN-US&SD=gn&FR=0 for various dde commands supported by internet explorer. It would be nice to transcribe some of them into Tcl for this page. dde execute iexplore WWW_ShowFile C:/Program%20Files/.... will open a local file (note that spaces and other odd characters must be converted to valid '%' codes). dde request iexplore WWW_GetWindowInfo 1 will return information about the current window which is open, although if multiple windows are open, I'm not sure how to control this more accurately. dde request iexplore WWW_ListWindows 0 seems to do something... Vince. (any help with above? In particular, it would be useful to be able to grab the URL of the foremost window.- ------- Finally, '''Eudora''' seems to have some support: {Eudora DeleteMessageById} {Eudora PutMessageById} {Eudora GetMessageById} {Eudora GetNextMessageId} {Eudora ExpandNickname} {Eudora MAPI} {Eudora WWW_OpenURL} But I'm not sure how to make use of them... ------- Controlling '''Windows explorer''': To open a folder on the desktop: dde execute Folders AppProperties{[ViewFolder "C:\Temp","C:\Temp",5)]} you can also use 'ExploreFolder' instead. To open the Find Folder dialog: dde execute Folders AppProperties {[FindFolder("","C:\Temp")]} will open the Find Folder dialog. ---- Re '''MS Excel''', George Petasis writes in comp.lang.tcl: Finally, I manage to find an example at msdn. My only problem now is how to select the chart type of the created chart. Acoording to the example: dde execute Excel $Topic \ "\[Select(\"R1C1:R${rows}C1\;R1C5:R${rows}C$cols\")\]\[New(2,2)\]" The chart is created with New(2,2), after the correct cells are selected. This chart is the vertical bars type and is placed in a new book. How can I select the scatter graph and place it in a new sheet of the first book (referenced by $Topic)? Where can I find documentation about this New dde function? ---- Helpful procedures (Vince): proc windowsDdeExecute {service topic name args} { set cmd "\[$name\(" set subcmds [list] foreach a $args { lappend subcmds "\"$a\"" } append cmd [join $subcmds ","] "\)\]" puts stderr "dde execute $service $topic $cmd" dde execute $service $topic $cmd } proc windowsProgmanExecute {name args} { eval [list windowsDdeExecute PROGMAN PROGMAN $name] $args } ---- A recent posting in news:comp.lang.tcl says: Message-ID: <3B0BC718.742A151D@raytheon.com> From: Bruce Hartweg Newsgroups: comp.lang.tcl Subject: Re: Q: dde and Netscape References: <9eeg4j$d8h9@kcweb01.netnews.att.com> <3B0B3012.78949DEB@home.com> <3B0B8C45.5B5E9E9D@cs.man.ac.uk> <3B0BABD9.5B83294B@cs.nott.ac.uk> Date: Wed, 23 May 2001 09:20:08 -0500 Organization: Raytheon Company Neil Madden wrote: > "Donal K. Fellows" wrote: > > > > Bruce Hartweg wrote: > > > change wrote: > > >> However, if I use > > >> dde execute -asynce netscape WWW_OpenURL http://www.yahoo.comm > > >> the netscape does nothing (no error message either). Could someone help me? > > [...] > > > It's been a while, so I am not sure (can't find my script where I used this) > > > but I think you need to use dde request instead of dde execute. > > > > > > For reference of what DDE Topics Netscape supports see > > > http://developer.netscape.com/docs/manuals/communicator/DDE/contents.htm > > > > Hmm. The following URL (hopefully not mangled by this newsreader) looks > > to be the key: > > http://developer.netscape.com/docs/manuals/communicator/DDE/ddevb.htm#www_openurl > > > > So, I *guess* that it should be something like this: > > > > dde request netscape WWW_OpenURL http://www.yahoo.com 0 0 > > Doesn't work for me on Win98, I get: > wrong # args: should be "dde request serviceName topicName value" > > Removing the "0 0" from the end and it works as expected. > Yes, (it's coming back) the value has top be a single string, if you want to pass other args to the service separate by commas & keep as single arg (add commas to skip items) so dde request netscape WWW_OpenURL "${url},,0" will open the URL in a new window, and dde request netscape WWW_OpenURL "${url},,0xFFFFFFFF" will open it in the last active window Bruce ---- Back to [Tcl core extension syntax].