<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Scripting open CSV with both file dialog picker and column definitions. in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Scripting-open-CSV-with-both-file-dialog-picker-and-column/m-p/384788#M63515</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Working on an automation of an analysis and getting hung up on the first step of importing a csv file. &amp;nbsp;My approach is to use the automatically generated scripts as a basis.&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;The scripting documentation states that if the file path string is not present then the file dialog will be used. &amp;nbsp;In that vein, I delete the&amp;nbsp;&lt;CODE class=" language-jsl"&gt;"$DESKTOP/test.csv" &lt;/CODE&gt;string, however this just returns an error requesting a string. &amp;nbsp;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. &amp;nbsp;How do I get a file dialog window to pick a file along with the column definitions for the final data table?&lt;/P&gt;&lt;P&gt;Andy&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;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" )
	)
)&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 09 Jun 2023 19:46:47 GMT</pubDate>
    <dc:creator>Hegedus1</dc:creator>
    <dc:date>2023-06-09T19:46:47Z</dc:date>
    <item>
      <title>Scripting open CSV with both file dialog picker and column definitions.</title>
      <link>https://community.jmp.com/t5/Discussions/Scripting-open-CSV-with-both-file-dialog-picker-and-column/m-p/384788#M63515</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Working on an automation of an analysis and getting hung up on the first step of importing a csv file. &amp;nbsp;My approach is to use the automatically generated scripts as a basis.&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;The scripting documentation states that if the file path string is not present then the file dialog will be used. &amp;nbsp;In that vein, I delete the&amp;nbsp;&lt;CODE class=" language-jsl"&gt;"$DESKTOP/test.csv" &lt;/CODE&gt;string, however this just returns an error requesting a string. &amp;nbsp;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. &amp;nbsp;How do I get a file dialog window to pick a file along with the column definitions for the final data table?&lt;/P&gt;&lt;P&gt;Andy&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;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" )
	)
)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Jun 2023 19:46:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Scripting-open-CSV-with-both-file-dialog-picker-and-column/m-p/384788#M63515</guid>
      <dc:creator>Hegedus1</dc:creator>
      <dc:date>2023-06-09T19:46:47Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting open CSV with both file dialog picker and column definitions.</title>
      <link>https://community.jmp.com/t5/Discussions/Scripting-open-CSV-with-both-file-dialog-picker-and-column/m-p/384799#M63516</link>
      <description>&lt;P&gt;Could you use &lt;A href="https://www.jmp.com/support/help/en/16.0/#page/jmp/select-a-directory-or-file.shtml" target="_self"&gt;Pick File()&lt;/A&gt; and then use that filename in the Open()?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;chosen_file=pick file("Choose a .csv file", "$DESKTOP", {"Text files|csv;"});

open(chosen_file);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 13 May 2021 14:33:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Scripting-open-CSV-with-both-file-dialog-picker-and-column/m-p/384799#M63516</guid>
      <dc:creator>Jeff_Perkinson</dc:creator>
      <dc:date>2021-05-13T14:33:29Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting open CSV with both file dialog picker and column definitions.</title>
      <link>https://community.jmp.com/t5/Discussions/Scripting-open-CSV-with-both-file-dialog-picker-and-column/m-p/384806#M63517</link>
      <description>Hi Jeff,&lt;BR /&gt;&lt;BR /&gt;Thanks that works. Just for completeness why didn't the open function work when column specification were included?&lt;BR /&gt;Andy</description>
      <pubDate>Thu, 13 May 2021 14:41:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Scripting-open-CSV-with-both-file-dialog-picker-and-column/m-p/384806#M63517</guid>
      <dc:creator>Hegedus1</dc:creator>
      <dc:date>2021-05-13T14:41:36Z</dc:date>
    </item>
  </channel>
</rss>

