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
 Forum for Origin C
 Insering OriginC program as a menu item
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

rikseventyseven

Switzerland
10 Posts

Posted - 06/22/2009 :  10:34:07 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. 8.0987
Operating System: Win XP

Ok, the problem is simple. I wrote an originC program which compiles and run absolutely fine.
Now I wont to create a new entry in one of the Menu (Analysis) in order to run the program by a simple click.

I followed the procedure described in the manual:

- Made a small script that defines the menu;
- Changed the INI file in order to call the script above
- Restarted Origin...

And it does not work!
The LoadOC function returns 1 and the menu is not created.
The weird thing is that when I copy and paste the script in the command window it works perfectly and the menu item is there...

what is wrong?!

---------------------------------------------------
menu -wg; // available for worksheet or graph
menu 7; // activate View menu
// define menu command text and script
menu (SuperProgram)
{
int err;
err = run.loadoc("Super.cpp");
if (err!=0)
{
type -b "Cannot load file Super.cpp";
}
else
IJoint;
};

-------------------------------
"Stay hungry, stay foolish."

rikseventyseven

Switzerland
10 Posts

Posted - 06/22/2009 :  10:35:32 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I realized that I miscopied the script:

menu -wg; // available for worksheet or graph
menu 7; // activate View menu
// define menu command text and script
menu (SuperProgram)
{
int err;
err = run.loadoc("Super.cpp");
if (err!=0)
{
type -b "Cannot load file Super.cpp";
}
else
Super;
};

----------------------------------------------------

Actually when origin start the script is executed but the error message is displayed...

-------------------------------
"Stay hungry, stay foolish."
Go to Top of Page

rlewis

Canada
253 Posts

Posted - 06/22/2009 :  12:33:43 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Perhaps the OC compiler was not finding your file ...
The following example was taken from one of my scripts that I use to do more or less what you have been trying to do

Hope this helps ...


menu -w;

menu 1; // File menu

/////////////////////////////////////////////////////////
// RNAHL's Special Import Scripts                      //
/////////////////////////////////////////////////////////
menu -L -i 17 (Import S&pecial);

menu "CSC MC-DSC Files H? and C? Files" {
      #Import CSC MC-DSC datafiles
	%J=System.Path.Program$;
	%J=%JOriginC\system\rnahl\;
	if(run.loadOC("%JImportSpecial\MultiCellDSC\HartConv.c")!=0)
	{
		ty -q Cannot Load Origin Support File HARTCONV.C;
	}
	else
	{
		ty -q Loading Origin Support FIle HARTCONV.C;
		Read_Hart_HC_DataFiles();
		
	}      
                                        };

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