//**********************************************
// Filename:	FILE.OGS
// Creation:	8/16/95 by CP
// Purpose:	File menu scripts
//**********************************************
// Modification Log:
// 			10/10/95 JMP	Set comment box ON  for FILE:OPEN and FILE:SAVE AS
//			10/10/95 JMP	Set comment box OFF for FILE:TEMPLATE:SAVE AS
//			10/12/95 JMP	Add script for FILE:TEMPLATE:OPEN Worksheet/Plot/Matrix
//			10/12/95 JMP	Replace script for FILE:IMPORT:ASCII to use FDLOG properties
//			10/24/95 JMP	Add section for Windows MetaFile
//			10/24/95 JMP	Use FDLOG methods and properties to explicitly control dialog boxes
//			DSB v3.85 11/8/95 SAVE_MATRIX Add open matrix window option   NOT ACTUALLY DONE YET
//			QZCao, v3.98, 12/26/95, OLE_SUPPORT, Support ole
//			CPY v4.00 1/25/96 LONG_FILENAMES, add quotes to %A
//			03/05/96 JMP	CHECK_MULTICELL_SELECTION	ASCII export enables SELECTION only when wks.sel>1
//			CPY v4.11 b759 ENABLE_SAVE_MATRIX, remove marks on SAVE_MATRIX and enable David's change
//			ML v4.11 7/15/96 B1051 GET_FILE_NAME
//			JMP V4.11 7/18/96 EXCEL32DBASE32
//			RKM v4.18 7/26/96 commented out saving as 2.8
//			RKM for v5.0 added Close and Exit sections
//			11 Oct '96 grd Added binary import section
//			11/18/96 CPY	Add Excel Open option
//			11/25/96 JMP v4.13 added ImportOptions, ImportASCIIOptions, LastImport sections
//			JLIU	v4.14 12/6/96 INIT_OPTION_PROPERTY
//			CPY 12/16/96 SCRIPT_ACCESS_EXCEL_OLE 
//			HYYU 1/124/97	CHANGE_ODBCDLL_NAME
//			RKM 2/4/97 v4.161 ORG_PROF_MENUS, add menus specific to Origin Professional
//			ML 2/19/97 SET_CORRECT_PATH_FROM_PAGE
//			JMP v4.95 	02/28/97 Use_Option_Path
//			JMP v4.961 	03/04/97 Use_New_MultiOpen_Dialog
//			JMP v4.962	03/05/97 SETDEFAULT_SETS_PATH_AND_DEFAULT
//			HYYU v4.962	4/8/97 CONSIDER_CANCEL_FOR_ODBC
//			JMP v4.978	4/25/97 USE_TRACKING_OF SINGLE EXTENSION TYPES
//			JMP v4.978	4/27/97 SYSTEM.EXCEL( )
//			HYYU v4.988	5/29/97 ODBC messabe
//			JMP v4.9983	7/01/97	EXPORT_LABELS Export labels independently of CSV
//			JMP v4.9984	7/02/97 READ_ONLY_OPEN Use Read only property to open as read only
//			HYYU v4.9985	7/9/97 t2646 KEEP_COLUMN_SPECIFICATIONS_FOR_ODBC_INPUT
//			EJP v5.003 08-01-97 UPDATE_APP_DATA_PATH
//			DVT	v6.011	t3643	4/7/98	ODBC_IMPORT_SQL
//			RKM v6.045	1/4/99 MULTI_IMPORT_WKS
//			CPY v6.0252 t6746 1/26/00 MULTI_OPEN_SUPPORT_BY_ROW_AND_BY_COL_APPEND
//			CPY v6.0294 t8126 6/27/00  IMPORT_IMAGE_INTO_MATRIX
//			CPY v6.0295 t8164 6/29/00 RESET_BYTE_ORDER_BEFORE_WAVE_IMPORT
//			CPY v6.1017 t8293 8/3/00 MOVE_ODBC_TO_SEPARATE_OGS_FILE
//			CPY v6.1018 8/4/00 MOVE_EXPORT_PAGE_TO_GRAPHEXP
//			CPY v6.1018 8/10/00 MOVE_IMAGE_IMPORT_EXPORT, moved codes here from file.ogs
//			SDB v6.1045 9/8/00, moved codes to AppFile.ogs 
//			LY  6/25/01, add new import file format ODD
//			EJP 02-26-2003 FIX_EXCEL_SAVE_PATH_NOT_BEING_USED
//			DVT 4/11/03 REMOVE_TREE_UTILS_FROM_LVDLG
//			SY 07-08-2003 QA70-4762 v7.0619 OPEN_ORIGINC_FILE_USING_RUN_COMMAND
//			EJP 07-10-2003 v7.0622 QA70-4745 SET_PAGE_IMPORT_INFO_ON_123_ASC_IMPORT
//			EJP 07-14-2003 v7.0624 QA70-4824 FILE_OPEN_CHANGES
//			GRD 2003.07.17 Make New Worksheets the default for MultiImport
//			SY 07-25-2003 QA70-4901 v7.0636 FIX_EXPORT_ASCII_SELECTION
//			SY 08-04-2003 qa70-4943 v7.0644 ORIGIN_FILE_EXTENSIONS_USING_LOWER_CASE
//			SY 08-11-2003 QA70-4927 v7.5653 ADD_OPEN_SAMPLES_MENU_ITEM
//			RVD 9/15/2003 QA70-5179 v7.0695 THEME_SPECIAL_CONTEXT_MENU
//			SDB 10/7/03 Save the defType for user filters
//			SDB 10/7/03 Allow for opening multiple windows
//			CPY 10/26/03 QA70-3096 WKS_IMPORT_CHK_FILE_NAME_ALLOW_USE_ORIGINAL_WKS
//			Danice 12/30/03 QA70-5712 v8.0790 CALL_NEW_IMPORTWIZ_CODE
//			CPY 9/12/04 CHANGE_NLF_WIZARD_TO_NEW_NLF_OPEN
// 			SY 09/22/2004 QA70-6800 v8.0136 MENU_CHANGES_RELATIVE_NEW_WORKBOOK
//			SY 02/03/2005 QA70-1995 v8.0188 OC_MATHEMATICA_LINK
// 			SY 05/17/2005 QA70-7650 v8.0235 MORE_IMPORT_MODE_IN_OLD_ASCII_IMPORT_DLG
//			EJP 2005-07-20 v8.0272 FILE_IMPORT_INDEPENDENT_OF_IMPORT_WIZ
//			CPY 12/30/05 QA70-8347 REPLACE_TEMPLATE_LIB_WITH_TEMPLATE_ORGANIZER
//			SY 02/01/2006 QA70-8498 v8.0364 TEMPLATE_INFO_INTERNAL_ACCESS
//			EJP 2006-05-03 v8.0405 USE_FILE_GROUP_PATH_IN_SAVE_AS_DLG
//			Hong 7/28/06 FIX_TEMPLATE_ORGANIZER_ERROR_FILENAME
//			DSC 8/4/06 QA70-8883 SAVE_TEMPLATE_FROM_ORIGINC	
//			Jasmine 09/26/06 CORRECT_PAGE_NAME
//			CPY 9/29/06 IMPASC_XF_BASED	
//			Cheney 2006-12-11 ADD_CGM_TYPE_FOR_ThermoGalactic
//			Cheney 2006-12-19 SUPPORT_JCAMP_FILE
//			Cheney 2006-12-25 SUPPORT_DIADEM_FILE		
//			Hong 01/17/07 QA80-9250 FIX_USE_OPEN_FAIL_GET_CORRECT_FILTER							
//			SY 2007-03-15 QA70-9388 v8.0583 MRU_FOR_TEMPLATE_OGW
// EJP 2007-03-16 v8.0583 QA70-4771 DO_NOT_SHOW_FILTERS_IN_FILE_OPEN_DLG
// Hong 03/21/07 CENTRALIZE_CODE_TO_CALL_IMPASC_WNEN_MATRIX
// EJP 2007-03-26 v8.0590 QA70-4771 OPEN_AND_OPENSAMPLES_NEED_TO_SHARE_CODE
// Hong 03/29/07 v8.0592 REMOVE_OPTION_BTN_NO_NEED_USED
// Max 4/4/07 MATRIX_ASCII_EXPORT_USING_XF
// Hong 04/09/07 QA80-9594 MORE_IN_80_IMPORT_MATLAB
// Sim 04-12-2007 REMOVE_CSV_TYPE_FROM_ASCII_IMPORT
// EJP 2007-04-17 v8.0603 QA70-9634 ADD_FILTERS_WITH_OPTION_TO_FILE_OPEN_DLG
// Max 4/19/07 ADD_HELP_LANGUAGE_CHAGE
// CPY 5/23/07 QA70-9815 XF_SCRIPT_EXAMPLE_DIALOG
// Sim 06-18-2007 ADD_ASCII_EXPORT_TYPES
// Sim 06-21-2007 ADD_PDF_EXPORT_TYPES
// Sim 06-21-2007 ADD_IMAGE_EXPORT_TYPES
// CPY 7/13/2007 IMP_FILTER_MNGR_HOOK_UP_TO_MENU
// EJP 2007-07-18 v8.0663 QA70-10048 CHECK_MATHEMATICA_INSTALL_MSG
// Max 9/17/08 SET_SPE_DEFAULT_TO_EXE_SAMPLE
// Max 9/17/08 SET_MDF_DEFAULT_TO_EXE_SAMPLE
// Max 9/17/08 SET_CSV_DEFAULT_TO_EXE_SAMPLE
// ML 9/26/2007 QA70-8451 NO_NEED_FOR_DASH_D_SINCE_BOTH_ARGS_ARE_UNASSIGNED
// Max 9/28/08 SET_PAL_DEFAULT_TO_EXE_SAMPLE
// Hong 10/18/07 v8.0728 TAKE_BACK_SUPPORT_IMP_SIMPLE_ASCII_TO_EXCELBOOK
// Max 10/25/07 QA70-10581 LANGUAGE_SWITCH_CRASH_IN_J_LEAD_TO_NEW_LT_WAY_TO_RUN_XF
// Max 12/3/07 SET_OGS_DEFAULT_TO_EXE_SAMPLES
// EJP 2007-12-07 v8.0764 CODE_BUILDER_SAMPLES_PATH
// EJP 2007-12-10 v8.0766 LOCALIZE_MATHEMATICA_START_ERR_MSG
// Hong 01/08/08 QA80-10541 USE_GROUP_TYPE_REMEMBER_LAST_OPEN_PATH
// EJP 2008-01-21 v8.0790 QA70-10839 OC_CHECK_FOR_UPDATES
// EJP 2008-01-31 v8.0798 QA70-11033 IMPWIZ_FAILS_TO_OPEN
// EJP 2008-02-26 v8.0813 QA80-11018 ADD_TEMPLATE_TYPE_TO_FILE_OPEN_DLG
// Hong 03/28/08 QA80-8336 v8.0834 EXCEL_NEED_PROJECT_FILE_SUPPORT
// Max 06/12/08 v8.0883 PARTIAL_IMPORT_CHECKBOX_IS_NOT_USED_ANYMORE_IN_THIS_WAY
// Max 7/2/08 QA70-10581 NEW_LT_WAY_TO_RUN_XF
// Kyle 10/29/08 MOVE_CODE_FOR_DRAG_AND_DROP_TO_FILE_DRAG_N_DROP
// Hong 11/17/08 QA80-12468 EXCEL_BOOK_SAVE_AS_DLG_NOT_ALLOW_SWITCH_EXTENSION
// EJP 2008-11-25 v8.0980 QA80-12647 USER_FRIENDLY_ERR_MSGS
// Sim 12-01-08 v8.0981 MOVE_CODE_FOR_DRAG_AND_DROP_TO_FILE_DRAG_N_DROP
// CPY 12/6/06 QA70-12736 LT_NEED_MORE_CNTRL_ON_ALLOWING_OC_FUNCS
// Hong 12/19/08 QA80-12736 FIX_IMPORT_ASCII_FAIL_IMPORT_TO_GRAPH
// CPY 1/19/09 QA70-12468-P1 EXCEL_BOOK_SAVE_AS_DLG_NOT_ALLOW_SWITCH_EXTENSION_CHK_VER
// Hong 03/05/09 QA80-13222 PCLAMP_GROUP_MORE_TYPE
// DSC 5/18/09 QA70-13524 SAVE_CHKFORUPDATESDLG_OP_IN_TEMP_FOLDER_FOR_DEVKIT
// Folger 06/02/09 QA80-12996 ADD_SAVE_AS_ANALYSIS_TEMPLATE_MENU_ITEM_INTO_MAIN_FILE_POPUP
// CPY 6/19/09 QA80-13551-P1 TITLE_BAR_CONTEXT_MENU_TO_ADD_SHORT_CUT
// Sim 07-17-2009 QA81-4184 REDO_POWERPOINT_EXPORT_AS_SLIDE_SHOW
// Kyle 08/27/2009 MAIN_MENU_ADD_CUSTOM_MENU_EDITOR
// CPY 8/28/09 QA70-14238 EXCEL_BOOK_SAVE_USING_EXISTING_PATH
// EJP 2009-09-17 QA81-14230 BATCH_PROCESSING_TBAR_BUTTON
// CPY 9/24/09 QA70-14275 MODULE_LICENSE_DIALOG_MOVED_TO_RC
// CPY 9/25/09 QA70-14358 ADD_PROTECTION_MENU_ITEMS
// CPY 10/3/09 QA70-14402 MOVE_REIMOPRT_TO_FILE_MENU_TOP_LEVEL
// CPY 10/5/09 QA70-14406-P5 DEFAULT_TO_EPS_FROM_TOOLS_OPTIONS_FOR_IMAGE
// EJP 2009-10-13 QA81-14229 FAIL_TO_OPEN_ASCII_DATA_AFTER_VISTA_FILE_DLG
// Folger 10/28/09 QA81-14541 EXPORT_CSV_SHOULD_OUT_MESSAGE_ABOUT_FILE_LOCATION
// CPY 7/27/10 ORG-435-P3 DEACTIVATE_MENU
// Folger 08/04/10 ORG-705 COPY_COLORMAP_FORMAT_CONTEXT_MENU
//**********************************************
//	Rules:		For using FDLOG.OPEN( ) do not specify path beforehand, it will be handled automatically
//			If path is specified beforehand, then the automatic path is ignored
//
//			For using FDLOG.SAVE( ) be sure to set default filename using .Default$ or .SetDefault(StringVar)
///////////////////////////////////////////////////

