Hi,
Working on an automation of an analysis and getting hung up on the first step of importing a csv file. My approach is to use the automatically generated scripts as a basis.
The following script works on my test file and I would like to modify to use the file browser to pick a file instead of the current hard coding.
The scripting documentation states that if the file path string is not present then the file dialog will be used. In that vein, I delete the "$DESKTOP/test.csv"
string, however this just returns an error requesting a string. If I do an open without the column definition such as dt =open(); then the file dialog is presented but the import dialog is presented and needs to to be clicked through which I would like to avoid. How do I get a file dialog window to pick a file along with the column definitions for the final data table?
Andy
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" )
)
)