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
 how to use getsavename command
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

blt2si

Germany
37 Posts

Posted - 02/03/2003 :  10:03:34 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
hi all,
My file name is stored in a string named as filetext.If i use the printf statement to see my file name it works fine.Now i want to use the Getsavename command in origin 7 to open the save as dialog box with the default file name to save it somewhere else.If i use like this:
LT_execute("getsavename filetext *.txt");
it opens the save as dialogbox and the default file name is filetext instead of my original file name which is stored in the string filetext .
And if i use only the getsave *.txt command it opens the save as box and the list of text files after selecting and saving the file name it doesn't save anything.why it happens i don't know?
can anyone tell me how to use this command in Origin 7 to show the default file name which is stored in a string (in my case string is filetext).
Thank You,
Blank

cpyang

USA
1406 Posts

Posted - 02/03/2003 :  10:18:08 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Have you tried the GetSaveAsBox function? like

 
void tt()
{
string strDefaultFilename = "test";
string strFilename = GetSaveAsBox("[my file type (*.abc)] *.abc", "c:\\c\\",strDefaultFilename);

out_str(strFilename);
}



GetOpenBox, GetSaveAsBox were implemented in Origin C in the file sys_utils.c and should be automatically compiled when Origin starts. The header file sys_utils.h is also included in origin.h.


CP


Go to Top of Page

blt2si

Germany
37 Posts

Posted - 02/05/2003 :  06:48:39 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
hi all,
i imported files using the getfile *.* command.when i selected a file from the list the name of the selected file was stored in a string.
ie:
LT_execute("%A = empty");
char LT_path[200];
LT_execute("getfile *.txt");
LT_get_str("%A", LT_path, 200);
string path = LT_path;
how to use the getsavename command to save the file name with .opj extension instead of .txt extension.I am also in confusion with using the getopenbox and getsaveasbox commands.if i use the below statement it opens the saveasbox and the default file name is also coming in the box to save ,when i press save button it does nothing.

LT_execute("getsave %A *.opj");
how to use the getsavename or getsaveasbox command to my code?

Thank you,
Blank
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 02/05/2003 :  1:38:19 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Both GetSaveAsBox and GetOpenBox are documented in Help:Programming:Origin C Language Reference:Global Functions, but I have written this example that I hope will help you with your need.

 
void test()
{
string strFilename = GetOpenBox("*.*");
if(strFilename.IsEmpty()) // user cancel
return;

string strPath = GetFilePath(strFilename);
string strName = GetFileName(strFilename);

// remove extension from file name
int nExtPos = strName.Find('.');
if(nExtPos > 0)
strName = strName.Left(nExtPos);

// do other things in your code

string strSaveName = GetSaveAsBox("*.opj", strPath, strName);

printf("User has choosen\n%s\n",strSaveName);
}




You should not need to use LT_Execute to call LabTalk when Origin C functions are already available.

CP


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