[Init]
	FDLOG.Reset();
	FDLOG.DlgName$="";
	FDLOG.OptionDLG$="";		//Reset button to off
	FDLOG.checkname$="";		//Reset check box to null
	FDLOG.ShowComment=0;		//close the comments box
	FDLOG.CheckStatus=0;		//Set checkbox to off
	FDLOG.default$="";		//Set contents of "File Name" edit box to nothing
	//------------------- CPY v6.0252 t6746 1/26/00 MULTI_OPEN_SUPPORT_BY_ROW_AND_BY_COL_APPEND
	FDLOG.MultiOpen.ComboName$="";
	/// SY 05/23/2005 QA70-7650 v8.0239 MORE_IMPORT_MODE_IN_OLD_ASCII_IMPORT_DLG
	///if(FDLOG.MultiOpen.ComboSel<1 || FDLOG.MultiOpen.ComboSel>3)
	///		FDLOG.MultiOpen.ComboSel = 1;// import into new worksheets (Make New Worksheets the default for MultiImport)
	if( FDLOG.MultiOpen.ComboSel < 1 || FDLOG.MultiOpen.ComboSel > 5 )
		FDLOG.MultiOpen.ComboSel = 2;// import into new workbooks (Make New Workbooks the default for MultiImport)
	/// end MORE_IMPORT_MODE_IN_OLD_ASCII_IMPORT_DLG
//		FDLOG.MultiOpen.ComboSel = 2;// import into new columns
//		FDLOG.MultiOpen.ComboSel = 3;// import into new rows
	//------------------- end t6746	
	return 0;

///////////////////////////////////////////////////
[Open]
	run.section(,Init);
	//QZCao, v3.98, 12/26/95, OLE_SUPPORT, Support ole
	if(page.oleAskUpdate(Open)==1)
		return	0;

	///SDB 10/7/03 Save the defType for user filters
	ii=FDLOG.defType;
	FDLOG.UseGroup(Origin);

	/// EJP 2007-04-17 v8.0603 QA70-9634 ADD_FILTERS_WITH_OPTION_TO_FILE_OPEN_DLG
	///	/// EJP 2007-03-16 v8.0583 QA70-4771 DO_NOT_SHOW_FILTERS_IN_FILE_OPEN_DLG
	///	///FDlog.AddUserTypes();
	///	/// end DO_NOT_SHOW_FILTERS_IN_FILE_OPEN_DLG
	FDlog.AddUserTypes();
	/// end ADD_FILTERS_WITH_OPTION_TO_FILE_OPEN_DLG

	FDLOG.defType=ii;
	
	Run.Section(,OpenFile); /// EJP 2007-03-26 v8.0590 QA70-4771 OPEN_AND_OPENSAMPLES_NEED_TO_SHARE_CODE

[OpenFile] /// EJP 2007-03-26 v8.0590 QA70-4771 OPEN_AND_OPENSAMPLES_NEED_TO_SHARE_CODE	
	FDlog.Open.MultiSel = 1;
	
	FDLOG.ShowComment=1;	// open the comments box
	if(FDLOG.Open(A))
		return 1;
	%B=FDLOG.path$;
	switch(FDLOG.DefType)
	{
	case 1 to 2: // OPJ and ORG files
		//JMP v4.9984	7/02/97 READ_ONLY_OPEN
		for( iFile = 1; iFile <= FDlog.MultiOpen.Count; iFile++ )
		{
			FDlog.Get(A,iFile); // %a = file name
			if( FDlog.MultiOpen.Count == 1 )
			{
				if (FDLOG.AsReadOnly)
					doc -oR %B%A;
				else
					doc -open %B%A;
				
				iFile = 1;	// must do this because doc -o wipes out all the variables. 
			}
			else
			{
				//---- CPY 7/14/06 QA70-8830 APPEND_BROKEN_DUE_TO_LE_PE_CODES_MOVED_TO_XF
				//%Z = pe_get_path()$; // remember starting folder
				//doc -Append %B%A;
				//pe_cd %Z;
				string strCurPath$;
				pe_path path:= strCurPath$;
				doc -Append %B%A;
				pe_cd strCurPath$;
				//-----
			}
		}
		break;
	case 3 to 5: // OGW, OGG, OGM files
		///SDB 10/7/03 Allow for opening multiple windows
		for( iFile = 1; iFile <= FDlog.MultiOpen.Count; iFile++ )
		{
			FDlog.Get(A,iFile); // %a = file name
			doc -Append %B%A;
		}
		break;
	/// EJP 07-14-2003 v7.0624 QA70-4824 FILE_OPEN_CHANGES
	/*
	case 6:	// TXT files
		open -n "%B%A";
		break;
	case 7: // OGS files
		ed.open(%B%A);
		break;
	*/
	case 6: // ASCII data
		for( iFile = 1; iFile <= FDlog.MultiOpen.Count; iFile++ )
		{
			%A = System.Wks.DefTemplate$;
			win -t data "%A";
			FDlog.Get(A,iFile); // %A = file name
			/// EJP 2009-10-13 QA81-14229 FAIL_TO_OPEN_ASCII_DATA_AFTER_VISTA_FILE_DLG
			///open -w %A;
			open -w %B%A;
			/// end FAIL_TO_OPEN_ASCII_DATA_AFTER_VISTA_FILE_DLG
		}
		break;
	case 7: // Notes
		///SDB 10/7/03 Allow for opening multiple windows
		for( iFile = 1; iFile <= FDlog.MultiOpen.Count; iFile++ )
		{
			FDlog.Get(A,iFile); // %a = file name
			open -n "%B%A";
		}
		break;
	case 8: // Origin programming
		///SDB 10/7/03 Allow for opening multiple windows
		for( iFile = 1; iFile <= FDlog.MultiOpen.Count; iFile++ )
		{
			FDlog.Get(A,iFile); // %a = file name
			ed.open(%B%A);
		}
		break;
	/// end FILE_OPEN_CHANGES

	/// EJP 2008-02-26 v8.0813 QA80-11018 ADD_TEMPLATE_TYPE_TO_FILE_OPEN_DLG
	case 9: // Templates
		for( iFile = 1; iFile <= FDlog.MultiOpen.Count; iFile++ )
		{
			FDlog.Get(A,iFile); // %A = file name
			doc -ta %B%A;
		}
		break;
	/// end ADD_TEMPLATE_TYPE_TO_FILE_OPEN_DLG

	default:
		/// Hong 06/20/07 v8.0645 COMMENT_OUT_CODE_NOT_USED_ANY_MORE
		///// Hong 01/17/07 QA80-9250 FIX_USE_OPEN_FAIL_GET_CORRECT_FILTER
		//%P = $(FDLOG.defType);
		//%P = FDLOG.type%P$;
		///// end FIX_USE_OPEN_FAIL_GET_CORRECT_FILTER
		/// end COMMENT_OUT_CODE_NOT_USED_ANY_MORE
		for( iFile = 1; iFile <= FDlog.MultiOpen.Count; iFile++ )
		{
			%B=FDLOG.path$; // get path again for each file incase import code changes %b
			FDlog.Get(a,iFile); // %a = file name
			Doc.DropFileName$="%b%a";
			/*
			FDlog.Get(k,iFile,2); // %k = file extension
			// %z = file type name
			Ini.GetStr(z,, %k, Extensions, %yFileTypes.ini);
			if( %z == "" )
			{
				Type "File type %k is not supported.";
				continue;
			}
			
			// %z = OGS file name from FileTypes folder
			Ini.GetStr(z,, %k, %z, %yFileTypes.ini);
			
			// %k = File Open window template
			Ini.GetStr(k,, OnFileOpenWindow, TypeInfo, %z);
			if( "%k" != "" )
				win -t t %k;
			*/			
			Doc.DropWinName$="";
			Doc.DropLayer=1;
			Doc.DropIndex=iFile;
			Doc.DropCount=FDlog.MultiOpen.Count;
			/*		
			// %k = OriginC Load function
			Ini.GetStr(k,, Process, OriginC, %z);
			if( %k == "" )
			{
				Run.Section(%z, Main);
			}
			else
			{
				Run.Section(, LayerLink, "%z");
			}
			*/
			/// EJP 2007-05-14 v8.0618 QA70-9634 ADD_FILTERS_WITH_OPTION_TO_FILE_OPEN_DLG
			///Run.Section(, FileImport);
			FDlog.GetTypeName(Z,FDlog.DefType);
			Run.Section(, OpenFileWithFilter, "%B%A" "%Z");
			/// end ADD_FILTERS_WITH_OPTION_TO_FILE_OPEN_DLG
		}
		%P = ""; // Hong 01/18/07 CLEAR_LT_VARIABLE_AFTER_IMPORT
	}
	return 0;

[OpenFileWithFilter]
	/// EJP 2007-05-14 v8.0618 QA70-9634 ADD_FILTERS_WITH_OPTION_TO_FILE_OPEN_DLG
	// %1 == Absolute path and name of data file.
	// %2 == Filter name, no path nor extension.
	///---Sim 12-01-08 v8.0981 MOVE_CODE_FOR_DRAG_AND_DROP_TO_FILE_DRAG_N_DROP
	//if(run.LoadOC(OriginLab\iw_filter.c, 16) != 0)
	if(run.LoadOC(OriginLab\dragNdrop.c, 16) != 0)
	///---END v8.0981 MOVE_CODE_FOR_DRAG_AND_DROP_TO_FILE_DRAG_N_DROP
	{
		///---Sim 12-01-08 v8.0981 MOVE_CODE_FOR_DRAG_AND_DROP_TO_FILE_DRAG_N_DROP
		//type "failed to load iw_filter.c, please contact Orignlab tech service about this problem.";
		type "failed to load dragNdrop.c, please contact Orignlab tech service about this problem.";
		///---END v8.0981 MOVE_CODE_FOR_DRAG_AND_DROP_TO_FILE_DRAG_N_DROP
		return 0;
	}
	OpenFileWithFilter(%1,%2);
	return 0;
	/// end ADD_FILTERS_WITH_OPTION_TO_FILE_OPEN_DLG

[FileImport]
	if( @KS ) //ctrl is down
	{
		run.LoadOC(OriginLab\ImportWiz.ocw);
		ImportWizard %L;
		return 0;
	}

	/// AW 07/20/06 USE_IW_FILTER
	//run.LoadOC(OriginLab\FileImport.ocw);
	//------------- CPY 8/16/06 FU_UTILS_NEEDED_FOR_IW_FILTER, 0x10 to specify autoload dependent
	//run.LoadOC(OriginLab\iw_filter.c);
	///Kyle 10/29/08 MOVE_CODE_FOR_DRAG_AND_DROP_TO_FILE_DRAG_N_DROP
	//if(run.LoadOC(OriginLab\iw_filter.c, 16) != 0)
	if(run.LoadOC(OriginLab\dragNdrop.c, 16) != 0)
	///End MOVE_CODE_FOR_DRAG_AND_DROP_TO_FILE_DRAG_N_DROP
	{
		///---Sim 12-01-08 v8.0981 MOVE_CODE_FOR_DRAG_AND_DROP_TO_FILE_DRAG_N_DROP
		//type "failed to load iw_filter.c, please contact Orignlab tech service about this problem.";
		type "failed to load dragNdrop.c, please contact Orignlab tech service about this problem.";
		///---END v8.0981 MOVE_CODE_FOR_DRAG_AND_DROP_TO_FILE_DRAG_N_DROP
		return 0;
	}
	//------------- end FU_UTILS_NEEDED_FOR_IW_FILTER
	/// END USE_IW_FILTER
	/// EJP 08-08-2003 v7.0650 QA70-4073.53 USE_SAME_FILTER_FOR_MULTI_FILES_ON_FILEOPEN_AND_DRAGDROP
	/* For better control we will call the Import Wizard from inside HandleDataFile.
	if( !HandleDataFile() )
	{
		run.LoadOC(OriginLab\ImportWiz.ocw);
		ImportWizard %L;
	}
	*/
	/// EJP 2005-07-20 v8.0272 FILE_IMPORT_INDEPENDENT_OF_IMPORT_WIZ, why load ImportWiz.ocw after FileImport.ocw?
	///run.LoadOC(OriginLab\ImportWiz.ocw);
	/// end FILE_IMPORT_INDEPENDENT_OF_IMPORT_WIZ
	/// AW 07/20/06 USE_IW_FILTER
	//HandleDataFile();
	/// Sim 06/15/07 QA80-9595-P5 FIX_D7D_FAIL_WORK_FOR_SECOND_TIME
	//HandleDataFiles %P;/// Hong 01/17/07 QA80-9250 FIX_USE_OPEN_FAIL_GET_CORRECT_FILTER
	HandleDataFiles "";
	// end FIX_D7D_FAIL_WORK_FOR_SECOND_TIME
	/// END USE_IW_FILTER
	/// end USE_SAME_FILTER_FOR_MULTI_FILES_ON_FILEOPEN_AND_DRAGDROP
	return 0;

[DragDropUnknown]
	// This section will be deleted later when all places call DragDrap section
	Run.Section(,DragDrop);
	return 0;
	
[DragDrop]
	// Get DoFile section name
	/// SY 07-08-2003 QA70-4762 v7.0619 OPEN_ORIGINC_FILE_USING_RUN_COMMAND
	///	%L = Doc.DropFileName$;
	// If open OriginC file from command line, Doc.DropFileName$ is not set yet, 
	// Then %1, %2, ... contain the command line arguments. 
	// Also, the filename in run command need to be quoted if filename has spaces in it.
	%L = %1;
	if( %L == "" )
		%L = Doc.DropFileName$;
	/// end OPEN_ORIGINC_FILE_USING_RUN_COMMAND
//	n = %[%L];
//	%Z = "OnOpen%[%L,n-2:n]";
	%Z=%[%L,>'.']; // GJL 5/21/03 Add support for single and double character file extensions
	for( ; 1; )
	{
	  if(%[%[%Z,>'.']]==0) break;
	  %Z=%[%Z,>'.'];
	}
	%Z="OnOpen%Z";
	
	// Call DoFile section
	n = Run.Section(DoFile.ogs,%Z,"%L");
	if( 0/0 != n )
		return 0; // DoFile handled the file
	
	// Handle file by filter or ImportWizard
	Run.Section(,FileImport,"%L");
	return 0;

