1.15.3 Embedding LabTalk Script in Origin C Code

LT_execute allows you to execute the LabTalk script contained in a string, but there are times when you will want to execute a large block of script that you may not want to put into a string, for readability. For those times you can use the _LT_Obj block. The _LT_Obj block allows you to embed a large block of LabTalk script code right into the flow of your Origin C code to access LabTalk objects. For LabTalk objects, please refer to LabTalk Help: LabTalk Programming: Language Reference: Object Reference

out_str("Choose an image file...");
 
_LT_Obj // Use LabTalk's FDlog to show a file dialog
{
	// Origin C code
	string strDefaultPath = GetOriginPath(); // to get Origin EXE path
	
	// LabTalk script to access FDLog object
	FDLog.Path$ = strDefaultPath;		
    FDlog.UseGroup("image");
    FDlog.Open();	    
}

char szFileName[MAX_PATH];
LT_get_str("%A", szFileName, MAX_PATH);
printf("File Name:  %s\n", szFileName);