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
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 how to use getsavename command

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
blt2si Posted - 02/03/2003 : 10:03:34 AM
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
3   L A T E S T    R E P L I E S    (Newest First)
cpyang Posted - 02/05/2003 : 1:38:19 PM
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


blt2si Posted - 02/05/2003 : 06:48:39 AM
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
cpyang Posted - 02/03/2003 : 10:18:08 AM
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



The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000