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
 Exporting Multiple files with Prompt
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

rmtruji

USA
10 Posts

Posted - 04/24/2002 :  5:21:20 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
I am wondering if anyone can help me with this issue. I have used the following code to export multiple graphs at one time and it works just great:

*********
document -e p {
getnamedwin %h; //activates one graph
run.section (File,Init);
%b="C:\My Documents\My Pictures\";
image.FileName$=%b%h.emf;
image.ShowOptions=0;
image.export.pageDPI(EMF,300,24,2); };
************
The problem is that I don't want to hardcode the pathname to where I want to put the files. I would like the script to prompt me and ask where I want to put the files. I found the following code for the prompting of saving files:

**************
FDlog.CheckName$=$DialogBox.ExportImage;
FDlog.CheckStatus=Image.ShowOptions;
FDLOG.default$=%H;
FDlog.UseGroup(Image);
Image.GetExtList(z,e);
FDlog.UseType(%z);
if(FDlog.SaveAs(a))
return 1;
Image.ShowOptions=FDlog.CheckStatus;
%z=FDlog.DefTypeExt$;
%B=FDLOG.path$;
Image.FileName$=%b%a;
if(image.IsVector(%Z))`
type -M GraphExportCheckPageSettings;
ImgExperr = Image.Export.PageDPI(%z);
if(ImgExperr > 1) // 1 == user canceled
type -a "Error! Image Export failed, err = $(ImgExperr).";
del -v ImgExperr;
return 0;
*************************
When it prompts, it doesn't allow me to put *.* in the "File Name" section to save all files. It will only save one file at a time. Is there a way to merge these two groups of code so that I can export multiple graphs and have it prompt me to where I want to put them?

Thanks.

Jose

Netherlands
93 Posts

Posted - 04/25/2002 :  10:10:19 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You almost had it! You can improve this, but the following code worked fine:


FDlog.CheckName$=$DialogBox.ExportImage;
FDlog.CheckStatus=Image.ShowOptions;
FDLOG.default$=%H;

FDlog.UseGroup(Image);
Image.GetExtList(z,e);
FDlog.UseType(%z);
if(FDlog.SaveAs(a)) return 1;

%t=FDlog.DefTypeExt$;
%B=FDLOG.path$;


document -e p {
getnamedwin %h; //activates one graph
run.section (File,Init);
image.FileName$=%b%h.%t;
image.ShowOptions=0;
image.export.pageDPI(%t,300,24,2); };


When the file name is asked don't pay much attention to it and leave the default one: just select the destination folder and the file extension, that will determine the final image type.



Jose Via, Origin WebRing member
Go to Top of Page

eparent

118 Posts

Posted - 04/26/2002 :  10:37:00 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
It sounds like you just want a prompt for a path. Below is your original code modified to prompt for a target path.


i=FDlog.OpenPath(b);
if( i == 0 )
{
document -e p {
getnamedwin %h; //activates one graph
//run.section (File,Init);
//%b="C:\My Documents\My Pictures\";
image.FileName$=%b%h.emf;
image.ShowOptions=0;
image.export.pageDPI(EMF,300,24,2); };
}


I hope this helps. For more information on using LabTalk's FDlog object see your Origin LabTalk manual.




Edited by - eparent on 04/26/2002 10:44:45
Go to Top of Page

CStorey

Canada
137 Posts

Posted - 04/26/2002 :  11:51:28 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Steve,

The following works with Origin 6.1 SR4. Origin implemented a new FDLOG function for the purpose of selecting just a directory.

%Z=""; // You could use %Z=some default starting location.
FDLog.DlgName$="Select destination directory for graphs.";
FDLog.ShowComment=1;
FDlog.path$="%Z";

If(FDLog.OpenPath(Z)!=0/0)
{
document -e p {
getnamedwin %h; //activates one graph
run.section (File,Init);
image.FileName$=%Z%h.emf;
image.ShowOptions=0;
image.export.pageDPI(EMF,300,24,2); };
};
Return;


Craig Storey
Origin WebRing Member - http://g.webring.com/hub?ring=originwebring
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