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
 why copypage can not copy the same way...
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

rezahasi1

Bangladesh
Posts

Posted - 08/05/2004 :  05:34:40 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
I am stucked while using using origin as an automation server.
The command "copypage" can not copy the graph as the same way as I can do when I use from the edit\toolbar command. Especially, when I paste the graph from the clipboard after copying it does not show the axis title at all. I don't want to use export command to export as BMP etc.. I just want to copy the graph into the clipboard as the option defined by the origin's option. Is it difficult? By the way, I tried to use copypage as
invoke(originObj, 'CopyPage', 'Graph1');

Anybody could me help out of this?

Thanks

easwar

USA
1964 Posts

Posted - 08/05/2004 :  11:54:21 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

The Edit->Copy Page menu item places an EMF file of the graph on clipboard. The automation server CopyPage method, by default, places a WMF file - however user can specify EMF instead - see documentation on this method in the programming help file.

However, the problem you are encountering may not have to do with EMF/WMF. When you say "it does not show the axis title at all", do you mean that once you run this method, if you go to say another application like MS Word and paste the image that was stored to clipboard you do not see axis title? If yes, I suggest the following: Try copying the very same graph manually to clipboard using the Edit->Copy Page menu item, then paste in destination application, and see if you have the same problem. If yes, it could be due to a setting in Origin that defines what gets copied. Look under Tools->Options->Page. The settings there such as margin control etc which affect what part of the graph gets exported/written to clipboard. Try setting the margin control to Page.

Another test would be to run the example included in Origin under \Samples\Automation Server\MATLAB\CreatePlotInOrigin.m
and then go to Word and paste the image placed on clipboard. Does that graph appear correctly? (I am assuming you are using MATLAB as the client)

Easwar
OriginLab

Go to Top of Page

rezahasi1

Bangladesh
Posts

Posted - 08/06/2004 :  01:14:52 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,
Thank you very much for the info. But I see a funny thing thing. Using the original example, it can sometimes (!) copy correctly and if I paste the graph from clipboard it works fine (luckily sometimes, but could not find out when). Is there any compatibility isssue.

Do you see any clue?

Thanks


Edited by - rezahasi1 on 08/06/2004 01:47:13 AM
Go to Top of Page

rezahasi1

Bangladesh
Posts

Posted - 08/06/2004 :  02:26:56 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Now I could figure out the problem while playing with it. When I go to another application to paste the graph copied first time, everything works fine. But when I run the code again, the axis titles disappear. But if I click the graph first in origin, and after then if I run the code, it can successfully copied with axes title. That means, the whole page (with axis) is not activated (!) when origin is not on the foreground. I call the copy command as

invoke(originObj, 'CopyPage', 'Graph1');

I could not find a workaround in the help file. Hope that any body could figure out the solution. I am using exactly the same matlab example given in the sample folder. You could notice the problem, if you run the code more than once successively.

I more important info, I am using the existing instance of origin to connect from matlab. However, later I figure out that the problem does not occurr if I use new instances of origin each time. But this inconvenient and I need to use the existing visible origin window.

thanks to all.


By the way, also, how can get the graph or worsheet name as output to exaternal program?

Edited by - rezahasi1 on 08/06/2004 03:40:43 AM
Go to Top of Page

easwar

USA
1964 Posts

Posted - 08/06/2004 :  2:51:40 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:

I am using exactly the same matlab example given in the sample folder. You could notice the problem, if you run the code more than once successively.


Hi,

First of all, if you have not patched your Origin 7.5 to SR4, I recommend doing that.

I tried the MATLAB m-file example from 7.5SR4 repeatedly as you suggested. I tried connecting to same Origin repeatedly, and launching a new instance each time. Also tried keeping the Origin session hidden, and keeping it visible.

I do not see the problem.

Now, one possibility is this: Is the graph you are exporting to clipboard hidden in Origin? If that is the case, it is possible that the entire graph does not get exported. So I recommend that you keep the graph not hidden within Origin. You can still keep the entire Origin application hidden if you want to.

Now, regarding your question on how to get the graph name or worksheet name to external program, I presume you are asking how to get a list of all graph and worksheet names from Origin into MATLAB, as you asked in an earlier post:
http://www.originlab.com/forum/topic.asp?TOPIC_ID=3272

There is no automation method/property available currently to do that dierctly. You will need to send script commands to Origin to get the names such as in the MATLAB code pasted below. Note that the code below just returns all graph names in one string separated by spaces etc. Same for all worksheet names.

If you instead want an array of strings, you may need to write more script, or call an Origin C function that will return such an array back to MATLAB.

Easwar
OriginLab


originObj=actxserver('Origin.ApplicationSI');

% Make the Origin session visible
invoke(originObj, 'Execute', 'doc -mc 1;');

% Send script command to Origin to store all graph window names in %z
invoke(originObj, 'Execute', '%z=""; doc -e p {%z=%z %h};');
% Declare a string variable and get %z from Origin into this variable
strGraphNames = '';
strGraphNames = invoke(originObj, 'LTStr', '%z');
fprintf('%s\n', strGraphNames);

% Send script command to Origin to store all worksheet window names in %z
invoke(originObj, 'Execute', '%z=""; doc -e w {%z=%z %h};');
% Declare a string variable and get %z from Origin into this variable
strWksNames = '';
strWksNames = invoke(originObj, 'LTStr', '%z');
fprintf('%s\n', strWksNames);


Go to Top of Page

rezahasi1

Bangladesh
Posts

Posted - 08/08/2004 :  04:44:31 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Dear Easwar,

Thank you very much for your kind help.
Although I still can not figure out the problem in copying and pasting. But I would like to thank you for your code for getting worksheet names in matlab.

Regards,
Rezahasi1
Go to Top of Page

easwar

USA
1964 Posts

Posted - 08/09/2004 :  09:37:38 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Rezahasi1,

If you can consistently reproduce the copy-page problem with one particular Origin OPJ and one MATLAB m-file, please send those to tech@originlab.com so that we can take a look to see if we can reproduce it. If you send the files, please mention this forum post.

Thanks,

Easwar
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