| Author |
Topic  |
|
|
bmmaoso
Colombia
Posts |
Posted - 10/26/2004 : 09:39:15 AM
|
Origin Version (Select Help-->About Origin): 6.0 Operating System:xp - 2000
Hello!
I am connecting origin to a server program, and the connection is ok, but I need to active the item in the server and it doesn't work:
dde -c TPRUN|INBED47.tst idinbed; //this connection works good dde -r idinbed create data (F4); //this is to request one item in the server, but it doesn't work.
Can someone help me to find what is wrong??
Thank you very much
Maria |
|
|
Mike Buess
USA
3037 Posts |
Posted - 10/26/2004 : 12:38:28 PM
|
Hi Maria,
The syntax for that command is dde -r varID item. In your case item is create data (F4). I'm guessing that Origin only reads the first token and ignores the rest. You might try quoting your item...
dde -r idinbed "create data (F4)";
Mike Buess Origin WebRing Member |
 |
|
|
bmmaoso
Colombia
Posts |
Posted - 10/26/2004 : 1:35:15 PM
|
Hello Mike,
Thank you for your answer, but I already tried and it didn't work.
Do you have another suggestion?
Thanks, Maria |
 |
|
|
Mike Buess
USA
3037 Posts |
Posted - 10/26/2004 : 2:26:13 PM
|
You can try the following, but I doubt if it will work any better...
%A="create data (F4)"; dde -r idinbed %A;
'create data (F4)' looks like a command. Are you sure you shouldn't be using the -e option rather than -r? (Execute instead of request?)
...In fact 'create data (F4)' is an Origin command which creates a dataset called data with F4 rows. dde -r merely assigns the value of the requested item (F4?) to the string variable %Z. Perhaps you should try something like this...
dde -r idinbed F4; nrows=%Z; create data nrows;
That will create a dataset with F4 rows but the elements will either be undefined (--) or zero.
Mike Buess Origin WebRing Member
Edited by - Mike Buess on 10/26/2004 2:47:35 PM |
 |
|
|
bmmaoso
Colombia
Posts |
Posted - 10/27/2004 : 08:15:51 AM
|
Hello Mike!
I tried what you told me but it didn't work. I am afraid I am using the wrong command!
What I want to do is to import in origin one data file generated by the server program and use the DDE command to connect these programs and update the information in real time. Then I will make some graphs and I want to update them in real time too.
The first step is to the connection, and it works. But I am not sure what command use to update all the information. I just realized that I don't need to execute in the server the "create data (F4" command, I just need to import all the data created.
If I have imported the data file is it supposed to be updated automatically? or is there any command to do it?
Thanks a lot for your help
Maria |
 |
|
|
Mike Buess
USA
3037 Posts |
Posted - 10/27/2004 : 10:40:39 AM
|
If you have successfully imported the data to a worksheet the new data should appear automatically. However, you can use doc -uw (with wks active) to make sure. If you're plotting the data you may need to update the graph with plot -c.
So the question is: are you successfully importing the data? There are a number of ways to exchange data via DDE...
1. Get the values one cell at a time with dde -r. 2. Get a column with dde -rc. (You have some control over where to place the data in the Origin wks column.) 3. Get a row with dde -rr. (Similar options.)
If your DDE server app actually saves the data to file you have a fourth option...
4. Use dde -r to get the path\name of the file and then import the file using standard Origin methods.
Which method are you using?
Mike Buess Origin WebRing Member |
 |
|
|
bmmaoso
Colombia
Posts |
Posted - 10/27/2004 : 5:54:50 PM
|
Hi Mike!!
Thank you for your answer. I was looking for something like the fourth method. But at the moment I have a problem with the server, so I can not check if it will work ok or not. But I am not sure how to specify the path, because the data file name is different every day (i.e. D27M10.y04, D28M10.y04, etc):
dde -c TPRUN|INBED47.tst idinbed; dde -r idinbed C:\INBED\DATA\D27M10.y04; //will it be something like this? may be I will put a dialog box to ask the date and then put in the path.
Thank you very much
Maria |
 |
|
|
Mike Buess
USA
3037 Posts |
Posted - 10/27/2004 : 7:21:09 PM
|
Hi Maria,
In that case you don't need DDE at all. Origin's @D system variable holds the current Julian date which can be formatted as something sensible with $() notation. For example, today (27 Oct 2004) I typed this in the script window to get the date...
%A=$(@D,D0); %A=; 10/27/2004
You can generate today's file name like this...
%A=$(@D,D0); %M=%[%A,#1,/]; // first token (/ separated) is the month %T=%[%A,#2,/]; // second token is the day %V=%[%A,#3,/]; // last token is the year %V=%[%V,>3]; // last two characters of year %A=D%TM%M.y%V; // file name %B=C:\INBED\DATA\; // file path win -t D; // open new wks open -w %B%A; // import file
Single digit days and months are not padded by the $(@D,D0) format so 9 September 2004 becomes 9/9/2004. If the file name for that date is D09M09.y04 you can pad with 0 like this...
if(%T<10) %T=0%T; if(%M<10) %M=0%M;
Mike Buess Origin WebRing Member |
 |
|
|
bmmaoso
Colombia
Posts |
Posted - 10/28/2004 : 05:06:00 AM
|
Hi Mike!!
Thanks a lot. I will test the script when the server is ok again. You helped me a lot.
Thank you.
Maria |
 |
|
| |
Topic  |
|