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
 Origin Forum
 excel to origin 5.0
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

kevin

1 Posts

Posted - 07/18/2000 :  8:45:00 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
I am trying to automate the process of copying data out of an excel spreadsheet and pasting it into a origin spreadsheet to graph. I am new to origin, and am trying to find a way to run script to paste off the clip board after I launch origin (version 5) from excel. Is there anyway to run script on the startup of origin. Or maybe a better way to so this (DDE?). Thanks

Gary Lane

USA
150 Posts

Posted - 07/20/2000 :  2:08:00 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply

Hi,

You have at least a couple of options. The first option would be to use DDE to execute a LabTalk script. I am by no means a VB or DDE expert so you probably know better than I how to do this but basically after launching Origin your VB script should execute a command similar to

DDEExecute OriginId, "run.section(FileName.OGS,SectionName);" 'run section of script file

A second option would be to place the script in a text label button on the default Origin.OTW worksheet template and then trigger the script to execute on Window Create. To create a text label button click the New Worksheet button to create a blank worksheet and then use the Text tool ( T ) on the Tools toolbar to place a text object on the newly created worksheet. Right-click on the text object, select Label Control, uncheck the Visible checkbox (if you want it to be invisible), select Window Create from the Script, Run After list box, and then enter the script

run.section(FileName.OGS,SectionName);

in the large white edit box. Finally, save the new worksheet with the text label button as a worksheet template named Origin.OTW. Whenever a new worksheet based on this template is created (like when Origin is launched) the script in the text label button will be executed. You will need to set up some sort of conditional mechanism to make the script not execute when you don't want it to (like when subsequently clicking the New Worksheet button).

No matter which method above you choose you will also need to create a text file in the Origin software folder named FileName.OGS (of course you can choose your own filename) containing the text

[SectionName]
// SectionName can be of your choosing as well
worksheet -s C1 0 C2 0; // select columns C1 through c2 in active worksheet
domenu 57637; // execute the Origin 5.0 Edit:Paste menu item

That should just about do it but there are a few other things you might also want to consider:
1. Menu id's can change from Origin version to Origin version so your script may not always be portable (the menu id for this menu item happens to be the same in Origin 6.0 so that should not be a problem here).
2. There is no way for users to acquire a given menu id in Origin 5.0 but in Origin 6.0 (and beyond) simply open the Script window and hold down the CTRL + SHIFT keys while selecting the desired menu item. The menu item does not get executed but the menu id of the selected menu item gets typed to the Script window.
3. Rather than Copy/Pasting data you might want to consider opening the Excel Workbook in Origin. Try the document -a LabTalk command. See the [OpenExcel] section of the text file File.OGS for example code. You can open the Workbook as either an Excel Workbook or as an Origin Worksheet.

This should get you started. Thanks for a hearty question.

-Gary

[This message has been edited by Gary Lane (edited 07-20-2000).]

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