Ciao,
Lavorare su un'automazione di un'analisi e rimanere bloccati sul primo passaggio di importazione di un file csv. Il mio approccio consiste nell'usare come base gli script generati automaticamente.
Il seguente script funziona sul mio file di prova e vorrei modificare per utilizzare il browser di file per scegliere un file invece dell'attuale hard coding.
La documentazione di scripting afferma che se la stringa del percorso del file non è presente, verrà utilizzata la finestra di dialogo del file. In questo senso, elimino il file "$ DESKTOP / test.csv" stringa, tuttavia questo restituisce solo un errore che richiede una stringa. Se faccio un'apertura senza la definizione della colonna come dt = open (); quindi viene presentata la finestra di dialogo del file ma viene presentata la finestra di dialogo di importazione e deve essere cliccata attraverso la quale vorrei evitare. Come ottengo una finestra di dialogo file per scegliere un file insieme alle definizioni di colonna per la tabella dati finale?
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" )
)
)