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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 getnumber
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Stefan B

Germany
10 Posts

Posted - 12/09/2016 :  2:52:22 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi,

I am improving the interface of my scripts. Therefore i have a few questions.

1) I was reading getn commands examples. I found this:

// Use :@BB for file and graph browsing
string fname$ = "C:\myproject.opj";
string grname$ = "Graph1";
getn (File Name) fname$:@BBFile (Graph) grname$:@BBGraph (Test @BB);
type fname$;
type grname$;


The description says , that i can choose multiple files, but it simply doesn't work. I can choose only one file. Can i somehow change this ?

2) Beside that i want to create the dialog box, where user chooses, whether to sort the columns after import on not. I have two concepts:

a) User chooses it like on this example : (in the box should be descending and ascending order, the text in the example is wrong ) :



b) User just mark the field if he wants to change the default order
(the text in the example is wrong):



I want to connect these operations (marking one of the fields) with some variables. For instance when the field (in second idea) is marked by user- the value of variable - int n=1; , if not n=0;

Best Regards,
Stefan B.

Edited by - Stefan B on 12/09/2016 2:55:21 PM

Hideo Fujii

USA
1582 Posts

Posted - 12/09/2016 :  3:55:23 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Stefan B,

First, let me write just for 1):

> The description says , that i can choose multiple files, but it simply doesn't work.

As the document(http://www.originlab.com/doc/LabTalk/ref/GetNumber-cmd#Using_Origin_C.27s_GetNBox_from_LabTalk)
says, "some allow browsing for more than one item. These are simply plural", you can write like:
getn (File Name) fname$:@BBFiles (Graph) grname$:@BBGraphs (Test @BB);
Works?

--Hideo Fujii
OriginLab


Edited by - Hideo Fujii on 12/09/2016 3:57:50 PM
Go to Top of Page

Stefan B

Germany
10 Posts

Posted - 12/09/2016 :  6:14:56 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Hideo,

Of course it works :). I cannot belive, that solution is so simple. Sorry about that. I also added GetToken command so now i can use this window instead of dlgfile.


If u have any idea regarding question 2, i'd be really grateful.

I want to unify four dialogboxes i have in my sripts into one.

Problem solved, but i have an issue during testing :

int cancel;
for(i=1;i<3;i++)
{
run.section(,Menu);
if(cancel==1)
type -b error;
else 
type -b Ok;
};

[Menu]
j=0;
k=0;
cancel=1;
getn (Name 1:%(CRLF)second) str$ (Name 2:%(CRLF)) str1$  (File Name) fname$:@BBFiles (Option 1) j:2 (Option 2) k:2 (line1%(CRLF)line2%(CRLF)line3);
if(fname$=="")
break 1;
int count = fname.GetNumTokens(CRLF);
count=;
cancel=0;


When user doesn't choose any file or just press cancel button script should open dialogbox with message "error", if user chose files script should open dialogbox with message 'OK'.

Everytime i press cancel button or don't choose file script ends with following message in command window (it also happens happens everytime after the last iteration of the loop):

[Menu]J is illegal name for defining a variable
unknown error in expression assignment


I think, that script should work fine. What can be the reason ?

Best Regards,

Stefan B.

Edited by - Stefan B on 12/09/2016 9:17:42 PM
Go to Top of Page

yuki_wu

896 Posts

Posted - 12/10/2016 :  12:59:15 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Stefan,

I think “If” is better than “break” in this case.Please try:

if(!fname$=="")
{
    int count = fname.GetNumTokens(CRLF);
    count=;
    cancel=0;
}


Regards,
Yuki
OriginLab
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000