<?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 Re: Script to select columns  from a list in clipboard in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Script-to-select-columns-from-a-list-in-clipboard/m-p/421156#M66994</link>
    <description>&lt;P&gt;I found a Rube Goldberg-esque way to generate the required format .&amp;nbsp; I will attempt to integrate into a complete script later to share.&lt;/P&gt;
&lt;P&gt;he following takes a list in clipboard and converts it to the required format.... e.g.&amp;nbsp;&lt;SPAN&gt;{"Tcea1", Atp6v1h", "Oprk1", "Rb1cc1, "Fam150a"}&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;//here get list from clipboard first .&amp;nbsp; Here the column names are genes
//COPY columns names from a row in JMP or excel into your clipboard

//PART ONE

// New data table

// Data Table( "TempGeneList" )

New Table( "TempGeneList" );

//MANUALLY paste the list of column names you want to select into first column
// Transpose data table so your list become columns
Data Table( "TempGeneList" ) &amp;lt;&amp;lt; Transpose(
    Label( :Column 1 ), 
    Output Table( "Transpose of TempGeneList" )
);

//the open table "Transpose of TempGeneList" should have your list as colmun names
Names Default To Here( 1 );

dt2 = Current Data Table();

//get the column names into a form that works
genelist = dt2 &amp;lt;&amp;lt; Get Column Names( string );

//Voila&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P class="p4"&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 27 Sep 2021 12:47:04 GMT</pubDate>
    <dc:creator>EugeneB</dc:creator>
    <dc:date>2021-09-27T12:47:04Z</dc:date>
    <item>
      <title>Script to select columns  from a list in clipboard</title>
      <link>https://community.jmp.com/t5/Discussions/Script-to-select-columns-from-a-list-in-clipboard/m-p/391054#M64120</link>
      <description>&lt;P&gt;Follow up....still problem.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to convert a list of strings copied from row values which, when pasted here looks like this&lt;/P&gt;&lt;P&gt;Tcea1 Atp6v1h Oprk1 Rb1cc1 Fam150a&lt;/P&gt;&lt;P&gt;When pasted in the script window it looks like this&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;Tcea1&lt;/P&gt;&lt;P class="p1"&gt;Atp6v1h&lt;/P&gt;&lt;P class="p1"&gt;Oprk1&lt;/P&gt;&lt;P class="p1"&gt;Rb1cc1&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;I need code to convert the clipboard contents to this&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;{Tcea1, Atp6v1h, Oprk1, Rb1cc1, Fam150a}&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;and this does not work ....&amp;nbsp;&amp;nbsp;{"Tcea1, Atp6v1h, Oprk1, Rb1cc1, Fam150a"}&lt;/P&gt;&lt;P class="p1"&gt;but this does {"Tcea1", "Atp6v1h", "Oprk1", "Rb1cc1", "Fam150a"}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so.... how can I alter the Get Clipboard command to generate the proper output?&amp;nbsp; or alternatively remove the "" in a subseqent line of code?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jun 2021&lt;/P&gt;&lt;P&gt;Here is my script (based on help from you all!) which works nicely , in&amp;nbsp; this case to select columns&amp;nbsp; &amp;nbsp;"Aasdh,Abca2,Abca7,Abcf1,Abi3"&amp;nbsp; in a data table.&lt;/P&gt;&lt;P&gt;My new problem:&amp;nbsp; When I have a large list of column names in my clipboard, I dont' want to have to type or convert to names separate by columns as shown in t script here.&amp;nbsp; Instead I want the script to use the clipboard directly to select the columns in the data frame.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can one convert the clipboard list into "Aasdh,Abca2,Abca7,Abcf1,Abi3...." directly within the script?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SCRIPT&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;//with data table where you want to select the columns now open

Names Default To Here( 1 );
dt = currentdatatable();

// Get list of data column names
col_list = dt &amp;lt;&amp;lt; Get Column Names( string );


// User specified column names
cc = {Aasdh,Abca2,Abca7,Abcf1,Abi3};