[LayerLink]
	// This section assumes Doc.Drop* properties have been set.
	// %1 == Name of OGS file that handles the file type.

	// until we have Layer.UpdateLink() method, we use this macro below
	def LayerUpdateLink { // this macro will need to use %L,%M
		%L=Layer.Info.System.Link.Source$;
		if(run.loadOC("%L") != 0)
		{
			type "%L" not compiled;
		}
		else
		{
			i=Doc.DropLayer;
			%K=Doc.DropWinName$;
			%L=Layer.Info.System.Link.Parent$;
			%M=Layer.Info.System.Link.Process$;
			%M=;
			%M(%K,i,%L);
		}
	};

	%z=%1;
  
	Layer.Info.System.Link.Parent$=Doc.DropFileName$;

	Ini.GetStr(k,, Process, OriginC, %z);
	Layer.Info.System.Link.Process$=%k;

//	Ini.GetStr(k,, Prepare, PageInfo, %z);
//	Layer.Info.System.Link.Prepare$=%k;

//	Ini.GetStr(k,, Modify, PageInfo, %z);
//	Layer.Info.System.Link.Modify$=%k;

	Ini.GetStr(k,, Source, OriginC, %z);
	if( %k == "" )
	{
		Layer.Info.System.Link.Source$=%z;
	}
	else
	{
		Layer.Info.System.Link.Source$=%k;
	}

	// Update Layer
	//Layer.UpdateLink();
	LayerUpdateLink; // call macro until method is implemented
	

[Import]
	run.section(,Init);

	FDlog.Numtypes=0;
	FDlog.Open.MultiSel=1;
	FDLOG.ShowComment=1; // open the comments box
	
	i=exist(%H,10);
	switch(i)
	{
	case 2: // Worksheet
		FDlog.AddUserTypes(0, 1);
		break;
	case 5: // Matrix
		FDlog.AddUserTypes(0, 2);
		break;
	default:
		return 1;
	};

	if(FDLOG.Open(A))
		return 1;
	
	%B=FDLOG.path$;
	for( iFile = 1; iFile <= FDlog.MultiOpen.Count; iFile++ )
	{
		FDlog.Get(a,iFile); // %a = file name
		Doc.DropFileName$="%b%a";

		FDlog.Get(k,iFile,2); // %k = file extension
		// %z = file type name
		Ini.GetStr(z,, %k, Extensions, %yFileTypes.ini);
		if( %z == "" )
		{
			Type "File type %k is not supported.";
			continue;
		}
		
		// %z = OGS file name from FileTypes folder
		Ini.GetStr(z,, %k, %z, %yFileTypes.ini);
		
		Doc.DropWinName$=%h;
		Doc.DropLayer=1;
		Doc.DropIndex=iFile;
		Doc.DropCount=FDlog.MultiOpen.Count;
	
		// %k = OriginC Load function
		Ini.GetStr(k,, Process, OriginC, %z);
		if( %k == "" )
		{
			Run.Section(%z, Main);
		}
		else
		{
			Run.Section(, LayerLink, "%z");
		}
	}
	return 0;
	
//--- CPY 8/8/05 QA70-7978 SEPARATE_EXCEL_OPEN_AS_ORIGIN_BOOK
[ImportExcel]
	run.section(,Init);
	FDLOG.UseGroup(Excel);
	if(FDLOG.Open(A))
		return 1;
	%B=FDLOG.path$;
	doc -aimport %B%A;
	return 0;


///////////////////////////////////////////////////
[OpenExcel]
	run.section(,Init);
	FDLOG.UseGroup(Excel);
	//QZCao, v3.98, 12/26/95, OLE_SUPPORT, Support ole
	if(page.oleAskUpdate(Open)==1)
		return	0;
	if(FDLOG.Open(A))
		return 1;
	%B=FDLOG.path$;
	//JMP v4.9984	7/02/97 READ_ONLY_OPEN
	if (FDLOG.AsReadOnly)
		doc -aR %B%A;
	else
		doc -append %B%A;
	return 0;

///////////////////////////////////////////////////
/// SY 08-11-2003 QA70-4927 v7.5653 ADD_OPEN_SAMPLES_MENU_ITEM
[OpenSamples]
	run.section(,Init);
	FDLOG.UseGroup(Samples);
	%B = System.PATH.PROGRAM$; 
	%B = %BSamples;
	FDLOG.path$ = %B;

	Run.Section(,OpenFile); /// EJP 2007-03-26 v8.0590 QA70-4771 OPEN_AND_OPENSAMPLES_NEED_TO_SHARE_CODE

[OldOpenSamples] /// EJP 2007-03-26 v8.0590 QA70-4771 OPEN_AND_OPENSAMPLES_NEED_TO_SHARE_CODE
	FDLOG.ShowComment=1;			// open the comments box
	FDlog.Open.MultiSel=1;

	if( FDLOG.Open(A) )
		return 1;
	%B = FDLOG.path$;
	
	for( iFile = 1; iFile <= FDlog.MultiOpen.Count; iFile++ )
	{
		FDlog.Get(A, iFile); // %A = file name

		FDlog.Get(k, iFile, 2); // %k = file extension
		
		if( %k == "opj" || %k == "OPJ" )
		{
			// OPJ files
			if (FDLOG.AsReadOnly)
				doc -oR %B%A;
			else
				doc -open %B%A;
		}
		else if( %k == "c" || %k == "cpp" || %k == "h" || %k == "ogs" ||
			 %k == "C" || %k == "CPP" || %k == "H" || %k == "OGS")
		{
			// OriginC files
			ed.open(%B%A);
		}
	}
	return 0;
/// end ADD_OPEN_SAMPLES_MENU_ITEM

///////////////////////////////////////////////////
[AppendProject]
	run.section(,Init);
	FDLOG.UseGroup(Origin);
	FDLOG.UseType("OPJ ORG");
	FDlog.Open.MultiSel = 1;
	FDLOG.ShowComment=1;			// open the comments box
	if(FDLOG.Open(A))
		return 1;
	%B=FDLOG.path$;
	//---- CPY 7/14/06 QA70-8830 APPEND_BROKEN_DUE_TO_LE_PE_CODES_MOVED_TO_XF
	//%Z = pe_get_path()$; // remember starting folder
	string strCurPath$;
	pe_path path:=strCurPath$;
	loop(ii,1,FDlog.MultiOpen.Count) 
	{ 
		FDlog.Get(A,ii); 
		doc -Append %B%A; 
		//---- CPY 7/14/06 QA70-8830 APPEND_BROKEN_DUE_TO_LE_PE_CODES_MOVED_TO_XF
		//pe_cd %Z; // return to starting folder
		pe_cd strCurPath$;
		//----
	} 
	doc -ln; // don't know what this does, but was in original script 
	return 0; 	
	
	
///////////////////////////////////////////////////
[SaveProject]
	if(doc.isNew)
		run.section(,SaveProjectAs);
	else
	{
		//JMP v4.978	4/27/97 SYSTEM.EXCEL( )
		if (system.excel.SaveAsExcel==1 && system.excel()==0)
			return;
		save;
	}
	return 0;

///////////////////////////////////////////////////
///------ Folger 06/02/09 QA80-12996 ADD_SAVE_AS_ANALYSIS_TEMPLATE_MENU_ITEM_INTO_MAIN_FILE_POPUP
[PrepareSaveProjectAsFilePath]
	//JMP v4.978	4/27/97 SYSTEM.EXCEL( )
	if ((system.excel.SaveAsExcel==1 || system.excel.SaveAsExcel==2) && system.excel()==0)
		return 1;
	run.section(,Init);
	//QZCao, v3.98, 12/26/95, OLE_SUPPORT, Support ole
	if(page.oleAskUpdate(SaveAs))
		return	0;
	FDLOG.default$=%G;
	///CPY 12/16/96 SCRIPT_ACCESS_EXCEL_OLE
	FDLOG.UseGroup(Origin);
	if(doc.OleInfo) /// for OLE embedding or linking
	{
		FDLOG.UseType("OGG")		
	}
	else
	{
		FDLOG.UseType("OPJ ORG");
	}

	FDLOG.ShowComment=1;	// open the comments box

	/// EJP 2006-05-03 v8.0405 USE_FILE_GROUP_PATH_IN_SAVE_AS_DLG
	// I am removing the following code per Easwar because because when
	// users set the Origin file group Save As path they expect it to be used.
	///if(%X!="")
	///	FDLOG.path$=%X;
	/// end USE_FILE_GROUP_PATH_IN_SAVE_AS_DLG

	if(FDLOG.SaveAs(A))
		return 1;
	%B=fdlog.path$;

	//QZCao, v3.98, 12/26/95, OLE_SUPPORT, Support ole
	page.oleUpdate(SaveAs);
///------ End ADD_SAVE_AS_ANALYSIS_TEMPLATE_MENU_ITEM_INTO_MAIN_FILE_POPUP

///////////////////////////////////////////////////
[SaveProjectAs]
	///------ Folger 06/02/09 QA80-12996 ADD_SAVE_AS_ANALYSIS_TEMPLATE_MENU_ITEM_INTO_MAIN_FILE_POPUP
	////JMP v4.978	4/27/97 SYSTEM.EXCEL( )
	//if ((system.excel.SaveAsExcel==1 || system.excel.SaveAsExcel==2) && system.excel()==0)
		//return 1;
	//run.section(,Init);
	////QZCao, v3.98, 12/26/95, OLE_SUPPORT, Support ole
	//if(page.oleAskUpdate(SaveAs))
		//return	0;
	//FDLOG.default$=%G;
	/////CPY 12/16/96 SCRIPT_ACCESS_EXCEL_OLE
	//FDLOG.UseGroup(Origin);
	//if(doc.OleInfo) /// for OLE embedding or linking
	//{
		//FDLOG.UseType("OGG")		
	//}
	//else
	//{
		//FDLOG.UseType("OPJ ORG");
	//}
//
	//FDLOG.ShowComment=1;	// open the comments box
//
	///// EJP 2006-05-03 v8.0405 USE_FILE_GROUP_PATH_IN_SAVE_AS_DLG
	//// I am removing the following code per Easwar because because when
	//// users set the Origin file group Save As path they expect it to be used.
	/////if(%X!="")
	/////	FDLOG.path$=%X;
	///// end USE_FILE_GROUP_PATH_IN_SAVE_AS_DLG
//
	//if(FDLOG.SaveAs(A))
		//return 1;
	//%B=fdlog.path$;
//
	////QZCao, v3.98, 12/26/95, OLE_SUPPORT, Support ole
	//page.oleUpdate(SaveAs);
	
	int		nRet = run.section(,PrepareSaveProjectAsFilePath);
	if ( 0 != nRet )
		return nRet;
	///------ End ADD_SAVE_AS_ANALYSIS_TEMPLATE_MENU_ITEM_INTO_MAIN_FILE_POPUP

	if(FDLOG.DefType==2) 
		save -DI3 "%B%A";
	else
		save -DI1 "%B%A";
	///

	return 0;

///------ Folger 06/02/09 QA80-12996 ADD_SAVE_AS_ANALYSIS_TEMPLATE_MENU_ITEM_INTO_MAIN_FILE_POPUP
///////////////////////////////////////////////////
[SaveProjectAsAnalysisTemplate]
	int		nRet = run.section(,PrepareSaveProjectAsFilePath);
	if ( 0 != nRet )
		return nRet;

	if(FDLOG.DefType==2) 
		save -DI3K "%B%A";
	else
		save -DI1K "%B%A";
	
	return 0;
///------ End ADD_SAVE_AS_ANALYSIS_TEMPLATE_MENU_ITEM_INTO_MAIN_FILE_POPUP

///////////////////////////////////////////////////
[Close]
	document -new Untitled;


///////////////////////////////////////////////////////
///QZCao, v3.98, 12/26/95, OLE_SUPPORT, Support ole
[OleUpdateEmbedded]
	page.oleaskupdate(Update);


///////////////////////////////////////////////////////
[GetWinType]
	// set %A to template name
	// set %B to Window template extension
	// set i to win type

	/// RB 5/24/99 t6477 6.0205 PUT_TEMPLATE_FILE_EXTENSION_TO_GLOBAL_STRING_%B
	win -GE; // set %A and %B
	i=exist(%H,10);
	return 0;

[SaveTemplate]
	run.section(,GetWinType); // update %B
	///JMP v4.95 02/28/97 Use_Option_Path
	//type -v -c [Save %H as %A.%B?];
	/// SY 08-04-2003 qa70-4943 v7.0644 ORIGIN_FILE_EXTENSIONS_USING_LOWER_CASE
	///	if(%B=="OTP")
	//if( i == 11 )
	///// end ORIGIN_FILE_EXTENSIONS_USING_LOWER_CASE
	//{
		//type -v -c [Save %H as %A.%B?];
		//save -Tb 200 %H %A;
	//}
	//else
		run -xf template_saveas asksave:=0;
		//save -T %H %A;
	/// Max 10/25/07 QA70-10581 LANGUAGE_SWITCH_CRASH_IN_J_LEAD_TO_NEW_LT_WAY_TO_RUN_XF
	//template_saveas asksave:=0;
	/// END LANGUAGE_SWITCH_CRASH_IN_J_LEAD_TO_NEW_LT_WAY_TO_RUN_XF
	return 0;

[SaveAsTemplate]
	///DSC 8/4/06 QA70-8883 SAVE_TEMPLATE_FROM_ORIGINC
	///Jasmine 09/26/06 CORRECT_PAGE_NAME
	//don't know why the page name is "return"
	//template_saveas
	/// Max 10/25/07 QA70-10581 LANGUAGE_SWITCH_CRASH_IN_J_LEAD_TO_NEW_LT_WAY_TO_RUN_XF
	//template_saveas -d;
	run -xf template_saveas -d;
	/// END LANGUAGE_SWITCH_CRASH_IN_J_LEAD_TO_NEW_LT_WAY_TO_RUN_XF
	///End CORRECT_PAGE_NAME
	return 0;

[SaveAsTemplateOld]
	///end SAVE_TEMPLATE_FROM_ORIGINC
	
	run.section(,Init);
	run.section(,GetWinType); // update %B
	win -G; // set %A
	FDLOG.UseGroup(Template);
	switch(i)
	{
	case 2:
		FDLOG.UseType("OTW");
		break;
	case 3:
		FDLOG.UseType("OTP");
		break;
	case 5:
		FDLOG.UseType("OTM");
		break;
	default:
		return 1;
	};

	FDLOG.Default$=%A;
	fdlog.path$=%Y; /// EJP 09-24-2003: Per Easwar, force path to User Files.
	if(i==3)
	{
		FDLOG.combobox.choice$="My Templates";
		FDLOG.combobox.inifile$=%YTemplate.ini;
		FDLOG.combobox.inisec$=Categories;
		FDLOG.combobox.label$=Category Name;
	}

	if(FDLOG.SaveAs(A))
		return 1;
	%B=FDLOG.path$;
	if(i==3)
	{
		save -Tb 200 %H %B%A;
		/// SY 02/01/2006 QA70-8498 v8.0364 TEMPLATE_INFO_INTERNAL_ACCESS
		//%B=FDLOG.combobox.choice$;
		//run.section(TemplateLibrary,AddTemplate,"%B");
		%Z=FDLOG.combobox.choice$;
		///Hong 7/28/06 FIX_TEMPLATE_ORGANIZER_ERROR_FILENAME
		//doc -st template.xml i "%Z" "%B%A";
		doc -st template.xml i "%Z" %B%A;
		///end FIX_TEMPLATE_ORGANIZER_ERROR_FILENAME
		/// end TEMPLATE_INFO_INTERNAL_ACCESS
	}
	else
	{
		save -T %H %B%A;
	}
	return 0;

[OpenAnyTemplate]
	run.section(,Init);
	FDLOG.UseGroup(Template);
	run.section(,OpenTemplate);
	
[OpenTemplate]
	if(FDLOG.Open(A))
		return 1;
	%B=FDLOG.path$;
	/// SY 2007-03-15 QA70-9388 v8.0583 MRU_FOR_TEMPLATE_OGW
	///	doc -t %B%A;
	doc -ta %B%A;
	/// end MRU_FOR_TEMPLATE_OGW

	return 0;

///------ Folger 06/02/09 QA80-12996 ADD_SAVE_AS_ANALYSIS_TEMPLATE_MENU_ITEM_INTO_MAIN_FILE_POPUP
///////////////////////////////////////////////////
[PrepareSaveWindowAsFilePath]
	run.section(,Init);
	i=exist(%H,10);
	//---- CPY 1/19/09 QA70-12468-P1 EXCEL_BOOK_SAVE_AS_DLG_NOT_ALLOW_SWITCH_EXTENSION_CHK_VER
	// LT has problem with too much comments, so I have rewritten case 2 without comment
	int nExcelType = page.ExtInfo;
	//----
	switch(i)
	{
	case 2:
		if(nExcelType > 0)
		{					
			FDLOG.UseGroup(Excel);
			if(nExcelType > 1)
				FDLOG.UseType("xlsx");
			else
			{
				FDLOG.numTypes = 1;// this is needed because UseType will not remove later in the list
				FDLOG.UseType("xls");
			}
		}
		else
		{
			FDLOG.UseGroup(Origin);
			FDLOG.UseType("OGW");
		}
		break;
	case 3:
		FDLOG.UseGroup(Origin);
		FDLOG.UseType("OGG");
		break;
	case 5:
		FDLOG.UseGroup(Origin);
		FDLOG.UseType("OGM");
		break;
	default:
		return 1;
	};

	/// EJP 02-26-2003 FIX_EXCEL_SAVE_PATH_NOT_BEING_USED
	///%A=page.filepath$;
	///if ("%A"!="")
	///	FDLOG.path$="%A";
	/// end FIX_EXCEL_SAVE_PATH_NOT_BEING_USED
	
	%B=page.filename$;
	if ("%B"=="")
		%B=%H;				//Use window name when no file name
	//----- CPY 11/10/08 QA70-12468 XLS_SAVE_AS_DLG_DEFAULT_NAME_SHOULD_NOT_HAVE_EXT
	else
	{
		string strTemp = "%B";
		%B=strTemp.GetFileName(1)$;
	}
	//-----
	FDLOG.default$="%B";

	if(FDLOG.SaveAs(A))
		return 1;
	%B=FDLOG.Path$;
///------ End ADD_SAVE_AS_ANALYSIS_TEMPLATE_MENU_ITEM_INTO_MAIN_FILE_POPUP

//---- CPY 8/28/09 QA70-14238 EXCEL_BOOK_SAVE_USING_EXISTING_PATH
[SaveBook]
	save -i;//using existing filename
	return 0;
//----

[SaveWindow]
	///------ Folger 06/02/09 QA80-12996 ADD_SAVE_AS_ANALYSIS_TEMPLATE_MENU_ITEM_INTO_MAIN_FILE_POPUP
	//run.section(,Init);
	//i=exist(%H,10);
	////---- CPY 1/19/09 QA70-12468-P1 EXCEL_BOOK_SAVE_AS_DLG_NOT_ALLOW_SWITCH_EXTENSION_CHK_VER
	//// LT has problem with too much comments, so I have rewritten case 2 without comment
	//int nExcelType = page.ExtInfo;
	////----
	//switch(i)
	//{
	//case 2:
		//if(nExcelType > 0)
		//{					
			//FDLOG.UseGroup(Excel);
			//if(nExcelType > 1)
				//FDLOG.UseType("xlsx");
			//else
			//{
				//FDLOG.numTypes = 1;// this is needed because UseType will not remove later in the list
				//FDLOG.UseType("xls");
			//}
		//}
		//else
		//{
			//FDLOG.UseGroup(Origin);
			//FDLOG.UseType("OGW");
		//}
		//break;
	//case 3:
		//FDLOG.UseGroup(Origin);
		//FDLOG.UseType("OGG");
		//break;
	//case 5:
		//FDLOG.UseGroup(Origin);
		//FDLOG.UseType("OGM");
		//break;
	//default:
		//return 1;
	//};
//
	///// EJP 02-26-2003 FIX_EXCEL_SAVE_PATH_NOT_BEING_USED
	/////%A=page.filepath$;
	/////if ("%A"!="")
	/////	FDLOG.path$="%A";
	///// end FIX_EXCEL_SAVE_PATH_NOT_BEING_USED
	//
	//%B=page.filename$;
	//if ("%B"=="")
		//%B=%H;				//Use window name when no file name
	////----- CPY 11/10/08 QA70-12468 XLS_SAVE_AS_DLG_DEFAULT_NAME_SHOULD_NOT_HAVE_EXT
	//else
	//{
		//string strTemp = "%B";
		//%B=strTemp.GetFileName(1)$;
	//}
	////-----
	//FDLOG.default$="%B";
//
	//if(FDLOG.SaveAs(A))
		//return 1;
	//%B=FDLOG.Path$;
	int		nRet = run.section(,PrepareSaveWindowAsFilePath);
	if ( 0 != nRet )
		return nRet;
	///------ End ADD_SAVE_AS_ANALYSIS_TEMPLATE_MENU_ITEM_INTO_MAIN_FILE_POPUP
	save -i %B%A; 				// save independent window
	return 0;

///------ Folger 06/02/09 QA80-12996 ADD_SAVE_AS_ANALYSIS_TEMPLATE_MENU_ITEM_INTO_MAIN_FILE_POPUP
/////////////////////////////////////////////////////////
[SaveBookAsAnalysisTemplate]
	int		nRet = run.section(,PrepareSaveWindowAsFilePath);
	if ( 0 != nRet )
		return nRet;
	
	save -ik %B%A;
	return 0;
///------ End ADD_SAVE_AS_ANALYSIS_TEMPLATE_MENU_ITEM_INTO_MAIN_FILE_POPUP


/////////////////////////////////////////////////////////
[ImportOptions]
	worksheet -edit Import;


//////////////////////////////////////////////////////////
[ImportASCIIOptions]
	//---- CPY 9/29/06 IMPASC_XF_BASED
	if (exist(%H,2)==2)
	{
		/// Max 7/2/08 QA70-10581 NEW_LT_WAY_TO_RUN_XF
		//impASC -dm m:=2;
		run -xf impASC -dm m:=2;
		//---
		return 0;
	}
	//----
	run.section(,Init);
	worksheet  -edit Ascii;
	// ML v3.821 8/22/95
	// this was taken from 3.7842:
	if (i==1)
	{
		FDLOG.UseGroup(Ascii);
		FDLOG.DlgName$=$DialogBox.ImportTitle;
		if(FDLOG.Open(A))
			return 1;
		%B=fdlog.path$;
		open -W %B%A;
	}
	else
	   type -b $general.TemplSaved;

	return 0;

/////////////////////////////////////////////////////////
[SingleImport]
	run.section(,ImportAscii);

////////////////////////////////////////////////////////
/// RKM: Multi Import for Wks MULTI_IMPORT_WKS
////////////////////////////////////////////////////////
[MultiImportWKS]
	//---- CPY 9/29/06 IMPASC_XF_BASED
	// -dm = open dialog and to simulate lauching from menu, just -d will tell XF engin that it is lauched from command line
	/// Max 7/2/08 QA70-10581 NEW_LT_WAY_TO_RUN_XF
	//impASC -dm m:=1;
	run -xf impASC -dm m:=1;
	//---
	return 0;
	//----

	run.section(,Init);
	if(FDLOG.multiopen.sort==0)
	{
		//---------- CPY v6.0252 t6746 1/26/00 MULTI_OPEN_SUPPORT_BY_ROW_AND_BY_COL_APPEND
		// we are going to use combo, so
		/// SY 05/23/2005 QA70-7650 v8.0239 MORE_IMPORT_MODE_IN_OLD_ASCII_IMPORT_DLG 
		///	if(FDLOG.MultiOpen.ComboSel==1)
		if( FDLOG.MultiOpen.ComboSel == 2 ) // Select New Workbook
		/// end MORE_IMPORT_MODE_IN_OLD_ASCII_IMPORT_DLG
			FDLOG.multiopen.colview=14;// Filename, template, size, modied
		else
			FDLOG.multiopen.colview=12;	//By default, display Filename, Size and Modified
		//---------- end t6746
	}
	else
		FDLOG.multiopen.colview=0;	//Only display Filename
	FDLOG.UseGroup(Ascii);	
	FDLOG.Message$="";

	FDLOG.MultiOpen.ComboName$=$File.WKSImportAsComboTitle;
	FDLOG.MultiOpen.ComboList$=$File.WKSImportAsComboList;

	FDLOG.MultiOpen.ColToggle=2;	//Enable the Template column toggling with the checkbox
	
	if (FDLOG.multiopen()==0/0)
		return 1;

	// still need to wait for Irene to fix the index problem, right now it is 0,1,2, so later need to change this
	FDLOG.CheckStatus = FDLOG.MultiOpen.ComboSel==1?0:1; // CPY v6.0252 t6746 1/26/00 MULTI_OPEN_SUPPORT_BY_ROW_AND_BY_COL_APPEND

	/// SY 05/23/2005 QA70-7650 v8.0239 MORE_IMPORT_MODE_IN_OLD_ASCII_IMPORT_DLG
	if(run.LoadOC(Originlab\AscImpOptions, 16) == 0) //0x10 for auto loading dependent files
		/// Hong 12/19/08 QA80-12736 FIX_IMPORT_ASCII_FAIL_IMPORT_TO_GRAPH
		//AscImportFDLOGFiles(%H);
		run -oc AscImportFDLOGFiles(%H);
		/// end FIX_IMPORT_ASCII_FAIL_IMPORT_TO_GRAPH
	else
	{
	/// end MORE_IMPORT_MODE_IN_OLD_ASCII_IMPORT_DLG
		loop(ii,1,FDlog.MultiOpen.Count)
		{
			FDlog.Get(A, ii);
	
			if(run.section(,OpenFileWks)!=0) 
			{
				if(FDLOG.CheckStatus==0)
				{
					page.closebits=2;
					win -ca;
				}
				continue;	//If non-ASCII file, continue with loop
			}
		}
	}	/// SY 05/17/2005 QA70-7650 v8.0235 MORE_IMPORT_MODE_IN_OLD_ASCII_IMPORT_DLG
	
	return 0;

[OpenFileWks]
	if(FDLOG.CheckStatus==1)
	{
		// CPY v6.0252 t6746 1/26/00 MULTI_OPEN_SUPPORT_BY_ROW_AND_BY_COL_APPEND
		if(FDLOG.MultiOpen.ComboSel==3) // append as new row, will change into 3 after Irene's change in the index problem
			open -ar %A;
		else
			open -a %A;		//Import into new columns in active wks
	}
	else
	{
		Fdlog.GetTemplate(B,ii);	
		win -t data "%B";		//Open a new wks template for each file
		open -w %A;	

		/// EJP 07-10-2003 v7.0622 QA70-4745 SET_PAGE_IMPORT_INFO_ON_123_ASC_IMPORT
		/// Hong 12/19/08 QA80-12736 FIX_IMPORT_ASCII_FAIL_IMPORT_TO_GRAPH
		//set_ascii_import_page_info(%A);
		run -oc set_ascii_import_page_info(%A);
		/// end FIX_IMPORT_ASCII_FAIL_IMPORT_TO_GRAPH
		/// end SET_PAGE_IMPORT_INFO_ON_123_ASC_IMPORT
	}
	return 0;

[OpenFileWksGraphActive]

	Fdlog.GetTemplate(B,ii);	
	win -t data "%B";		//Open a new wks template for each file
	open -w %A;	
	return 0;

////////////////////////////////////////////////////////
/// RKM: Multi Import for Graphs
////////////////////////////////////////////////////////
[MultiImportGraph]
	run.section(,Init);
	//JMP v4.961 	03/04/97 Use_New_MultiOpen_Dialog
	FDLOG.multiopen.colview=13;	///12/7/98 new property for dialog options
	FDLOG.UseGroup(Ascii);		
	FDLOG.Message$="";
	FDLOG.CheckName$=$File.ImportToWKS;
	FDLOG.CheckStatus=0;	//Default check box to on
	FDLOG.MultiOpen.ColToggle=3;	//Enable the Template column toggling with the checkbox

	if (FDLOG.multiopen()==0/0)
		return 1;

	/// SY 05/23/2005 QA70-7650 v8.0239 MORE_IMPORT_MODE_IN_OLD_ASCII_IMPORT_DLG
	if(run.LoadOC(Originlab\AscImpOptions, 16) == 0) //0x10 for auto loading dependent files
		/// Hong 12/19/08 QA80-12736 FIX_IMPORT_ASCII_FAIL_IMPORT_TO_GRAPH
		//AscImportFDLOGFiles(%H);
		run -oc AscImportFDLOGFiles(%H);
		/// end FIX_IMPORT_ASCII_FAIL_IMPORT_TO_GRAPH
	else
	{
	/// end MORE_IMPORT_MODE_IN_OLD_ASCII_IMPORT_DLG
		if(FDLOG.CheckStatus==1)
		{
			loop(ii,1,FDlog.MultiOpen.Count)
			{
				FDlog.Get(A, ii);
				if(run.section(,OpenFileWksGraphActive)!=0) 
				{
					page.closebits=2;
					win -ca;
					continue;	//If non-ASCII file, continue with loop
				}
			}
		}
		else
		{
			loop(ii,1,FDlog.MultiOpen.Count)
			{
				FDlog.Get(A, ii);
				FDlog.GetColStr(B, ii);
				if(run.section(,OpenFileGraph)!=0) 
				{
					continue;
				}
			}
		}
	}	/// SY 05/23/2005 QA70-7650 v8.0239 MORE_IMPORT_MODE_IN_OLD_ASCII_IMPORT_DLG
	
	return 0;

[MultiImportToolbar]
	// exist's 2nd arg: 0 = test active window that is not hidden
	//// AW 11/02/06 SHOULD_CALL_IMPASC
	/*
	switch (exist(%H,0))
	{
	case 2:
		//wks
		run.section(,MultiImportWKS);
		break;
	case 3:	
		//graph
		run.section(,MultiImportGraph);
		break;
	default:	
		//matrix layout notes
		run.section(,MultiImportDefault);
		break;
	}
	*/
	/// Hong 12/14/06 FIX_FAIL_WORK_NO_ACTIVE_BOOK
	//switch (exist(%H,0))
	int nType = exist(%H,0);
	switch (nType)	
	{
	/// end FIX_FAIL_WORK_NO_ACTIVE_BOOK
	case 3:	
		//graph
		run.section(,MultiImportGraph);
		break;
	case 2:
		//wks
	default:	
		//matrix layout notes
		/// Hong 12/14/06 FIX_FAIL_WORK_NO_ACTIVE_BOOK
		if( 0 == nType )
			win -t data "origin";	
		/// end FIX_FAIL_WORK_NO_ACTIVE_BOOK
		/// Max 7/2/08 QA70-10581 NEW_LT_WAY_TO_RUN_XF
		//impASC -dm m:=1;
		run -xf impASC -dm m:=1;
		//---
		break;
	}
	/// END SHOULD_CALL_IMPASC
	return 0;

[MultiImportDefault]
	run.section(,Init);
	FDLOG.multiopen.colview=14;	//display Filename, Size  Modified and Template
	FDLOG.UseGroup(Ascii);	
	FDLOG.Checkname$="";	
	FDLOG.Message$=$File.ImportToWKS;

	if (FDLOG.multiopen()==0/0)
		return 1;
	
	//------------------- CPY v6.0252 t6746 1/26/00 MULTI_OPEN_SUPPORT_BY_ROW_AND_BY_COL_APPEND	
	FDLOG.multiopen.ComboSel=2;// import multi files as new columns in current worksheet
	//------------------- end t6746

	//// AW 08/26/06 MORE_WORK_ON_MULTI_IMPORT_ASCII
	if ( 1 != FDLOG.CheckStatus )
	{
		Fdlog.GetTemplate(B,ii);	
		win -t data "%B";		//Open a new wks template for each file
//		open -w %A;	
	}
	/// END MORE_WORK_ON_MULTI_IMPORT_ASCII
	
	/// SY 05/23/2005 QA70-7650 v8.0239 MORE_IMPORT_MODE_IN_OLD_ASCII_IMPORT_DLG
	if(run.LoadOC(Originlab\AscImpOptions, 16) == 0) //0x10 for auto loading dependent files
		/// Hong 12/19/08 QA80-12736 FIX_IMPORT_ASCII_FAIL_IMPORT_TO_GRAPH
		//AscImportFDLOGFiles(%H);
		run -oc AscImportFDLOGFiles(%H);
		/// end FIX_IMPORT_ASCII_FAIL_IMPORT_TO_GRAPH
	else
	{
	/// end MORE_IMPORT_MODE_IN_OLD_ASCII_IMPORT_DLG
		loop(ii,1,FDlog.MultiOpen.Count)
		{
			FDlog.Get(A, ii);
			if(run.section(,OpenFileWks)!=0) 
			{
				page.closebits=2;
				win -ca;
				continue;	//If non-ASCII file, continue with loop
			}
		}
	}	/// SY 05/23/2005 QA70-7650 v8.0239 MORE_IMPORT_MODE_IN_OLD_ASCII_IMPORT_DLG
	return 0;

[OpenFileGraph]
	open -P %B %A;
	return 0;

/////////////////////////////////////////////////////////
[ImportAscii]
	/////////////////////////////////////////////////////////
	// Note: ImportASCII is also available from standard toolbar when Excel is active
	/////////////////////////////////////////////////////////
	//---- CPY 9/29/06 IMPASC_XF_BASED
	/// Hong 03/21/07 CENTRALIZE_CODE_TO_CALL_IMPASC_WNEN_MATRIX
	// now only let import to worksheet&matrix call impasc, later when impasc support all window, need all goto impasc
	//if (exist(%H,2)==2)
	/// Hong 10/18/07 v8.0728 TAKE_BACK_SUPPORT_IMP_SIMPLE_ASCII_TO_EXCELBOOK	
	//if ( exist(%H,2)==2 || exist(%H,5)==5 )
	if ( (exist(%H,2)==2 && exist(%H,12)!=12) || exist(%H,5)==5 ) // 12==EXIST_EXTERN_WKS
	/// end TAKE_BACK_SUPPORT_IMP_SIMPLE_ASCII_TO_EXCELBOOK
	/// end CENTRALIZE_CODE_TO_CALL_IMPASC_WNEN_MATRIX
	{
		sec -poc 2;//CPY 8/24/08 ALLOW_QUICK_CLICKING_IMPORT_AFTER_START
		// -dm = open dialog and to simulate lauching from menu, just -d will tell XF engin that it is lauched from command line
		/// Max 7/2/08 QA70-10581 NEW_LT_WAY_TO_RUN_XF
		//impASC -dm m:=0;
		run -xf impASC -dm m:=0;
		//---
		return 0;
	}
	//----
	run.section(,Init);
	//JMP v4.978	4/25/97 USE_TRACKING_OF SINGLE EXTENSION TYPES
	FDLOG.UseGroup(Ascii);			//Automatically set up dialog for using ASCII extensions with user preference
	/// Hong 03/29/07 v8.0592 REMOVE_OPTION_BTN_NO_NEED_USED
	//FDLOG.OptionDLG$="ImpASCII";		//Set option button to on and set text
	/// end REMOVE_OPTION_BTN_NO_NEED_USED
	//JMP, v5.0 01/16/96 PARTIAL_CHECK				
	/// Max 06/12/08 v8.0883 PARTIAL_IMPORT_CHECKBOX_IS_NOT_USED_ANYMORE_IN_THIS_WAY
	//if (exist(%H,2)==2)
		//FDLOG.checkname$=$DialogBox.PartialImport;			//Set check box to read Partial Import
	///---
		
	FDLOG.DlgName$=$DialogBox.ImportTitle;
	if(FDLOG.Open(A))
		return 1;
	%B=FDLOG.path$;
	//--- CPY 10/26/03 QA70-3096 WKS_IMPORT_CHK_FILE_NAME_ALLOW_USE_ORIGINAL_WKS
	// following code will allow warning of file already imported, but since not implemented in importwz,we will turn if off for now
	// to keep consistent, may bring this back later
	//ii = check_wks_same_file_set_active(%B%A);
	//if(1 == ii)
	//	return 0;
	//---
	/// Max 06/12/08 v8.0883 PARTIAL_IMPORT_CHECKBOX_IS_NOT_USED_ANYMORE_IN_THIS_WAY
	//if (exist(%H,2)==2)
		//wks.import.partial=FDLOG.checkstatus;
	///---
	
	/// SY 05/17/2005 QA70-7650 v8.0235 MORE_IMPORT_MODE_IN_OLD_ASCII_IMPORT_DLG
	if(run.LoadOC(Originlab\AscImpOptions, 16) == 0) //0x10 for auto loading dependent files
		/// Hong 12/19/08 QA80-12736 FIX_IMPORT_ASCII_FAIL_IMPORT_TO_GRAPH
		//AscImport(%B%A, %H);
		run -oc AscImport(%B%A, %H);
		/// end FIX_IMPORT_ASCII_FAIL_IMPORT_TO_GRAPH
	else
	{
	/// end MORE_IMPORT_MODE_IN_OLD_ASCII_IMPORT_DLG
		Open -w %B%A;
		/* Open the file in %A into the current worksheet window */
	
		/// EJP 07-10-2003 v7.0622 QA70-4745 SET_PAGE_IMPORT_INFO_ON_123_ASC_IMPORT
		if(@OCE > 0)
			/// Hong 12/19/08 QA80-12736 FIX_IMPORT_ASCII_FAIL_IMPORT_TO_GRAPH
			//set_ascii_import_page_info(%B%A);
			run -oc set_ascii_import_page_info(%B%A);
			/// end FIX_IMPORT_ASCII_FAIL_IMPORT_TO_GRAPH
		/// end SET_PAGE_IMPORT_INFO_ON_123_ASC_IMPORT
		
		set %H -ue;					//Update window incase this wks is an Excel wks
		if (exist(%H,5)==5)				//Set X and Y values of matrix to number rows and columns
		{
			matrix -pg Dim ii jj;
			matrix -ps X 1 ii;
			matrix -ps Y 1 jj;
		}	
	} /// SY 05/17/2005 QA70-7650 v8.0235 MORE_IMPORT_MODE_IN_OLD_ASCII_IMPORT_DLG
	
	return 0;

/////////////////////////////////////////////////////////
[ImportLotus]
	run.section(,Init);
	FDLOG.UseGroup(Lotus);
	if(FDLOG.Open(A))
		return 1;
	%B=FDLOG.Path$;
	open -WF %B%A;
	return 0;

/////////////////////////////////////////////////////////
[ImportADO]
	dbEdit;
	return 0;
	

/////////////////////////////////////////////////////////
// JMP V4.11 7/18/96 EXCEL32DBASE32 BEGIN
/////////////////////////////////////////////////////////
[ImportExcel32]
	run.section(,Init);
	FDLOG.UseGroup(ImportExcel);
	if(FDLOG.Open(A))
		return 1;
	%B=FDLOG.Path$;

	switch(FDLOG.DefType)
	{
	  case 1:
	    open -WE XLS2 %B%A;
	    break;
	  case 2:
	    open -WE XLS3 %B%A;
	    break;
	  case 3:
	    open -WE XLS4 %B%A;
	    break;
	}
	return 0;

/////////////////////////////////////////////////////////
[ImportDBase32]
	run.section(,Init);
	FDLOG.UseGroup(Dbase);
	if(FDLOG.Open(A))
		return 1;
	%B=FDLOG.Path$;
	switch(FDLOG.DefType)
	{
	  case 1:
	    open -WE DBF4 %B%A;
	    break;
	  case 2:
	    open -WE DBF3PLUS %B%A;
	    break;
	  case 3:
	    open -WE DBF3 %B%A;
	    break;
	  case 4:
	    open -WE DBF2 %B%A;
	    break;
	}
	return 0;

/////////////////////////////////////////////////////////
// JMP V4.11 7/18/96 EXCEL32DBASE32 END
/////////////////////////////////////////////////////////

[ASCIIExport]
	//---- CPY 10/18/06 temp code 
	/// Max 10/25/07 QA70-10581 LANGUAGE_SWITCH_CRASH_IN_J_LEAD_TO_NEW_LT_WAY_TO_RUN_XF
	//expASC -d;
	///------ Folger 10/28/09 QA81-14541 EXPORT_CSV_SHOULD_OUT_MESSAGE_ABOUT_FILE_LOCATION
	//run -xf expASC -d;
	run -xf expASC type:=dat -d;
	///------ End EXPORT_CSV_SHOULD_OUT_MESSAGE_ABOUT_FILE_LOCATION
	/// END LANGUAGE_SWITCH_CRASH_IN_J_LEAD_TO_NEW_LT_WAY_TO_RUN_XF
	return 0;
	//----
	run.section(,Init);
	FDLOG.default$=%H;
	FDLOG.UseGroup(Ascii);
	page.getfilename(L);	// get the file name into %L (window label or, if no label, name)

	FDLOG.DlgName$=$DialogBox.ExportTitle;
	if (FDLOG.SaveAs(A))
		return 1;

	i=(wks.export.cntrl&1)?1:0; /* include header */
	j=wks.sel>1?1:0;	//CHECK_MULTICELL_SELECTION
	l=(wks.export.cntrl&4)?1:0; /* include label */

	k=1;
	%K=$General.Tabs; /* separator choices */
	wks.export.c1=wks.c1;
	wks.export.c2=wks.c2;
	wks.export.r1=wks.r1;
	wks.export.r2=wks.r2;

	//Initialize separator list pointer to current separator
	//Note that the string property has actual separator, not escape sequence characters
	%B=wks.export.separator$;
	if ("%B"=="	")
		k=1;
	if ("%B"==",")
		k=2;
	if ("%B"==" ")
		k=3;
	if ("%B"==",	")
		k=4;
	if ("%B"==", ")
		k=5;

	//JMP v4.9983	7/01/97	EXPORT_LABELS
	if (FDLOG.DefType==3)
	{
		getn
			$file.ASCIIExportHeader	 i:2
			$file.ASCIIExportLabels l:2
			$file.ASCIIExportSelection j:2
			$file.ASCIIExportASCII;
		k=2;						//Set Delimiter to Comma
	}
	else
	{
		getn
			$file.ASCIIExportHeader	 i:2
			$file.ASCIIExportLabels l:2
			$file.ASCIIExportSelection j:2
			$file.ASCIIExportSeparator k:K
			$file.ASCIIExportASCII;
	}

	j=1-j;	/* inverse j */
	l=l?4:0;						//Set label value to 4

	wks.export.cntrl=i|l;					//Export Column Name plus Label givs 1 BitwiseOR 4 = 5

	if(j)
	{
		/* ignore selection, export whole worksheet */
		wks.export.cntrl+=2;
		#!type no selection;
	}
	else
	{
		/// SY 07-25-2003 QA70-4901 v7.0636 FIX_EXPORT_ASCII_SELECTION
		// Using new WKS_EXPORT_SELECTED flag for exporting selection
		wks.export.cntrl += 8;
		/// end FIX_EXPORT_ASCII_SELECTION

		if(wks.sel == 0)
		{
			type -b;					//BEEP!
			type -b $worksheetTool.NoData;
			return 1;
		}
	}

	switch(k)
	{
	case 1:
		wks.export.separator$="\t";
		break;
	case 2:
		wks.export.separator$=",";
		break;
	case 3:
		wks.export.separator$=" ";
		break;
	case 4:
		wks.export.separator$=",\t";
		break;
	case 5:
		wks.export.separator$=", ";
	break;
	};
	%B=FDLOG.path$;
	save -WH %H %B%A;
	return 0;

///////////////////////////////////////////////////////////////////////////////
/// Max 4/4/07 MATRIX_ASCII_EXPORT_USING_XF
[MatrixASCIIExport]
	/// Max 10/25/07 QA70-10581 LANGUAGE_SWITCH_CRASH_IN_J_LEAD_TO_NEW_LT_WAY_TO_RUN_XF
	//expMatASC -d;
	run -xf expMatASC -d;
	/// END LANGUAGE_SWITCH_CRASH_IN_J_LEAD_TO_NEW_LT_WAY_TO_RUN_XF
///
[CSVexport]

	///------ Folger 10/28/09 QA81-14541 EXPORT_CSV_SHOULD_OUT_MESSAGE_ABOUT_FILE_LOCATION
	//run.section(,Init);
	//FDLOG.default$=%H;
	//FDLOG.UseGroup(CSV);
//
	//page.getfilename(L);	// get the file name into %L (window label or, if no label, name)
	//%L=%[%L,'.'];		// Parse out FileName apart from file extension
//
	//FDLOG.DlgName$=$DialogBox.ExportCSVTitle;
	//if (FDLOG.SaveAs(A))
		//return 1;
//
	//wks.export.c1=wks.c1;
	//wks.export.c2=wks.c2;
	//wks.export.r1=wks.r1;
	//wks.export.r2=wks.r2;
//
	//wks.export.cntrl=3;	//Export Header with Entire Worksheet Data
//
	//wks.export.separator$=",";
	//%B=FDLOG.path$;
	//save -WH %H %B%A;
	run -xf expASC type:=csv -d;
	///------ End EXPORT_CSV_SHOULD_OUT_MESSAGE_ABOUT_FILE_LOCATION
	return 0;

///////////////////////////////////////////////////////////////////////////////
// CPY v6.1018 8/4/00 MOVE_EXPORT_PAGE_TO_GRAPHEXP
// this used to be where the [ExportPage] section was
////////////////////////////////////////////////////////////////////////////////////////////

//-------------------------- CPY v6.1018 8/10/00 MOVE_IMAGE_IMPORT_EXPORT
//------- CPY v6.0294 t8126 6/27/00  IMPORT_IMAGE_INTO_MATRIX
//-------- end t8126 6/27/00

//----------- CPY v6.1006 7/22/00 t8211 MATRIX_IMAGE_EXPORT
//
//----------- end CPY v6.1006 7/22/00 t8211 MATRIX_IMAGE_EXPORT
//-------------------------- end CPY v6.1018 8/10/00 MOVE_IMAGE_IMPORT_EXPORT

////////////////////////////////////////////////////////////////////////////////////////////
[FilterImport]
	run.section(,Init);
	GetFileName *.%1;
	open -WF %B%A; //GetFileName sets %A and %B
	return 0;

////////////////////////////////////////////////////////////////////////////////////////////////////////

[Exit]
	exit;
////////////////////////////////////////////////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////
[Spreadsheet]
	run.section(,Init);
	FDLOG.NumTypes=14;
	FDLOG.Type1$	=$DialogBox.ImportDBaseII;
	FDLOG.Type2$	=$DialogBox.ImportDBaseIII;
	FDLOG.Type3$	=$DialogBox.ImportDBaseIII+;
	FDLOG.Type4$	=$DialogBox.ImportDBaseIV;
	FDLOG.Type5$	=$DialogBox.ImportDIF;
	FDLOG.Type6$	=$DialogBox.ImportExcelV2X;
	FDLOG.Type7$	=$DialogBox.ImportExcelV3X;
	FDLOG.Type8$	=$DialogBox.ImportExcelV40;
	FDLOG.Type9$	=$DialogBox.ImportLotusV1X;
	FDLOG.Type10$	=$DialogBox.ImportLotusV2X;
	FDLOG.Type11$	=$DialogBox.ImportLotusV3X;
	FDLOG.Type12$	=$DialogBox.ImportLotusV4&5X;

	if(FDLOG.Open(A))
		return 1;
	%B=FDLOG.path$;
	if (System.Path.SavePath)
		System.Path.AppData$ = %B;

	switch(FDLOG.DefType)
	{
	  case 1:
	    open -WE DBF2 %B%A;
	    break;
	  case 2:
	    open -WE DBF3 %B%A;
	    break;
	  case 3:
	    open -WE DBF3PLUS %B%A;
	    break;
	  case 4:
	    open -WE DBF4 %B%A;
	    break;
	  case 5:
	    open -WE DIF %B%A;
	    break;
	  case 6:
	    open -WE XLS2 %B%A;
	    break;
	  case 7:
	    open -WE XLS3 %B%A;
	    break;
	  case 8:
	    open -WE XLS4 %B%A;
	    break;
	  case 9 to 12:
	    open -WF %B%A;
	    break;
	  case 13:
	    run.section(,SPWIN);
	    break;
	  case 14:
	    run.section(,SPDOS);
	    break;
	}
	return 0;


///////////////////////////////////////////////////
[ImportDIF]
	run.section(,Init);
	FDLOG.UseGroup(DIF);
	if(FDLOG.Open(A))
		return 1;
	%B=FDLOG.path$;
	open -WF %B%A;
	return 0;

[ScriptOpen]
	run.section(,Init);
	FDlog.UseGroup(Script);
	if(FDlog.Open(A))
		return 1;
	%B=FDlog.Path$;
	type -o open %B%A;
	return 0;

[ScriptSaveAs]
	run.section(,Init);
	FDlog.UseGroup(Script);
	if(FDlog.SaveAs(A))
		return 1;
	%B=FDlog.Path$;
	type -o save %B%A;
	return 0;

[NotesSaveAs]
	run.section(,Init);
	FDlog.UseGroup(Notes);
	FDlog.Default$=%2;
	if(FDlog.SaveAs(A))
		return 1;
	%B=FDlog.Path$;
	save -n "%1" %B%A;
	return 0;

[ExportButtonGroup]
dll -a OPack OPack; // temporary code
OPack.GetFileNames(%YExpGroup.tmp);
OPack.Pack(%1);
OPack.Reset();


[PrepareCopyFormats]
	/// EJP 2008-11-25 v8.0980 QA80-12647 USER_FRIENDLY_ERR_MSGS
	///if(run.LoadOC(Originlab\theme_utils.c) != 0)
	///{
	///	type -a "Compiler error, cannot compile theme_utils.c";
	///	return 1;
	///}
	if( 0 != Run.Section(, LoadOC, "Originlab\theme_utils.c") )
		return 1;
	/// end USER_FRIENDLY_ERR_MSGS
	return 0;
	
[PreparePasteFormats]
	/// EJP 2008-11-25 v8.0980 QA80-12647 USER_FRIENDLY_ERR_MSGS
	///if(run.loadOC(Originlab\ApplyFormats.c) != 0)
	///{
	///	type -a "Compiler error, cannot compile ApplyFormats.c";
	///	return 1;
	///}
	if( 0 != Run.Section(, LoadOC, "Originlab\ApplyFormats.c") )
		return 1;
	/// end USER_FRIENDLY_ERR_MSGS
	return 0;
		

[FmtsCopyAll]
	//run.loadOC(Originlab\ApplyFormats.c);
	run.section(,PrepareCopyFormats);
	//------ CPY 12/6/06 QA70-12736 LT_NEED_MORE_CNTRL_ON_ALLOWING_OC_FUNCS
	//all other similar changes in this file were made without marking
	//CopyFormat;
	run -oc CopyFormat;
	//------

[FmtsCopyAllStyles]
	run.section(,PrepareCopyFormats);
	run -oc CopyFormatAllStyles;

[FmtsCopyColors]
	run.section(,PrepareCopyFormats);
	run -oc CopyFormatColors;

[FmtsCopyFonts]
	run.section(,PrepareCopyFormats);
	run -oc CopyFormatFonts;

[FmtsCopyScales]
	run.section(,PrepareCopyFormats);
	run -oc CopyFormatScales;

[FmtsCopyDimensions]
	run.section(,PrepareCopyFormats);
	run -oc CopyFormatDimensions;

[FmtsCopyText]
	run.section(,PrepareCopyFormats);
	run -oc CopyFormatText;

[FmtsCopyBackground]
	run.section(,PrepareCopyFormats);
	run -oc CopyFormatBackground;

[FmtsCopyPlot]
	run.section(,PrepareCopyFormats);
	run -oc CopyFormatPlot;

///------ Folger 08/04/10 ORG-705 COPY_COLORMAP_FORMAT_CONTEXT_MENU
[FmtsCopyColormap]
	run.section(,PrepareCopyFormats);
	run -oc CopyFormatColormap;
///------ End COPY_COLORMAP_FORMAT_CONTEXT_MENU

/// RVD 9/15/2003 QA70-5179 v7.0695 THEME_SPECIAL_CONTEXT_MENU
[FmtsCopySpecial]
	run.section(,PrepareCopyFormats);
	run -oc CopyFormatSpecial %1;
/// end THEME_SPECIAL_CONTEXT_MENU

[PasteFormatsDlg]
	run.section(,PreparePasteFormats);
	run -oc PasteFormatsDialog 2;


[PasteFormats]
//%L = C:\c\vc32\themetemp.xml;
//page -apx -S %L;
//page -apx -L %L;
	run.section(,PreparePasteFormats);
	if(@KS)	 // shift select
		run -oc PasteFormatsDialog 1;
	else
		run -oc PasteFormatsDialog 0;


[ImportWizard]
	/// EJP 2008-01-31 v8.0798 QA70-11033 IMPWIZ_FAILS_TO_OPEN
	///run.LoadOC(OriginLab\ImportWiz.ocw);
	/// EJP 2008-11-25 v8.0980 QA80-12647 USER_FRIENDLY_ERR_MSGS
	///i = run.LoadOC(OriginLab\ImportWiz.ocw);
	///if( i )
	///{
	///	type -a "Error $(i) loading ImportWiz.ocw";
	///	return 1;
	///}
	if( 0 != Run.Section(, LoadOC, "Originlab\ImportWiz.ocw") )
		return 1;
	/// end USER_FRIENDLY_ERR_MSGS
	/// end IMPWIZ_FAILS_TO_OPEN
	run -oc ImportWizard; //ImportWizard("");  //Danice 12/30/03 QA70-5712 v8.0790 CALL_NEW_IMPORTWIZ_CODE
	return 0;
	
[ImportMatlab]
	run.LoadOC(OriginLab\MatLabImport.c);
	run -oc MatlabWorkspaceImport;
	return 0;
	
[ImportMatFile]
	run.LoadOC(OriginLab\MATFILEImportDlg.c);
	run -oc MatlabMatFileImportDlg;
	return 0;


[MATLABConsole]
	run.LoadOC(OriginLab\MatLabImport.c);
	run.LoadOC(OriginLab\MatLabConsole.c);
	run -oc MatlabConsole;
	return 0;

[LabView]
	run.LoadOC(Originlab\LabVIEWImport);
	//run.LoadOC(Originlab\tree_utils);	///	DVT 4/11/03 REMOVE_TREE_UTILS_FROM_LVDLG
	//run.LoadOC(OriginLab\LVDlg);
	//LabViewWorkspaceImport;
	run -oc LabViewWorkspaceImportDlg;
	return 0;

/// SY 02/03/2005 QA70-1995 v8.0188 OC_MATHEMATICA_LINK
[MathematicaLink]
	/// EJP 2007-07-18 v8.0663 QA70-10048 CHECK_MATHEMATICA_INSTALL_MSG
	///	if(run.LoadOC(Originlab\OMLink.c) == 0) 
	///		MathematicaLink;
	///	else
	///	{
	///		type -a "error in compiling OMLink.c;
	///		return 1;
	///	}
	///	return 0;
	/// EJP 2008-11-25 v8.0980 QA80-12647 USER_FRIENDLY_ERR_MSGS
	///if( Run.LoadOC(Originlab\OMLink.c) == 0 )
	if( 0 != Run.Section(, LoadOC, "Originlab\OMLink.c") )
		return 1;
	/// end USER_FRIENDLY_ERR_MSGS
	{
		if( Run.Section(,CallMathematicaLink) == 0 )
			return 0;
	}
	type -b $General.MathematicaLinkErr; /// EJP 2007-12-10 v8.0766 LOCALIZE_MATHEMATICA_START_ERR_MSG
	return 1;
	/// end CHECK_MATHEMATICA_INSTALL_MSG
/// end OC_MATHEMATICA_LINK

/// EJP 2007-07-18 v8.0663 QA70-10048 CHECK_MATHEMATICA_INSTALL_MSG
[CallMathematicaLink]
	// If a Command Error occurs when calling MathematicaLink then
	// this section will return 1 else the "return 0" will be executed.
	run -oc MathematicaLink;
	return 0; // Calling MathematicaLink did not cause a Command Error.
/// end CHECK_MATHEMATICA_INSTALL_MSG

[ThemeGallery]
	/// EJP 2008-11-25 v8.0980 QA80-12647 USER_FRIENDLY_ERR_MSGS
	///if(run.LoadOC(Originlab\ThemeGallery.c) ==0)
	///{
	///	ThemeGallery;
	///	return 0;
	///}
	///type -a "Error in compilation!";
	if( 0 == Run.Section(, LoadOC, "Originlab\ThemeGallery.c") )
	{
		run -oc ThemeGallery;
		return 0;
	}
	/// end USER_FRIENDLY_ERR_MSGS
	return 1;
	
