<?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 vbs createobject vs getobject in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/vbs-createobject-vs-getobject/m-p/11680#M11187</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to write a VBS/VBA script in powerpoint which will get some information from a running JMP session.&amp;nbsp; &lt;/P&gt;&lt;P&gt;Here is the basic code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sub test()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim myjmp As JMP.Application&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set myjmp = CreateObject("JMP.Application")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; myjmp.Visible = True&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'some code to test running jsl&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; myjmp.RunCommand ("transfer_data = 35;")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; areaHeight = myjmp.GetJSLValue("transfer_data")&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the user has a jmp session open that was started by using the start menu or desktop icon, the JMP session will stay open after the script runs.&amp;nbsp; If the user started JMP by double clicking on a .jmp file the JMP session will close after the script finishes even though there is no myjmp.quit call in there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I make the JMP session stay open in both cases?&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Other Notes:&lt;/P&gt;&lt;P&gt;Other applications tend to have something like app.usercontrol = true or you can use set myapp = GetObject(,"application") to get an object of the open session.&amp;nbsp; (GetObject(,"JMP.Application") does not work for JMP11)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This doesn't seem to do anything&lt;/P&gt;&lt;P&gt;myjmp.EnableInteractiveMode True&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I create an empty data table, then after the script finishes the jmp session will stay open.&lt;/P&gt;&lt;P&gt;Set dt = myjmp.NewDataTable("")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;JMP11.2.1 and Windows 7.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 27 Mar 2015 19:39:44 GMT</pubDate>
    <dc:creator>keith_a_kraft</dc:creator>
    <dc:date>2015-03-27T19:39:44Z</dc:date>
    <item>
      <title>vbs createobject vs getobject</title>
      <link>https://community.jmp.com/t5/Discussions/vbs-createobject-vs-getobject/m-p/11680#M11187</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to write a VBS/VBA script in powerpoint which will get some information from a running JMP session.&amp;nbsp; &lt;/P&gt;&lt;P&gt;Here is the basic code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sub test()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim myjmp As JMP.Application&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set myjmp = CreateObject("JMP.Application")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; myjmp.Visible = True&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'some code to test running jsl&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; myjmp.RunCommand ("transfer_data = 35;")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; areaHeight = myjmp.GetJSLValue("transfer_data")&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the user has a jmp session open that was started by using the start menu or desktop icon, the JMP session will stay open after the script runs.&amp;nbsp; If the user started JMP by double clicking on a .jmp file the JMP session will close after the script finishes even though there is no myjmp.quit call in there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I make the JMP session stay open in both cases?&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Other Notes:&lt;/P&gt;&lt;P&gt;Other applications tend to have something like app.usercontrol = true or you can use set myapp = GetObject(,"application") to get an object of the open session.&amp;nbsp; (GetObject(,"JMP.Application") does not work for JMP11)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This doesn't seem to do anything&lt;/P&gt;&lt;P&gt;myjmp.EnableInteractiveMode True&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I create an empty data table, then after the script finishes the jmp session will stay open.&lt;/P&gt;&lt;P&gt;Set dt = myjmp.NewDataTable("")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;JMP11.2.1 and Windows 7.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Mar 2015 19:39:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/vbs-createobject-vs-getobject/m-p/11680#M11187</guid>
      <dc:creator>keith_a_kraft</dc:creator>
      <dc:date>2015-03-27T19:39:44Z</dc:date>
    </item>
    <item>
      <title>Re: vbs createobject vs getobject</title>
      <link>https://community.jmp.com/t5/Discussions/vbs-createobject-vs-getobject/m-p/11681#M11188</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Keith,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think your JMP session is going away because you have the JMP.Application variable defined within the scope of the function.&amp;nbsp; When it goes out of scope, the object reference is deleted, which tells JMP to shut down.&amp;nbsp; If you find somewhere else to define the variable, it will probably stay open.&amp;nbsp; For Excel, having it defined in the Workbook Load function would work.&amp;nbsp; I don't have enough experience with PowerPoint to tell you where to put it there.&amp;nbsp; If you do this approach, you will have to be careful to call JMP.Quit when you really want it to go away.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Brian Corcoran&lt;/P&gt;&lt;P&gt;JMP Development&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Mar 2015 20:38:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/vbs-createobject-vs-getobject/m-p/11681#M11188</guid>
      <dc:creator>briancorcoran</dc:creator>
      <dc:date>2015-03-27T20:38:59Z</dc:date>
    </item>
    <item>
      <title>Re: vbs createobject vs getobject</title>
      <link>https://community.jmp.com/t5/Discussions/vbs-createobject-vs-getobject/m-p/11682#M11189</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I don't think it is just due to the scope of the function.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can write a 3 line test.vbs script like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dim myjmp&lt;/P&gt;&lt;P&gt;Set myjmp = CreateObject("JMP.Application")&lt;/P&gt;&lt;P&gt;myjmp.Visible = True&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;which you run on the command line with cscript test.vbs and you get the same behaviour.&amp;nbsp; Session closed if started from double click on a file, session stays open if started from start menu.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Mar 2015 20:53:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/vbs-createobject-vs-getobject/m-p/11682#M11189</guid>
      <dc:creator>keith_a_kraft</dc:creator>
      <dc:date>2015-03-27T20:53:53Z</dc:date>
    </item>
    <item>
      <title>Re: vbs createobject vs getobject</title>
      <link>https://community.jmp.com/t5/Discussions/vbs-createobject-vs-getobject/m-p/11683#M11190</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That would fail, because as soon as the Visible is run and the script completes your myjmp variable goes out of scope.&amp;nbsp; You would have to have a way of keeping the VBS script resident and running.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Brian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Mar 2015 22:51:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/vbs-createobject-vs-getobject/m-p/11683#M11190</guid>
      <dc:creator>briancorcoran</dc:creator>
      <dc:date>2015-03-27T22:51:42Z</dc:date>
    </item>
    <item>
      <title>Re: vbs createobject vs getobject</title>
      <link>https://community.jmp.com/t5/Discussions/vbs-createobject-vs-getobject/m-p/11684#M11191</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I ended up removing all jmp objects from VBS and passed the data by creating a temp .vbs file using JSL that set a bunch of variables in vbs and read them in.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sub IncludeExecuteOptions()&lt;/P&gt;&lt;P&gt;&amp;nbsp; Dim fso, f&lt;/P&gt;&lt;P&gt;&amp;nbsp; Set fso = CreateObject("Scripting.FileSystemObject")&lt;/P&gt;&lt;P&gt;&amp;nbsp; Dim tempfolder&lt;/P&gt;&lt;P&gt;&amp;nbsp; Const TemporaryFolder = 2&lt;/P&gt;&lt;P&gt;&amp;nbsp; Set tempfolder = fso.GetSpecialFolder(TemporaryFolder)&lt;/P&gt;&lt;P&gt;&amp;nbsp; Set f = fso.OpenTextFile(tempfolder &amp;amp; "\ExecuteOptions.vbs", 1)&lt;/P&gt;&lt;P&gt;&amp;nbsp; str = f.ReadAll&lt;/P&gt;&lt;P&gt;&amp;nbsp; f.Close&lt;/P&gt;&lt;P&gt;&amp;nbsp; call ExecuteGlobal(str)&lt;/P&gt;&lt;P&gt;end Sub&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This method left the JMP session open no matter how it was started.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Apr 2015 22:07:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/vbs-createobject-vs-getobject/m-p/11684#M11191</guid>
      <dc:creator>keith_a_kraft</dc:creator>
      <dc:date>2015-04-01T22:07:40Z</dc:date>
    </item>
  </channel>
</rss>

