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
 Expressing strings between { }
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

jc001

UK
7 Posts

Posted - 12/19/2001 :  10:12:59 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Has anyone any idea how to force Origin
to express a String variable in a command
taking a script argument between {}?

I have a loop where menu commands are
created, I want to create a generalized script associated with each command.

Something like:
...
%T=;
menu (New Command) {%T};
...

%T remains unexpressed in the newly created command.

Any ideas? Thanks.

Mike Buess

USA
3037 Posts

Posted - 12/19/2001 :  1:56:46 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I don't think you can do that, but you can accomplish the same thing with menu IDs and an INI file. For example, say that you want to add three new menu commands to the Tools menu in Origin.

First create an INI file like this...

;MyMenus.ini
[Config]
numCmds=3
Cmd1=First Command
Cmd2=Second Command
Cmd3=Third Command


Next create a script file...

// MyMenus.ogs
[MakeMenu]
menu -w; menu ?To;
ini.get.filename$=%YMyMenus.ini;
loop(ii,1,ini.Config.numCmds) {
%A=ini.Config.Cmd$(ii)$;
menu (%A) {run.section(MyMenus,Execute)};
ini.Config.ID$(ii)=menu.lastID;
};
[Execute]
ini.get.filename$=%YMyMenus.ini;
loop (ii,1,ini.Config.numCmds) {
if(ini.Config.ID$(ii)==i) break;
};
run.section(,Cmd$(ii));

[Cmd1]
// First Command scripts...

[Cmd2]
// Second Command scripts...

[Cmd3]
// Third Command scripts...
The MakeMenu section adds the following items at the end of the Tools menu and records their menu IDs in MyMenus.ini.

First Command
Second Command
Third Command

When the user selects one of these commands its menu ID is passed via the variable 'i' to the Execute section, which then runs the appropriate command scripts. Normally its easier just to create the menu items explicitly...
menu (First Command) {run.section(MyMenus,Cmd1)};
menu (Second Command) {run.section(MyMenus,Cmd2)};
etc.
But there have been a few situations where I've found this method quite useful.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 12/19/2001 13:58:42

Edited by - Mike Buess on 12/19/2001 14:03:29

Edited by - Mike Buess on 12/19/2001 14:04:59
Go to Top of Page

jc001

UK
7 Posts

Posted - 12/20/2001 :  12:41:48 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thankyou, after a bit of head scratching I pretty much hit upon the same solution.

I have found a similar type of behaviour when searching text strings. The undocumented structure %[%A,""], returns text to the right of the when it finds it in %A, but will return NULL when is anything but an explicit string, i.e.
%B="";
%[%A,"%B"]=;
--
even if occurs in %A.

I haven't found a work around for this at present.
Go to Top of Page

jc001

UK
7 Posts

Posted - 12/20/2001 :  12:47:06 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Apologies, my previous reply was misformatted, here it is again:

Thankyou, after a bit of head scratching I pretty much hit upon the same solution.

I have found a similar type of behaviour when searching text strings. The undocumented structure %[%A,"search string"], returns text in %A to the right of 'search string' when it finds it in %A, but will return NULL when 'search string' is anything but an explicit string, i.e.
%B="search string";
%[%A,"%B"]=;
--
even if 'search string' occurs in %A.

I haven't found a work around for this at present.
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