DDE Request

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

DDE Request

Post by Bob Hansen » Wed Feb 19, 2003 6:20 pm

I am trying to use DDERequest for the first time, with no success.

I am trying to get the number of lines in a document that is being edited by Textpad.

Test notes:
1. TextPad is registered version 4.6
2. The document is C:\Data\Neast\RMB\DDETest.txt
3. Manually I would click on View, document Properties. A window will open, named Properties for DDETest.txt, and I could read the number of lines. (The number of lines is 260).
4. TextPad is open.
5. Multiple documents are being edited, but test document is the active one.
6. I did not bother trying to set focus, don't think that is needed with DDE.
7. I have not created any objects.

I have tried the following five lines and all of them bring back the same result: "DDE_SERVICE_INVALID".

1. DDERequest>TextPad,Properties for DDETest.txt,Lines,Result,5

2. DDERequest>TextPad,TextPad*,Lines,Result,5

3. DERequest>TextPad,C:\Data\Neast\RMB\DDETest.txt,Lines, Result,5

4. DDERequest>TextPad,TextPad - C:\Data\Neast\RMB\DDETest.txt,Lines,Result,5

5. DERequest>TextPad,C:\Data\Neast\RMB\DDETest.txt, Properties,Result,5

=============================
I am pretty sure that my problem is the second parameter, the Topic value. I am trying here to use the name of a TextPad window.

It would also seem that perhaps I need to use VB to create objects before I can use Topics or methods?

Can someone also recommend a source of Topics commands/methods?
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Wed Feb 19, 2003 6:48 pm

Hi,

According to the TextPad help file the only commands available are:

DDE Commands
The following DDE commands are recognized. They are all part of the "system" topic.

Command: Function:
[open("filename")] Opens the specified file using the default code set.
[opendos("filename")] Opens the specified file using the DOS (OEM) code set.
[command(Append,"string ")] Appends the string to the active document.
[command(SaveAs,"filename")] Saves the active document with the given name.
[command(Save)] Saves the active document.


These commands must be passed exactly as shown, with no embedded spaces, except in the quotes.

Note that the topic is not used to specify the document, so Append, Save and SaveAs all apply to the active document.

So you won't be able to get the number of lines using DDE.
MJT Net Support
[email protected]

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Wed Feb 19, 2003 9:04 pm

Lots of questions answered, thanks, but.......not there yet.

1. In the future I will check eqch program's Application Help for list of DDE commands.
2. Looking at TextPad it would seem that only DDEPoke can be used.
3. Using DDEPoke I was unable to save the open file in TextPad under another name.

Test Notes:
Document "DDETest.txt" is being edited in TextPad.
Trying to save it as "C:\Data\Neast\RMB\DDETest2.txt"

Tried six different forms of syntax with no file being copied:

1. DDEPoke>TextPad,SaveAs,C:\Data\Neast\RMB\DDETest2.txt,

2. DDEPoke>TextPad,SaveAs,"C:\Data\Neast\RMB\DDETest2.txt",

3. DDEPoke>TextPad,(SaveAs,"C:\Data\Neast\RMB\DDETest2.txt"),

4. DDEPoke>TextPad,(SaveAs,"C:\Data\Neast\RMB\DDETest2.txt"),,

5. DDEPoke>TextPad,SaveAs,,C:\Data\Neast\RMB\DDETest2.txt

6. DDEPoke>TextPad,SaveAs,,"C:\Data\Neast\RMB\DDETest2.txt"
==========================

MS Syntax is DDEPoke>Server,Topic,Item,Data

From TextPad I used the following:
Server = TextPad

Topic = SaveAs,"filename"
OR SaveAs,filename
OR (SaveAs,"filename")
OR SaveAs

Item = "filename"
OR filename
OR (blank)

Data = (blank)
or filename
OR "filename"

The six lines I did were using those combinations, searching for the correct format. No luck.....

I am sure I will see the correct answer on your reply. Thanks....
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Wed Feb 19, 2003 9:17 pm

Hi,

Sorry, I can't get any of them to work either. It is not clear from TextPad's help file what the correct syntax should be. I think we might have to consult the makers of TextPad. I'll have a look at their website and let you know if I come up with anything.
MJT Net Support
[email protected]

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Wed Feb 19, 2003 9:26 pm

It doesn't even say what the Server name should be let alone the syntax for item and data.
MJT Net Support
[email protected]

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Wed Feb 19, 2003 11:51 pm

Well, that makes me feel much better! :D I am not alone.

I looked at MSDN literature for DDE and concluded that the application would be used as the Server. But that was part of overall DDE documentation, and I know that you have made the Macro Scheduler DDE commands easier for us to use. Maybe if TextPad is the Server, as I thought, perhaps it also has a particular spelling/syntax/version to be identified.

Thanks for your effort on this.....looking forward to results.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Thu Feb 20, 2003 6:31 pm

Hi,

I sent an email to TextPad support and got the following response:

====
The Server is TextPad, but you can only use the DDE commands that are
listed in the Help files.


If you aren't already using TextPad 6.2, please install this form our
web site. Version 6.1, installed TextPad in the wrong Directory, so
this could cause the DDE commands to fail.


http://www.textpad.com/download/index.html
====

So I uninstalled TextPad 4.6.1 which is the version I had and downloaded TextPad 4.6.2 (he means *4*.6.2 of course), but it made no difference. His email didn't provide any more clues regarding the correct syntax.

It is clear however that the System name is 'TextPad' and the topic is 'system'. If you issue a DDERequest or DDEPoke with these set and anything else in Item and Data it will appear to attempt to do something and then timeout. If TextPad is closed you will get DDE_INVALID_SERVER. If you change the topic name it will do nothing and finish immediately. So it is connecting, but without any clear understanding on the Item and Data format, we're unlikely to get any further.
MJT Net Support
[email protected]

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Fri Feb 21, 2003 1:07 am

I appreciate your efforts. I also went to the forum for TextPad and left a request for help there also.

I will keep this forum advised, but the quality of assistance with that group does not seem to be the same high quality that we have here.. Time will tell if a solution shows up.

Thanks again for the help.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts