你好,
致力于自动化分析,并在导入 csv 文件的第一步中陷入困境。 我的方法是使用自动生成的脚本作为基础。
以下脚本适用于我的测试文件,我想修改为使用文件浏览器来选择文件而不是当前的硬编码。
脚本文档指出,如果文件路径字符串不存在,则将使用文件对话框。 本着这种精神,我删除了“$DESKTOP/test.csv”字符串,但这只是返回请求字符串的错误。 如果我在没有列定义的情况下进行打开,例如 dt =open();然后会出现文件对话框,但会出现导入对话框,并且需要单击我想避免的情况。 如何获得文件对话框窗口来选择文件以及最终数据表的列定义?
安迪
Open(
"$DESKTOP/test.csv",
columns(
New Column( "Time (s)", Numeric, "Continuous", Format( "Best", 12 ) ),
New Column( "Step", Numeric, "Continuous", Format( "Best", 12 ) ),
New Column( "Cycle", Numeric, "Continuous", Format( "Best", 12 ) ),
New Column( "MFC1 (slm)", Numeric, "Continuous", Format( "Best", 12 ) ),
New Column( "MFC2 (sccm)", Numeric, "Continuous", Format( "Best", 12 ) ),
New Column( "MFC3 (sccm)", Numeric, "Continuous", Format( "Best", 12 ) ),
New Column( "MFC4 (sccm)", Numeric, "Continuous", Format( "Best", 12 ) ),
New Column( "TV Pres (torr)", Numeric, "Continuous", Format( "Best", 12 ) ),
New Column( "TV Pos (%)", Numeric, "Continuous", Format( "Best", 12 ) ),
New Column( "DS Pres (torr)", Numeric, "Continuous", Format( "Best", 12 ) ),
New Column( "Rpm", Numeric, "Continuous", Format( "Best", 12 ) ),
New Column( "Torque", Numeric, "Continuous", Format( "Best", 12 ) ),
New Column( "A1 (C)", Numeric, "Continuous", Format( "Best", 12 ) ),
New Column( "A2 (C)", Numeric, "Continuous", Format( "Best", 12 ) ),
New Column( "A3 (C)", Numeric, "Continuous", Format( "Best", 12 ) ),
New Column( "GL1 (C)", Numeric, "Continuous", Format( "Best", 12 ) ),
New Column( "GL2 (C)", Numeric, "Continuous", Format( "Best", 12 ) ),
New Column( "GL3 (C)", Numeric, "Continuous", Format( "Best", 12 ) ),
New Column( "CH GL (C)", Numeric, "Continuous", Format( "Best", 12 ) ),
New Column( "CH T (C)", Numeric, "Continuous", Format( "Best", 12 ) ),
New Column( "CH B (C)", Numeric, "Continuous", Format( "Best", 12 ) ),
New Column( "CH U (C)", Numeric, "Continuous", Format( "Best", 12 ) )
),
Import Settings(
End Of Line( CRLF, CR, LF ),
End Of Field( Comma, CSV( 0 ) ),
Strip Quotes( 1 ),
Use Apostrophe as Quotation Mark( 0 ),
Use Regional Settings( 0 ),
Scan Whole File( 1 ),
Treat empty columns as numeric( 0 ),
CompressNumericColumns( 0 ),
CompressCharacterColumns( 0 ),
CompressAllowListCheck( 0 ),
Labels( 1 ),
Column Names Start( 1 ),
Data Starts( 2 ),
Lines To Read( "All" ),
Year Rule( "20xx" )
)
)