Author |
Topic  |
|
OndrejM
Australia
Posts |
Posted - 06/06/2007 : 03:17:24 AM
|
Hi All,
I would need to make Controlled Label/Button which would load a file. Since I dont have any programming background everything what I was able to do is just following:
1. I created a button 2. and to its label control I wrote: open w c:\paht to the file
it works, but a problem is that in my file the column' names are in 48th row, so I would need somehow to specify that first 47 rows should be ignored and that column names should be read from 48 row. I also created filter by means of the "import wizard" but I don't know how to use it in label control.
if some of you have any suggest please let me know, everything can help
Thank you in advance Ondrej
|
|
Mike Buess
USA
3037 Posts |
Posted - 06/06/2007 : 07:01:54 AM
|
Hi Ondrej,
Use this for your label control script...
ascimport.filename$="c:\path"; ascimport.headerlines=47; // ignore first 47 lines ascimport.subheaderlines=0; ascimport.renamecols=1; // take col names from line 48 ascimport.delimited=1; ascimport.delimiter=0; // unknown delimiter ascimport.import();
Mike Buess Origin WebRing Member
Edited by - Mike Buess on 06/06/2007 09:57:51 AM |
 |
|
OndrejM
Australia
Posts |
Posted - 06/06/2007 : 6:38:23 PM
|
Hello Mike,
Thank you very much for your extremely fast answer, it works perfectly! I have only one small problem because I would like to import a file to not active worksheet, e.g. I prefer to have label/button in a Graph Window and I want to import the file to worksheet, so Ive tried to add the following line to your script window a data1 but it doesnt work I also tried to specified import like this ascimport.import(data1) but it also doesnt work,
Sorry bother you with such a stupid problem but I cant solve it out,
Anyway thank you very very much for your help
Regards Ondrej
|
 |
|
Mike Buess
USA
3037 Posts |
Posted - 06/06/2007 : 10:20:03 PM
|
quote: Ive tried to add the following line to your script window a data1; but it doesnt work
As long as Data1 exists and you put "window -a data1" at the start of the label script there is no reason that should not work. You can also start the script with "window -t D;" to import to a new worksheet. But why would you want to do that from a graph window? I thought you wanted to put the button on a worksheet.
Mike Buess Origin WebRing Member |
 |
|
OndrejM
Australia
Posts |
Posted - 06/06/2007 : 10:54:22 PM
|
Hi Mike,
I do modelling and the modelling program is alway rewriting one file e.g. c:\VSSC\vssc.dat,... since I need to visualize the results of the performed modelling I wound need to have a control button on pre-prepared graph window and just read new rewritten file and visualize results, Im not sure if you know what I mean,
It is working now like this:
ascimport.filename$="c:\VSSC\vssc.dat"; ascimport.headerlines=47; // ignore first 47 lines ascimport.subheaderlines=0; ascimport.renamecols=1; // take col names from line 48 ascimport.delimited=1; ascimport.delimiter=0; // unknown delimiter win -a data1; ascimport.import(); win -i data1; win -z graph1;
I think now you can see what I want to do, it works but I dont know if this is the best way how to write it,.. because at the end of the script Im minimalizing the worksheet (data1) and maximalizing the graph (graph1), so it is doing such clicks on the screen I would prefer to somehow load the file (vssc.dat) on the background of the graph window and just see the results of my model,
maybe Im confusing you now, sorry,
anyway thank you very much I wouldnt be able to do this without your help,
Regards Ondrej
|
 |
|
Mike Buess
USA
3037 Posts |
Posted - 06/06/2007 : 11:06:44 PM
|
OK, Data1 is always plotted in Graph1 and you just want to update Data1 from file. The following script avoids the necessity of restoring Data1 and minimizing it afterwards...
win -o Data1 { ascimport.filename$="c:\VSSC\vssc.dat"; ascimport.headerlines=47; // ignore first 47 lines ascimport.subheaderlines=0; ascimport.renamecols=1; // take col names from line 48 ascimport.delimited=1; ascimport.delimiter=0; // unknown delimiter ascimport.import(); }; layer -a; // rescale Graph1
Mike Buess Origin WebRing Member |
 |
|
OndrejM
Australia
Posts |
Posted - 06/06/2007 : 11:40:01 PM
|
wow! it works great! that exactly what I need,... thank you very much!
have a nice day/night (don't know what the time shift)
Ondrej
|
 |
|
|
Topic  |
|