//---- CPY 4/7/06 WKS_THEME_CHANGE_FROM_SAVE_TO_EDIT_FORMAT
[WksEditTheme]
	if(run.section(,PrepareCopyFormats) ==0)
	{
		/// EJP 2008-11-25 v8.0980 QA80-12647 USER_FRIENDLY_ERR_MSGS
		///err = run.LoadOC(Originlab\ThemeEditor.c);
		///if(err==0)
		if( 0 == Run.Section(, LoadOC, "Originlab\ThemeEditor.c") )
		/// end USER_FRIENDLY_ERR_MSGS
		{
			run -oc EditWksTheme;
			return 0;
		}
	}
	/// EJP 2008-11-25 v8.0980 QA80-12647 USER_FRIENDLY_ERR_MSGS
	///type -a "Error in compilation!";
	/// end USER_FRIENDLY_ERR_MSGS
	return 1;
//----

[FmtsSaveAsTheme]
	if(run.section(,PrepareCopyFormats) ==0)
	{
		/// EJP 2008-11-25 v8.0980 QA80-12647 USER_FRIENDLY_ERR_MSGS
		///err = run.LoadOC(Originlab\SaveFormatAsTheme.c);
		///if(err==0)
		if( 0 == Run.Section(, LoadOC, "Originlab\SaveFormatAsTheme.c") )
		/// end USER_FRIENDLY_ERR_MSGS
		{
			run -oc SaveFormatAsTheme;
			return 0;
		}
	}
	/// EJP 2008-11-25 v8.0980 QA80-12647 USER_FRIENDLY_ERR_MSGS
	///type -a "Error in compilation!";
	/// end USER_FRIENDLY_ERR_MSGS
	return 1;

[BatchProcessing]
	/// EJP 2009-09-17 QA81-14230 BATCH_PROCESSING_TBAR_BUTTON
	///	/// EJP 2008-11-25 v8.0980 QA80-12647 USER_FRIENDLY_ERR_MSGS
	///	///run.LoadOC(OriginLab\BatchProcessing.ocw);
	///	if( 0 != Run.Section(, LoadOC, "Originlab\BatchProcessing.ocw") )
	///		return 1;
	///	/// end USER_FRIENDLY_ERR_MSGS
	///	run -oc BatchProcessing;
	run -xf batchProcess -d;
	/// end BATCH_PROCESSING_TBAR_BUTTON
	return 0;


//---------------- CPY 1/26/05 v8.0187 ADD_FO_XF_TO_TOOLS_MENU
[FODialog]
	/// EJP 2008-11-25 v8.0980 QA80-12647 USER_FRIENDLY_ERR_MSGS
	///if(run.LoadOC(Originlab\FunctionOrganizerDlg.cpp, 16) == 0) //0x10 for auto loading dependent files
	///	FOOpen;
	///else
	///{
	///	type -a "error in compiling FunctionOrganizer.c;
	///	return 1;
	///}
	if( 0 != Run.Section(, LoadOC, "Originlab\FunctionOrganizerDlg.cpp" 16) )
		return 1;
	run -oc FOOpen;
	/// end USER_FRIENDLY_ERR_MSGS
	return 0;
	
///Kyle 08/27/2009 MAIN_MENU_ADD_CUSTOM_MENU_EDITOR
[OMCDialog]
	// call xf
	customMenu;
	return 0;
///End MAIN_MENU_ADD_CUSTOM_MENU_EDITOR


//---- CPY 7/27/10 ORG-435-P3 DEACTIVATE_MENU
[DeactivateLic]
	help -d
//----

[XFDialog]
	/// EJP 2008-11-25 v8.0980 QA80-12647 USER_FRIENDLY_ERR_MSGS
 	///if(run.LoadOC(Originlab\XFDialog, 16) == 0) //0x10 for auto loading dependent files
	///	XFOpen;
	///else
	///{
	///	type -a "error in compiling XFDialog.c;
	///	return 1;
	///}
	if( 0 != Run.Section(, LoadOC, "Originlab\XFDialog" 16) )
		return 1;
	run -oc XFOpen;
	/// end USER_FRIENDLY_ERR_MSGS
	return 0;

//---- CPY 5/23/07 QA70-9815 XF_SCRIPT_EXAMPLE_DIALOG
[XFScriptSamples]
	/// EJP 2008-11-25 v8.0980 QA80-12647 USER_FRIENDLY_ERR_MSGS
 	///if(run.LoadOC(Originlab\ScriptExampleDlg, 16) == 0) //0x10 for auto loading dependent files
	///	XFScriptSamples;
	///else
	///{
	///	type -a "error in compiling ScriptExampleDlg.c;
	///	return 1;
	///}
	if( 0 != Run.Section(, LoadOC, "Originlab\ScriptExampleDlg" 16) )
		return 1;
	run -oc XFScriptSamples;
	/// end USER_FRIENDLY_ERR_MSGS
	return 0;
//----

//------ CPY 7/13/2007 IMP_FILTER_MNGR_HOOK_UP_TO_MENU
[ImpFilterMngr]
	/// EJP 2008-11-25 v8.0980 QA80-12647 USER_FRIENDLY_ERR_MSGS
 	///if(run.LoadOC(Originlab\FilterManager, 16) == 0) //0x10 for auto loading dependent files
	///	FilterManager;
	///else
	///{
	///	type -a "error in compiling FilterManager.c;
	///	return 1;
	///}
	if( 0 != Run.Section(, LoadOC, "Originlab\FilterManager" 16) )
		return 1;
	run -oc FilterManager;
	/// end USER_FRIENDLY_ERR_MSGS
	return 0;
//------

//----------------

///DSC 3/16/05 QA70-7500 v8.0206 ADD_EVENT_ORGANIZER_DLG_TO_TOOLS_MENU
[EODialog]
	/// EJP 2008-11-25 v8.0980 QA80-12647 USER_FRIENDLY_ERR_MSGS
	///if(run.LoadOC(Originlab\GlobalEvents, 16) == 0) //0x10 for auto loading dependent files
	if( 0 == Run.Section(, LoadOC, "Originlab\GlobalEvents" 16) )
	/// end USER_FRIENDLY_ERR_MSGS
		run -oc EventsOrganizer;
	return 0;
///end ADD_EVENT_ORGANIZER_DLG_TO_TOOLS_MENU


	
//--- CPY 12/30/05 QA70-8347 REPLACE_TEMPLATE_LIB_WITH_TEMPLATE_ORGANIZER
[TemplateOrganizer]
	/// EJP 2008-11-25 v8.0980 QA80-12647 USER_FRIENDLY_ERR_MSGS
	///if(run.LoadOC(Originlab\TemplateOrganizer) == 0)
	///	OpenTemplateOrganizer 1;
	///else
	///	type -b "Failed to compile TemplateOrganizer";
	if( 0 == Run.Section(, LoadOC, "Originlab\TemplateOrganizer") )
		run -oc OpenTemplateOrganizer 1;
	/// end USER_FRIENDLY_ERR_MSGS
//---

/// Max 4/19/07 ADD_HELP_LANGUAGE_CHAGE
[LanguageChange]
	//---- CPY 10/23/07 QA70-10581 LANGUAGE_SWITCH_CRASH_IN_J_LEAD_TO_NEW_LT_WAY_TO_RUN_XF
	//language -d;
	run -xf language -d;
	//----
///---
//---- CPY 9/24/09 QA70-14275 MODULE_LICENSE_DIALOG_MOVED_TO_RC
[NewModuleLic]
	run -xf lic -d;
//----

//----- CPY 9/25/09 QA70-14358 ADD_PROTECTION_MENU_ITEMS
[ProtectProject]
	doc -pwd;
[AuditLog]
	doc -log;
//-----

//----- CPY 10/3/09 QA70-14402 MOVE_REIMOPRT_TO_FILE_MENU_TOP_LEVEL
[ReimportDirect]
	run -xf reimport;
[ReimportDialog]
	run -xf reimport 1;
//-----

/// EJP 2008-01-21 v8.0790 QA70-10839 OC_CHECK_FOR_UPDATES
[CheckForUpdates]
// Press Alt to use the previous Check For Updates dialog.
// This ability will be removed after new code passes testing.
if( @KA )
{
	dll -a ohttp ohttp; if(ohttp.checkupdates()==2) @VR=3; dll -r ohttp;
	return 0;
}
/// EJP 2008-11-25 v8.0980 QA80-12647 USER_FRIENDLY_ERR_MSGS
///err=run.LoadOC("OriginLab\ChkForUpdatesDlg.c",1);
///if(err)
///	type -b "Error $(err)";
///else
///	DoCheckForUpdatesDlg;
///DSC 5/18/09 QA70-13524 SAVE_CHKFORUPDATESDLG_OP_IN_TEMP_FOLDER_FOR_DEVKIT
// if( 0 == Run.Section(, LoadOC, "OriginLab\ChkForUpdatesDlg.c" 1) )
// 	run -oc DoCheckForUpdatesDlg;
if( 0 == Run.Section(, LoadOC, "OriginLab\ChkForUpdatesDlg.c" 0) )
	run -oc DoCheckForUpdatesDlg;
///end SAVE_CHKFORUPDATESDLG_OP_IN_TEMP_FOLDER_FOR_DEVKIT
/// end USER_FRIENDLY_ERR_MSGS
/// end OC_CHECK_FOR_UPDATES

[LoadOC]
if( %2 == 0/0 )
	err = Run.LoadOC(%1);
else
	err = Run.LoadOC(%1, %2);
if( err == 0 )
	return 0; // success
switch(err)
{
case 1: // LOADOC_ERR_FILE_NOT_FOUND
	%z=$LoadOC.Msg1;
	break;
case 2: // LOADOC_ERR_COMPILE
	%z=$LoadOC.Msg2;
	break;
case 3: // LOADOC_ERR_LOADING
	%z=$LoadOC.Msg3;
	break;
case 4: // LOADOC_ERR_INTERNAL_C
	%z=$LoadOC.Msg4;
	break;
case 5: // LOADOC_ALREADY_LOADED
	%z=$LoadOC.Msg5;
	break;
case 6: // LOADOC_FROM_BINARY
	%z=$LoadOC.Msg6;
	break;
case 8: // LOADOC_ERR_COMPILER_BUSY
	%z=$LoadOC.Msg8;
	break;
case 9: // LOADOC_NOT_COMPILED_QUICK_EXIT
	%z=$LoadOC.Msg9;
	break;
default:
	%z=$LoadOC.Msg7; %z=Error $(err)\n%z;
	break;
}
type -b %z;
return err;
/// end USER_FRIENDLY_ERR_MSGS

//---- CPY 6/19/09 QA80-13551-P1 TITLE_BAR_CONTEXT_MENU_TO_ADD_SHORT_CUT
[AddShortCutToFavorites]
	page -X;
//---- end TITLE_BAR_CONTEXT_MENU_TO_ADD_SHORT_CUT

[FILEEXT]
NUMGROUPS=62
1_NAME=Origin
1_NUMTYPES=9
1_TYPE1=$FileType.Project
1_TYPE2=$FileType.Document
1_TYPE3=$FileType.Wks
1_TYPE4=$FileType.Graph
1_TYPE5=$FileType.Matrix
1_TYPE6=$FileType.AscData
1_TYPE7=$FileType.Notes
1_TYPE8=$FileType.OriginProg
;/// EJP 2008-02-26 v8.0813 QA80-11018 ADD_TEMPLATE_TYPE_TO_FILE_OPEN_DLG
1_TYPE9=$FileType.OriginTemplates
;/// end ADD_TEMPLATE_TYPE_TO_FILE_OPEN_DLG
2_NAME=Excel
2_NUMTYPES=2
2_TYPE1=$FileType.Excel
;/// Hong 03/28/08 QA80-8336 v8.0834 EXCEL_NEED_PROJECT_FILE_SUPPORT
2_TYPE2=$FileType.ExcelBook
;/// end EXCEL_NEED_PROJECT_FILE_SUPPORT
3_NAME=Template
3_NUMTYPES=3
3_TYPE1=$FileType.GraphTemp
3_TYPE2=$FileType.WksTemp
3_TYPE3=$FileType.MatrixTemp
4_NAME=ASCII
;---Sim 04-12-2007 REMOVE_CSV_TYPE_FROM_ASCII_IMPORT
4_NUMTYPES=3
4_TYPE1=$FileType.Dat
4_TYPE2=$FileType.TXT
;4_TYPE3=$FileType.CSV
4_TYPE3=$FileType.AllFiles
;---END REMOVE_CSV_TYPE_FROM_ASCII_IMPORT

;----- CPY 9/11/2007 SET_ASCII_DEFAULT_TO_EXE_SAMPLE_FIT_DATA
;4_DefPath=Samples
4_DefPath=Samples\
;-----

5_NAME=Lotus
5_NUMTYPES=4
5_TYPE1=$FileType.LotusV4&5X
5_TYPE2=$FileType.LotusV3X
5_TYPE3=$FileType.LotusV2X
5_TYPE4=$FileType.LotusV1X
6_NAME=ImportExcel
6_NUMTYPES=3
6_TYPE1=$FileType.ExcelV40
6_TYPE2=$FileType.ExcelV3X
6_TYPE3=$FileType.ExcelV2X
7_NAME=Dbase
7_NUMTYPES=4
7_TYPE1=$FileType.DBaseIV
7_TYPE2=$FileType.DBaseIII+
7_TYPE3=$FileType.DBaseIII
7_TYPE4=$FileType.DBaseII
8_NAME=DIF
8_NUMTYPES=1
8_TYPE1=$FileType.DIF
9_NAME=Labtech
9_NUMTYPES=1
9_TYPE1=$FileType.LabTech
10_NAME=Sound
10_NUMTYPES=1
10_TYPE1=$FileType.WAV
11_NAME=Mathematica
11_NUMTYPES=1
11_TYPE1=$FileType.Mathematica
12_NAME=Kaleidagraph
12_NUMTYPES=1
12_TYPE1=$FileType.Kaleidagraph
13_NAME=Image
;-------- CPY 10/5/09 QA70-14406-P5 DEFAULT_TO_EPS_FROM_TOOLS_OPTIONS_FOR_IMAGE, image = graph export, for historical reason
13_DefType=5
;--------
13_NUMTYPES=17
13_TYPE1=$FileType.AI
13_TYPE2=$FileType.BMP
13_TYPE3=$FileType.CGM
13_TYPE4=$FileType.DXF
13_TYPE5=$FileType.EPS
13_TYPE6=$FileType.GIF
13_TYPE7=$FileType.JPG
13_TYPE8=$FileType.PCX
13_TYPE9=$FileType.PNG
13_TYPE10=$FileType.TGA
13_TYPE11=$FileType.PDF
13_TYPE12=$FileType.PSD
13_TYPE13=$FileType.TIF
13_TYPE14=$FileType.EMF
13_TYPE15=$FileType.XPM
13_TYPE16=$FileType.XWD
13_TYPE17=$FileType.WMF
14_NAME=CSV
14_NUMTYPES=1
14_TYPE1=$FileType.CSV
; Max 9/17/08 SET_CSV_DEFAULT_TO_EXE_SAMPLE
;14_DefPath=Samples\Import and Export
14_DefPath=Samples\Import and Export\
; end SET_CSV_DEFAULT_TO_EXE_SAMPLE
15_NAME=pClamp
; Hong 03/05/09 QA80-13222 PCLAMP_GROUP_MORE_TYPE
;15_NUMTYPES=3
15_NUMTYPES=5
; end PCLAMP_GROUP_MORE_TYPE
15_TYPE1=$FileType.Abf
15_TYPE2=$FileType.Dat
; Hong 03/05/09 QA80-13222 PCLAMP_GROUP_MORE_TYPE
;15_TYPE3=$FileType.pCLAMPFiles
;15_DEFTYPE=3
15_TYPE3=$FileType.AllAb
15_TYPE4=$FileType.pCLAMPFiles
15_TYPE5=$FileType.AllFiles
15_DEFTYPE=4
; end PCLAMP_GROUP_MORE_TYPE
;----- CPY 9/11/2007 SET_ASCII_DEFAULT_TO_EXE_SAMPLE_FIT_DATA
;15_DefPath=Samples\Import and Export\pCLAMP
15_DefPath=Samples\Import and Export\pCLAMP\
;-----

