The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 How to select windows or datasets?

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
tib Posted - 02/07/2002 : 07:46:02 AM
How can I create a dialog where I get and select from a list of all existing worksheets, matrices, worksheets, (any sort of windows) or a even special selection of datasets?

Let's say I have 200 worksheets all with the same structure of 10 columns each. I want to select some worksheets (maybe 20 or 30) and from each of them plot the 5th Y-column versus the 8th Y-column into one graph. If you have to have to do this by hand that will drive you crazy...

The following script won't work for me
%Z="";
doc -e W {
%Z=%Z %H; // add worksheet name;
};
getnumber (Select Worksheet) (SEL:Z) (Select);
type Your selection was %[%Z,#SEL];

since %Z is limited to 6290 bytes (characters).
And furthermore, you can select only one worksheet at a time.
I also cannot inlcude the plot routine it into a loop during import (like another example ) because these worksheets exist already. I don't want to import and do all the calculations again.

Isn't there anything like the file dialog fdlog.MultiOpen() and fdlog.get()?

Thanks, Tilman.
10   L A T E S T    R E P L I E S    (Newest First)
tib Posted - 02/08/2002 : 2:49:31 PM
Mike,
that's telepathy. I just found out the same thing. Not all the files where in the list. It varied from time to time. So, I also introduced a delay time. Now it seems to work. The only thing which is not that beautiful is the short flicker of the black DOS screen. OK, I shouldn't make to heavy demands. Tilman.
Mike Buess Posted - 02/08/2002 : 2:19:32 PM
Tilman,

There is one caution about using the run -e DOS command method in a script. Origin thinks it's done when it executes run -e and executes the next line of script immediately. That shouldn't be much of a problem in your case, but it's probably a good idea to follow the run -e command with a pause...

run -e DOS Command;
sec -p 0.1;

0.1 seconds should be long enough for your DOS commands to complete.

Mike Buess
Origin WebRing Member
tib Posted - 02/08/2002 : 1:50:00 PM
Hi Mike,
oh yeaahh, you are great! This is not the solution for the OFileMan package problem but yet another workaround .
I'd better skip the OFileMan module and empty my directory as you said by using
run -e cmd.exe /c del "%YWorksheet\*.";
This will delete all my temporary worksheets. Since they have no extensions you can write *. instead of *.* so that you won't be asked by the DOS window to confirm the deletion.
Many thanks again, Tilman.
Mike Buess Posted - 02/08/2002 : 1:08:09 PM
Tilman,

I'd execute a simple DOS command with the run command. This will work if you're running Win9x...

run -e command.com /c md "%YWorksheet";

If you're running NT4 or Win2k use cmd.exe rather than command.com. See Executing DOS commands for more details. Actually, you could use the same method to empty the folder.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 02/08/2002 13:09:14

Edited by - Mike Buess on 02/08/2002 13:10:28
tib Posted - 02/08/2002 : 10:34:58 AM
Thanks Mike,
but in the meantime before I read your helpful answer I spent more hours of unproductive search why things don't work as expected and I finally found that I have to double click on the OPK module to install it. But I got a message like "This does not work with your Version of Origin". After an other unproductive while I noticed that although I'm registered my registration ID was not entered in the Help|About.
But once again, a straight forward message like "To use this package you have to enter your registration ID" would have helped much more.
OK, now I'm one little further
1. Next, I want to empty a directory.
2. It doesn't seem that wildcards FM.delFile(*.*) are allowed.
3. OK, let's delete the whole directory with FM.DelFolder(%YWorksheet\)
4. The files were deleted but the directory was not removed (not as described in the documentation).
5. FM.= showed me that there was an error code = 32
6. In the documentation it says detailed description of errors can be found in winerror.h
7. I couldn't find any file winerror.h on my harddisk.

OK, that's fine with me if the directory is not deleted.
But
8. assuming that the directory was removed as it should be,
or if I want to create a new one how do I that with LabTalk?

A more detailed and thorough documentation would help me a lot. Am I the only one?
Another sign of lack of thoroughness is the duplicate //Clear Text$array headline in the documentation...
Mike Buess Posted - 02/08/2002 : 07:12:58 AM
I don't think you actually installed it. Either double-click on ofileman.opk or drag it to the Origin program window. Afterwards you will find the files Ofileman.dll and Ofileman.doc (instructions) in %Y.

fm.= types a list of fm properties and methods to the script window. Works for any Origin object.

As far as I know the only documentation error concerns fm.delfile();

Mike Buess
Origin WebRing Member
tib Posted - 02/08/2002 : 06:52:29 AM
Sorry, Mike, but the OFileMan package does not work as expected. I have Origin 6.1 SR4. Do I need OriginPro for that? (if so, could this hint be put into the documentation?)

What I did. Copy OFileMan.opk into %Y and typed in the script window according to the documentation...

dll -a FM ofileman;
fm.=; // actually what is this command good for?
FM.=--
fm.path$=%Y;
#Command Error!

What am I doing wrong? Or am I just too stupid to understand the documentation?

As you pointed out in an earlier discussion with marko the OFileMan documentation is not correct (example FM.delFile()). In general, please, dear Origin Administrators, if you read this, please correct known errors, misleading or missing information as soon as possible. For you it might only take a few minutes but it avoids wasting considerable more time of many users. Thanks! Tilman.
Mike Buess Posted - 02/07/2002 : 4:18:08 PM
Tilman,
quote:
1. You mentioned that it's of course necessary to empty the %Y\worksheets directory. It would be nice if I could do this also with LabTalk. Of course, I couldn't find a link in the manual to delete files on disk. Maybe you know how?
Try the OFileMan utility on Origin's Add-on Modules page. It works fine as long as you are using Origin 6.1.

I haven't examined your script for extracting the filename closely, but it looks like it should work.

You can be sure that you're not the first to strive for automated data processing. I've been running experiments off-site lately where I set off the runs and come back two or three days later to collect the results. I often have 100 data files waiting to be analyzed and have been honing my batch processing scripts to cope with them.

In any case, I'm glad this workaround "worked" for you. One of the things I've learned to appreciate about Origin is that a workaround can almost always be found when a feature you need seems to be missing.

Mike Buess
Origin WebRing Member
tib Posted - 02/07/2002 : 3:35:34 PM
Mike, thanks a lot! It works fine.
I slowly get used to workarounds in LabTalk since quite a few straight forward methods or functions do not exist.

But two little questions to your approach:

1. You mentioned that it's of course necessary to empty the %Y\worksheets directory. It would be nice if I could do this also with LabTalk. Of course, I couldn't find a link in the manual to delete files on disk. Maybe you know how?

2. In the example below I'm only interested in the filename. Is this the way you would extract it?

doc -e W {file -c "%Yseed.txt" "%YWorksheets\%H"};
if (fdlog.MultiOpen()!=0/0) {
%P=fdlog.path$;
loop(ii,1,fdlog.Multiopen.count) {
fdlog.get(A,ii);
%A=%[%A,%[%P]+2:%[%A]]; // extract only the filename;
type %A;
run.section(,WhatEverYouWantToDo);
};
};

You won't believe it, but I have built a setup where a lot of data is measured automatically. Since it's so many data I of course have to plot and analyze it automatically. And I almost cannot believe it that I'm the first one to wish for such features. Maybe, I should have a look at OriginPro. But I hesitate to change my limping horse.
Mike Buess Posted - 02/07/2002 : 10:43:16 AM
Tilman,

You can get around the character limit by using an INI file to hold the plot names (and whatever information you need). You can easily build a list with multiple-selectability (real word?) using the Dialog Builder that comes with OriginPro. (I just made one for my own use.) If you don't already have OriginPro perhaps it's time you upgraded, especially considering your passion for automation.

Having said that, there might be a way that you could use fdlog.MultiOpen() to do what you want in the meantime. It's rather convoluted and I'm not sure I would use it myself, but here it is in case you're interested...

1. Create a subfolder called Worksheets.
2. Choose any file in you Origin program folder as a "seed". It can even be a 0-byte text file you created yourself. Call it seed.txt.
3. Use the following script:

doc -e W {file -c "%Yseed.txt" "%YWorksheets\%H"};

4. Use fdlog.MultiOpen() to select files with your worksheet names and fdlog.get() to access your selections.

I don't see why it won't work... you just need to empty the Worksheets folder between uses. Simple enough to try, at least.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 02/07/2002 10:47:01

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000