For( i = 1, i &amp;lt;= N Items( cc ), i++,
  If( Contains( col_list, Char( cc[i] ) ),
  Column( dt, Char( cc[i] ) ) &amp;lt;&amp;lt; Set Selected( 1 )
  )
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:31:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-to-select-columns-from-a-list-in-clipboard/m-p/391054#M64120</guid>
      <dc:creator>EugeneB</dc:creator>
      <dc:date>2023-06-10T23:31:19Z</dc:date>
    </item>
    <item>
      <title>Re: Script to select columns  from a list in clipboard</title>
      <link>https://community.jmp.com/t5/Discussions/Script-to-select-columns-from-a-list-in-clipboard/m-p/391063#M64122</link>
      <description>&lt;P&gt;You can use&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;myClipboard = Get Clipboard();&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;to move the list into a memory variable.....in this example, a variable called "myClipboard", and then using JSL, manipulate it as desired&lt;/P&gt;
&lt;P&gt;If your clipboard contained the following&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="jsl"&gt;Aasdh,Abca2,Abca7,Abcf1,Abi3&lt;/LI-CODE&gt;
&lt;P&gt;You could retrieve it into a JMP list using&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;myClipboard = words(Get Clipboard(),",");&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 06 Jun 2021 19:13:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-to-select-columns-from-a-list-in-clipboard/m-p/391063#M64122</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-06-06T19:13:55Z</dc:date>
    </item>
    <item>
      <title>Re: Script to select columns  from a list in clipboard</title>
      <link>https://community.jmp.com/t5/Discussions/Script-to-select-columns-from-a-list-in-clipboard/m-p/419122#M66808</link>
      <description>&lt;P&gt;belated ....&lt;/P&gt;&lt;P&gt;My lists are copied into the clipboard from a column in JMP data frame or excel&lt;/P&gt;&lt;P&gt;I need the clipboard contents with e.g. 3 copies&amp;nbsp; strings, columnQ, columnX, columnB to be converted to this in the script {columnQ, columnX, columnB}.&lt;/P&gt;&lt;P&gt;..... but all the solutions you listed result in "" around the series, and the script does not run.&amp;nbsp; How to get rid of the "" ??&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;THANKS&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;myClipboard = Get Clipboard();&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;/*:&lt;/P&gt;&lt;P class="p3"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;"columnQ&lt;/P&gt;&lt;P class="p1"&gt;columnX&lt;/P&gt;&lt;P class="p1"&gt;columnB"&lt;/P&gt;&lt;P class="p2"&gt;//:*/&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;myClipboard = words (Get Clipboard());&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;/*:&lt;/P&gt;&lt;P class="p3"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;{"columnQ&lt;/P&gt;&lt;P class="p1"&gt;columnX&lt;/P&gt;&lt;P class="p1"&gt;columnB"}&lt;/P&gt;&lt;P class="p2"&gt;//:*/&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;myClipboard = words(Get Clipboard(),);&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;/*:&lt;/P&gt;&lt;P class="p3"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;{"columnQ&lt;/P&gt;&lt;P class="p1"&gt;columnX&lt;/P&gt;&lt;P class="p1"&gt;columnB"}&lt;/P&gt;&lt;P class="p2"&gt;//:*/&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;myClipboard = words(Get Clipboard(),",");&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;/*:&lt;/P&gt;&lt;P class="p3"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;{"columnQ&lt;/P&gt;&lt;P class="p1"&gt;columnX&lt;/P&gt;&lt;P class="p1"&gt;columnB"}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Sep 2021 22:07:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-to-select-columns-from-a-list-in-clipboard/m-p/419122#M66808</guid>
      <dc:creator>EugeneB</dc:creator>
      <dc:date>2021-09-17T22:07:40Z</dc:date>
    </item>
    <item>
      <title>Re: Script to select columns  from a list in clipboard</title>
      <link>https://community.jmp.com/t5/Discussions/Script-to-select-columns-from-a-list-in-clipboard/m-p/419134#M66811</link>
      <description>&lt;P&gt;Get Clipboard() returns everything found in the clipboard as single string.&amp;nbsp; To get specific values from the returned string one must use the various character handling functions in JMP to get them from the string.&lt;/P&gt;
&lt;P&gt;As a note, by default, JMP placed a tab character as a spacer between column values.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If one opened the sample data table called Big Class, and copied into the paste buffer the first 10 rows for the 1st 3 columns(Name, Sex, Age), the following script would return the name of the individual from the 2nd row copied into the paste buffer.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
myClipboard = Get Clipboard();
theWord = Word( 4, myclipboard, "\!t\!n\!r" );
Show( theWord );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The Word() function returns the nth word from the myclipboard variable, using a Tab, Linefeed and Carriage Return, as the delimiters to look for to determine the word spacing.&amp;nbsp; &amp;nbsp;\!t is the escape structure that indicates the non printable character for the Tab.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From this pattern you should be able to pass through the data and find all of the information you need.&lt;/P&gt;</description>
      <pubDate>Sat, 18 Sep 2021 04:40:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-to-select-columns-from-a-list-in-clipboard/m-p/419134#M66811</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-09-18T04:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: Script to select columns  from a list in clipboard</title>
      <link>https://community.jmp.com/t5/Discussions/Script-to-select-columns-from-a-list-in-clipboard/m-p/421069#M66981</link>
      <description>&lt;P&gt;Thanks for repeeated efforts to help with this.&amp;nbsp; &amp;nbsp;However I don't think I am being clear.&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When Getclipboard gives me this...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;{"Tcea1, Atp6v1h, Oprk1, Rb1cc1, Fam150a"}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I need to convert it to&amp;nbsp; this&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;{"Tcea1", Atp6v1h", "Oprk1", "Rb1cc1, "Fam150a"} which I prefer because it would make numeric values into strings&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;or into this&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;{Tcea1, Atp6v1h, Oprk1, Rb1cc1, Fam150a}&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Is there a simple way to script that transformation....?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;then the script you provided in June nicely selects all the columns.&amp;nbsp; Typically my lists have 100s of column labels, so I need to automate.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;thanks&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 25 Sep 2021 23:09:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-to-select-columns-from-a-list-in-clipboard/m-p/421069#M66981</guid>
      <dc:creator>EugeneB</dc:creator>
      <dc:date>2021-09-25T23:09:38Z</dc:date>
    </item>
    <item>
      <title>Re: Script to select columns  from a list in clipboard</title>
      <link>https://community.jmp.com/t5/Discussions/Script-to-select-columns-from-a-list-in-clipboard/m-p/421156#M66994</link>
      <description>&lt;P&gt;I found a Rube Goldberg-esque way to generate the required format .&amp;nbsp; I will attempt to integrate into a complete script later to share.&lt;/P&gt;
&lt;P&gt;he following takes a list in clipboard and converts it to the required format.... e.g.&amp;nbsp;&lt;SPAN&gt;{"Tcea1", Atp6v1h", "Oprk1", "Rb1cc1, "Fam150a"}&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;//here get list from clipboard first .&amp;nbsp; Here the column names are genes
//COPY columns names from a row in JMP or excel into your clipboard

//PART ONE

// New data table

// Data Table( "TempGeneList" )

New Table( "TempGeneList" );

//MANUALLY paste the list of column names you want to select into first column
// Transpose data table so your list become columns
Data Table( "TempGeneList" ) &amp;lt;&amp;lt; Transpose(
    Label( :Column 1 ), 
    Output Table( "Transpose of TempGeneList" )
);

//the open table "Transpose of TempGeneList" should have your list as colmun names
Names Default To Here( 1 );

dt2 = Current Data Table();

//get the column names into a form that works
genelist = dt2 &amp;lt;&amp;lt; Get Column Names( string );

//Voila&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P class="p4"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Sep 2021 12:47:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-to-select-columns-from-a-list-in-clipboard/m-p/421156#M66994</guid>
      <dc:creator>EugeneB</dc:creator>
      <dc:date>2021-09-27T12:47:04Z</dc:date>
    </item>
    <item>
      <title>Re: Script to select columns  from a list in clipboard</title>
      <link>https://community.jmp.com/t5/Discussions/Script-to-select-columns-from-a-list-in-clipboard/m-p/421160#M66995</link>
      <description>&lt;P&gt;My previous response was intended to show you how to access the item in the clip board.&amp;nbsp; I assumed from there you would be able to build the list you needed.&amp;nbsp; Here is a more complete example that takes each item found in the clip board, and adds them to the list called "theList".&lt;/P&gt;
&lt;P&gt;So if you copy into the clip board the following&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1632687325181.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/36076iA48F94CA64B536C2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="txnelson_0-1632687325181.png" alt="txnelson_0-1632687325181.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;and run the script&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
myClipboard = Get Clipboard();
theList ={};
i=1;
while( word(i,myClipboard,"\!t\!n\!r" ) != "",
	insert into(theList,word(i,myClipboard,"\!t\!n\!r" ));
	i++;
);
show(theList);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It creates the JMP list "theList"&lt;/P&gt;
&lt;PRE&gt;theList = {"KATIE", "LOUISE", "JANE", "JACLYN", "LILLIE", "TIM", "JAMES", "ROBERT", "BARBARA", "ALICE"};&lt;/PRE&gt;</description>
      <pubDate>Sun, 26 Sep 2021 20:16:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-to-select-columns-from-a-list-in-clipboard/m-p/421160#M66995</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-09-26T20:16:57Z</dc:date>
    </item>
    <item>
      <title>Re: Script to select columns  from a list in clipboard</title>
      <link>https://community.jmp.com/t5/Discussions/Script-to-select-columns-from-a-list-in-clipboard/m-p/421451#M67028</link>
      <description>&lt;P&gt;This might be simpler.&amp;nbsp; Use crlf as a delimiter for the words function.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;clipb = get clipboard();
print(clipb);

crlf = hex to char("0D0A");
col_list = words(clipb, crlf);

print(col_list);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I highlighted some names in Big Class and then ran the code.&amp;nbsp; This is the output from the log window:&lt;/P&gt;
&lt;PRE&gt;"JOE
MICHAEL
DAVID
JUDY
ELIZABETH
LESLIE
CAROL
PATTY"
{"JOE", "MICHAEL", "DAVID", "JUDY", "ELIZABETH", "LESLIE", "CAROL", "PATTY"}&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Sep 2021 21:10:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-to-select-columns-from-a-list-in-clipboard/m-p/421451#M67028</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2021-09-27T21:10:01Z</dc:date>
    </item>
  </channel>
</rss>

