T O P I C R E V I E W |
OndrejM |
Posted - 06/11/2007 : 9:54:49 PM Hi Mike,
Is it somehow possible to expert through label control to pdf,… ? I have two graph windows (Graph1, Graph 2) and one note window (note1),… what I want to do is to export these three windows to the one pdf file through label control,… it is possible something like this or something similar?
Thank you in advance. Ondrej
|
13 L A T E S T R E P L I E S (Newest First) |
OndrejM |
Posted - 06/17/2007 : 6:57:41 PM Hello Mike,
you were right,… now it works great! only one thing bothers me that I don’t understand that script,… I have to have a look at it,…
ayway thank you very much for your help.
All the best. Ondrej
|
Mike Buess |
Posted - 06/15/2007 : 09:09:45 AM Hi Ondrej,
The limitation might lie in passing the string to LabTalk. Try filling the text label in the following Origin C function...void Notes2Label(string sNotes) { Note noteWin(sNotes); if( !noteWin ) return; Layout lay = Project.ActiveLayer(); if( !lay ) return; string str = noteWin.Text; GraphObject go = lay.GraphObjects("Notes"); if( !go ) { lay.LT_execute("label -s -sa -n Notes Text"); go = lay.GraphObjects("Notes"); } go.Text = str; } The command Notes2Label(notes window name) will create the text label if necessary and fill it with text from the named notes window.
quote: I can somehow attach that scrip/function to the current Origin project,…
Just drag your Origin C file from CodeBuilder's User folder to its Project folder.
Mike Buess Origin WebRing Member
Edited by - Mike Buess on 06/15/2007 10:32:00 AM |
OndrejM |
Posted - 06/14/2007 : 7:47:32 PM One more question,… why I have to re-built the script (activate that function) every time I close and open Origin project,… ??? I can somehow attach that scrip/function to the current Origin project,…
Cheers Ondrej
|
OndrejM |
Posted - 06/14/2007 : 7:02:57 PM Hi Mike,
I’ve tried your suggestions but it really looks that there is some limit,… but it goes without problem manually,… I can copy all the text in the “note window” and paste to label in the “Layout window”,…. my note is quite long but I wouldn’t say that there is 6000 characters,…
If you have some other idea please let me know. But anyway thank you very much for your help.
Ondrej
|
Mike Buess |
Posted - 06/14/2007 : 09:02:14 AM 1. All string variables except %Z hold at most 266 characters. %Z can hold over 6000 characters so replace %A by %Z. More than 6000 characters probably wouldn't fit on one page anyway.
%Z=getNoteText(Notes window name)$; label -s -sa -n Notes %Z;
2. There may be other limitations on the size of a text label of which I am unaware. You could try splitting the command like this...
%Z=getNoteText(name)$; Notes.text$=%Z;
Mike Buess Origin WebRing Member |
OndrejM |
Posted - 06/14/2007 : 12:12:38 AM it's getting better,... you were right I made a mess in names,...
only problem now is that it doesn't read all the text in "Notes",...
1. when I use this label control:
%A=getNoteText(Notes window name)$; label -s -sa -n Notes %A;
it for some reason write just few first lines and columns from "Notes" window
2. when I use this label control:
win -o Layout1 { Notes.text$=getNoteText(Notes)$; // copy text from Notes window doc -uw; // refresh layout getsavename %H *.pdf; image.filename$=%A; image.Export.pageDPI(PDF, 96, 24, 0); };
it for some reason import more lines and columns than in the previous case but still not all the text in the "Notes" window,…
|
Mike Buess |
Posted - 06/13/2007 : 11:02:44 PM Hi Ondrej,
quote: but when I write "getNoteText" to the upper pane of the LabTalk Console: - I got answer in the lower pane of the LabTalk Console:
The function takes the name of the Notes window as argument. You've been using the name Note1 throughout this discussion but the standard name is Notes or Notes1. That's probably also why the label command doesn't work. Remember to correct the name in the win -o command as well, i.e., Notes.text$=getNoteText(Notes or Notes1)$
I did spot a mistake in creating the text label (step 3). Use this instead...
%A=getNoteText(Notes window name)$; label -s -sa -n Notes %A;
Mike Buess Origin WebRing Member
Edited by - Mike Buess on 06/13/2007 11:13:35 PM |
OndrejM |
Posted - 06/13/2007 : 10:42:43 PM Hi Mike,
I’ve tried to write and understand that script following the help, but it somehow doesn’t work,… I’m not sure if I’m able to find the error,….
1. I created New File (C File) and called it Notes.c 2. I wrote exactly what you suggested:
string getNoteText(string sNotes) { string str = "No notes."; Note noteWin(sNotes); if( noteWin ) str = noteWin.Text; return str; }
3. and I built the function (shift+F8) 4. it wrote: compilling… Notes.c Linking…. Done!
That looks OK, but when I write "getNoteText" to the upper pane of the LabTalk Console: - I got answer in the lower pane of the LabTalk Console:
1>getNoteText incorrect number of arguments passed to function Command Error!
and when I want to add text from Note1 to layout by entering the command "label -s -sa -n Notes getNoteText(Note1)$;" to the script window it doesn’t work,…
the rest works nice,… it was very good idea to use layout,…
Thank you Ondrej
|
OndrejM |
Posted - 06/13/2007 : 7:37:57 PM Thank you Mike,... I have to have a look at it,... I will let you know how it goes,...
Regards Ondrej |
Mike Buess |
Posted - 06/13/2007 : 12:37:45 PM Since you are reusing the graphs and notes windows I think that a layout window might be the way to go after all. You'll need Origin C to read the contents of the notes window so add the function getNoteText() to Codebuilder's workspace as described here.
string getNoteText(string sNotes) { string str = "No notes."; Note noteWin(sNotes); if( noteWin ) str = noteWin.Text; return str; }
1. Now prepare Graph1, Graph2 and Note1 as you want them. 2. Click the New Layout button and add Graph1 and Graph2 to the layout. 3. Add the notes window (text) by entering this command in the script window...
label -s -sa -n Notes getNoteText(Note1)$;
4. Arrange and format the graphs and text label as you want. The Object Edit toolbar will be useful for arranging. 5. Create a label button wherever you want and use this script...
win -o Layout1 { Notes.text$=getNoteText(Note1)$; // copy note1 text doc -uw; // refresh layout getsavename %H *.pdf; image.filename$=%A; image.Export.pageDPI(PDF, 96, 24, 0); };
Mike Buess Origin WebRing Member |
Mike Buess |
Posted - 06/13/2007 : 07:01:24 AM > The Edit> Merge all Windows command gives you more options for arranging the layers. See the [MergeAllPages] section of Graph.OGS to find out how it works.
...If you don't want the graphs to overlap at all you can add them both to a layout window. You could even copy/paste the Notes window text to the same layout. Problem is the layout is not easy to program.
> Use getsavename...
getsavename %H *.pdf; image.filename$=%A;
Mike Buess Origin WebRing Member
Edited by - Mike Buess on 06/13/2007 10:00:06 AM |
OndrejM |
Posted - 06/13/2007 : 01:26:22 AM Hi Mike,
Thank you for help,… now it works like this:
win -o Graph1 { image.fileName$="c:\vcss\graph1.pdf"; image.Export.pageDPI(PDF, 96, 24, 0); }; win -o Graph2 { image.fileName$="c:\vcss\graph2.pdf"; image.Export.pageDPI(PDF, 96, 24, 0); }; save -n note1 c:\epsc\note1.txt;
however it works I would like to improve it little bit so I have few questions:
I've wanted to merge the “graph window” by means of the command:
window –m
but graphs are totally overlapped (maybe it is because each of them has 6 layers) is it possible to improve this? And afterwards just temporary save merged graphs and export it to one “PDF” file.
And one more question can I somehow replace first command “image.fileName$="c:\vcss\graph1.pdf”, I would prefer if program will always ask for the name or automatically add some character (letter or number) e.g. “graph1” will be after first exporting saved as “graph11.pdf” and “graph2” as “graph21.pdf”,… is it something like this possible or it is too complicated?
Anyway thanks a lot for your help. Ondrej
|
Mike Buess |
Posted - 06/12/2007 : 08:14:22 AM Graphs can be exported one at a time to separate PDFs with this...
image.fileName$="Output file path\name"; image.Export.pageDPI(PDF, dotsPerInch, bitsPerPixel, compression);
Note windows can only be exported to text files with File> Save Notes As or
save -n Notes1 file_path\name;
There is no way to export multiple windows from Origin to the same PDF file.
Mike Buess Origin WebRing Member
Edited by - Mike Buess on 06/12/2007 08:20:18 AM |