16_NAME=Script
16_NUMTYPES=3
16_TYPE1=$FileType.Script
16_TYPE2=$FileType.TXT
16_TYPE3=$FileType.AllFiles
17_NAME=Notes
17_NUMTYPES=3
17_TYPE1=$FileType.TXT
17_TYPE2=$FileType.Script
17_TYPE3=$FileType.AllFiles
18_NAME=Editor
18_NUMTYPES=4
18_TYPE1=$FileType.Script
18_TYPE2=$FileType.Procedure
18_TYPE3=$FileType.Initialize
18_TYPE4=$FileType.TXT
19_Name=SigmaPlot
19_NUMTYPES=1
19_TYPE1=$FileType.SigmaJNB
20_Name=ODAQ
20_NUMTYPES=1
20_TYPE1=$FileType.ODAQ
;Cheney 2006-12-11 ADD_CGM_TYPE_FOR_ThermoGalactic
21_Name=ThermoGalactic
21_NUMTYPES=3
21_TYPE1=$FileType.SPC
21_TYPE2=$FileType.TGM
21_TYPE3=$FileType.ThermoFiles
21_DEFTYPE=3
;end ADD_CGM_TYPE_FOR_ThermoGalactic
22_Name=MiniTab
22_NUMTYPES=3
22_TYPE1=$FileType.MiniTabMTW
22_TYPE2=$FileType.MiniTabMPJ
22_TYPE3=$FileType.MiniTabFiles
22_DEFTYPE=3
23_NAME=OriginC
23_NUMTYPES=8
23_TYPE1=$FileType.C
23_TYPE2=$FileType.CPP
23_TYPE3=$FileType.OriginCSourceFiles
23_TYPE4=$FileType.H
23_TYPE5=$FileType.OriginCFiles
23_TYPE6=$FileType.FIT
23_TYPE7=$FileType.OP
23_TYPE8=$FileType.X-Function
24_NAME=OriginCWorkspace
24_NUMTYPES=1
24_TYPE1=$FileType.OriginCWorkspace
25_NAME=OPack
25_NUMTYPES=1
25_TYPE1=$FileType.OPack
26_NAME=Samples
26_NUMTYPES=8
26_TYPE1=$FileType.Project
26_TYPE2=$FileType.Document
26_TYPE3=$FileType.Wks
26_TYPE4=$FileType.Graph
26_TYPE5=$FileType.Matrix
26_TYPE6=$FileType.AscData
26_TYPE7=$FileType.Notes
26_TYPE8=$FileType.OriginProg
27_NAME=XFunction
27_NUMTYPES=1
27_TYPE1=$FileType.X-Function
28_NAME=EarthProbe
28_NUMTYPES=1
28_TYPE1=$FileType.EPA
29_NAME=PrincetonInstruments
29_NUMTYPES=1
29_TYPE1=$FileType.SPE
; Max 9/17/08 SET_SPE_DEFAULT_TO_EXE_SAMPLE
;29_DefPath=Samples\Import and Export\Princeton Instruments SPE
29_DefPath=Samples\Import and Export\Princeton Instruments SPE\
; end SET_SPE_DEFAULT_TO_EXE_SAMPLE
30_NAME=OriginFilterFiles
30_NUMTYPES=1
30_TYPE1=$FileType.OriginFilterFiles
31_NAME=NetCDF
31_NUMTYPES=1
31_TYPE1=$FileType.NetCDF
32_NAME=MDFFiles
32_NUMTYPES=1
32_TYPE1=$FileType.MDF
; Max 9/17/08 SET_MDF_DEFAULT_TO_EXE_SAMPLE
;32_DefPath=Samples\Import and Export\ETAS INCA MDF
32_DefPath=Samples\Import and Export\ETAS INCA MDF\
; end SET_MDF_DEFAULT_TO_EXE_SAMPLE
33_NAME=Palette
33_NUMTYPES=1
33_TYPE1=$FileType.Pal
; Max 9/28/08 SET_PAL_DEFAULT_TO_EXE_SAMPLE
;33_DefPath=Palettes
33_DefPath=Palettes\
; end SET_PAL_DEFAULT_TO_EXE_SAMPLE
34_NAME=DCFFiles
34_NUMTYPES=3
34_TYPE1=$FileType.DCF
34_TYPE2=$FileType.HPF
34_TYPE3=$FileType.DTFiles
34_DEFTYPE=3
35_NAME=TDMFiles
35_NUMTYPES=2
35_TYPE1=$FileType.TDM
; Hong 09/11/07 v8.0700 UPDATE_TO_NEW_DLL_SUPPORT_TDMS
35_TYPE2=$FileType.TDMS
; end UPDATE_TO_NEW_DLL_SUPPORT_TDMS
; Cheney 2006-12-19 SUPPORT_JCAMP_FILE
36_Name=JCAMP
36_NUMTYPES=5
36_TYPE1=$FileType.DX
36_TYPE2=$FileType.DX1
36_TYPE3=$FileType.JDX
36_TYPE4=$FileType.JCM
36_TYPE5=$FileType.JCAMPFiles
36_DEFTYPE=5
; end SUPPORT_JCAMP_FILE
; Cheney 2006-12-25 SUPPORT_DIADEM_FILE
37_NAME=DIADEMFiles
37_NUMTYPES=1
37_TYPE1=$FileType.DIADEM
; end SUPPORT_DIADEM_FILE
; Iris 12/29/2006 ADD_PPT_FILE_GROUP
38_NAME=PPTFILEs
38_NUMTYPES=2
38_TYPE1=$FileType.PPT
38_TYPE2=$FileType.POT
; END ADD_PPT_FILE_GROUP
;---Sim 01-03-2006 FAMOS_FILES
39_NAME=FAMOS
39_NUMTYPES=1
39_TYPE1=$FileType.FAM
;---END FAMOS_FILES
;---Sim 02-08-2007 TEMPLATE_FILES_GROUP
40_NAME=ImportFileTemplates
40_NUMTYPES=5
40_TYPE1=$FileType.WksTemp
40_TYPE2=$FileType.MatrixTemp
40_TYPE3=$FileType.WksWindow
40_TYPE4=$FileType.MatrixWindow
40_TYPE5=$FileType.ImportFileAllTemps
40_DEFTYPE=5
;---END TEMPLATE_FILES_GROUP
41_NAME=OriginPackage
41_NUMTYPES=1
41_TYPE1=$FileType.OPX
; Hong 04/09/07 QA80-9594 MORE_IN_80_IMPORT_MATLAB 
42_NAME=MatlabFiles
42_NUMTYPES=1
42_TYPE1=$FileType.MAT
; end MORE_IN_80_IMPORT_MATLAB

;---Joseph 04/26/07 QA70-9678 ADD_SCRIPT_EXAMPLE_NODE
43_NAME=OGSFiles
43_NUMTYPES=1
43_TYPE1=$FileType.OGS
; Max 12/3/07 SET_OGS_DEFAULT_TO_EXE_SAMPLES
43_DefPath=Samples\LabTalk Script Examples\
; END SET_OGS_DEFAULT_TO_EXE_SAMPLES
;---End ADD_SCRIPT_EXAMPLE_NODE

;---Sim 06-18-2007 ADD_ASCII_EXPORT_TYPES
44_NAME=ASCIIEXP
44_NUMTYPES=4
44_TYPE1=$FileType.Dat
44_TYPE2=$FileType.TXT
44_TYPE3=$FileType.CSV
44_TYPE4=$FileType.AllFiles
;---END ADD_ASCII_EXPORT_TYPES

;---Sim 06-21-2007 ADD_PDF_EXPORT_TYPES
45_NAME=PDF
45_NUMTYPES=1
45_TYPE1=$FileType.PDF
;---END ADD_PDF_EXPORT_TYPES

;---Sim 06-21-2007 ADD_IMAGE_EXPORT_TYPES
46_NAME=ImageExp
46_NUMTYPES=8
46_TYPE1=$FileType.BMP
46_TYPE2=$FileType.GIF
46_TYPE3=$FileType.JPG
46_TYPE4=$FileType.PCX
46_TYPE5=$FileType.PNG
46_TYPE6=$FileType.TGA
46_TYPE7=$FileType.PSD
46_TYPE8=$FileType.TIF
;---END ADD_IMAGE_EXPORT_TYPES

;---EJP 2007-12-07 v8.0764 CODE_BUILDER_SAMPLES_PATH
47_NAME=CodeBuilder
47_NUMTYPES=9
47_TYPE1=$FileType.C
47_TYPE2=$FileType.CPP
47_TYPE3=$FileType.OriginCSourceFiles
47_TYPE4=$FileType.H
47_TYPE5=$FileType.OriginCFiles
47_TYPE6=$FileType.FIT
47_TYPE7=$FileType.OP
47_TYPE8=$FileType.X-Function
47_TYPE9=$FileType.OGS
;---end CODE_BUILDER_SAMPLES_PATH

;---Hong 01/08/08 QA80-10541 USE_GROUP_TYPE_REMEMBER_LAST_OPEN_PATH
48_NAME=Binary
48_NUMTYPES=1
48_TYPE1=$FileType.AllFiles

49_NAME=UserDefined
49_NUMTYPES=1
49_TYPE1=$FileType.AllFiles

;--- AW 01/14/08 ADD_SIE_FILE_GROUP
50_NAME=SIE
50_NUMTYPES=1
50_TYPE1=$FileType.SIE
50_DefPath=Samples\Import and Export\nCode Somat SIE
;---- END ADD_SIE_FILE_GROUP

;--- Fisher 02/21/08 ADD_IGORPRO_FILE_GROUP
51_NAME=IGOR
51_NUMTYPES=1
51_TYPE1=$FileType.PXP
51_DefPath=Samples\Import and Export\Igor Pro

;--- Fisher 03/26/08 ADD_IGORPRO_FILE_GROUP
52_NAME=HEKA
52_NUMTYPES=1
52_TYPE1=$FileType.HEKA
52_DefPath=Samples\Import and Export\HEKA

;-----CPY 09-18-2008 QA80-12203 2DARRAY_IMPORT_TO_MATRIXOBJ
53_NAME=Bin2D
53_NUMTYPES=3
53_TYPE1=$FileType.IMG
53_TYPE2=$FileType.B2D
53_TYPE3=$FileType.AllFiles
;-----

;----Sophy 3/3/2009 SUPPORT_CDF
54_NAME=CDF
54_NUMTYPES=1
54_TYPE1=$FileType.CDF
;----

;----Sophy 3/22/2009 SUPPORT_HDF5
55_NAME=HDF5
55_NUMTYPES=1
55_TYPE1=$FileType.HDF5
;----

;---end USE_GROUP_TYPE_REMEMBER_LAST_OPEN_PATH

;---Sim 07-17-2009 QA81-4184 REDO_POWERPOINT_EXPORT_AS_SLIDE_SHOW
56_NAME=PowerPoint
56_NUMTYPES=2
56_TYPE1=$FileType.PPT
56_TYPE2=$FileType.PPS

57_NAME=PowerPointTemplate
57_NUMTYPES=1
57_TYPE1=$FileType.POT

;----Sophy QA80-14208 9/23/2009 SUPPORT_SLICE_CONTROL_BINARY_FILE
58_NAME=BinF
58_NUMTYPES=1
58_TYPE1=$FileType.CHN
;end SUPPORT_SLICE_CONTROL_BINARY_FILE

;---END QA81-4184 REDO_POWERPOINT_EXPORT_AS_SLIDE_SHOW

;----Sophy 2/11/2010 QA80-14760 SUPPORT_EUROPEAN_DATA_FORMAT_FILE
59_NAME=EDF
59_NUMTYPES=1
59_TYPE1=$FileType.EDF
;end SUPPORT_EUROPEAN_DATA_FORMAT_FILE

;----Sophy 6/4/2010 ORG-150 IMAGE_GROUP_FOR_IMPORT_IMAGE_FILE_DLG
60_NAME=ImageImp
60_NUMTYPES=11
60_TYPE1=$FileType.BMP
60_TYPE2=$FileType.GIF
60_TYPE3=$FileType.JPG
60_TYPE4=$FileType.PCX
60_TYPE5=$FileType.PNG
60_TYPE6=$FileType.TGA
60_TYPE7=$FileType.PSD
60_TYPE8=$FileType.TIF
60_TYPE9=$FileType.WMF
60_TYPE10=$FileType.EMF
60_TYPE11=$FileType.ImagesImp
;---IMAGE_GROUP_FOR_IMPORT_IMAGE_FILE_DLG

;----Sophy 7/15/2010 ORG-441 SUPPORT_MZXML_DATA_IMPORT
61_NAME=mzXML
61_NUMTYPES=1
61_TYPE1=$FileType.MZXML
;---SUPPORT_MZXML_DATA_IMPORT

;----Sophy 8/4/2010 ORG-567 SUPPORT_IAEA_SPE_IMPORT
62_NAME=IAEASPE
62_NUMTYPES=1
62_TYPE1=$FileType.IAEASPE
;---SUPPORT_IAEA_SPE_IMPORT