<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Code</title><link>https://www.infopathdev.com:443/forums/45.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: How can one get the .xsn template path from URN based form? (JScript)</title><link>https://www.infopathdev.com:443/forums/thread/22578.aspx</link><pubDate>Thu, 23 Aug 2007 13:43:23 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:22578</guid><dc:creator>Agni Jonnalagadda</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/22578.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=22578</wfw:commentRss><description>&lt;p&gt;Thanks for the code.&lt;/p&gt;</description></item><item><title>Re: How can one get the .xsn template path from URN based form? (JScript)</title><link>https://www.infopathdev.com:443/forums/thread/22574.aspx</link><pubDate>Thu, 23 Aug 2007 12:55:20 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:22574</guid><dc:creator>PseudoNym</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/22574.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=22574</wfw:commentRss><description>&lt;p&gt;Here is a simple function I put together with a hard coded registry path. A few things to keep in mind about using this function. First the form it is used by has been installed on the users local machine and made fully trusted at install (via script generated by the RegForm tool found in the InfoPath 2003 SDK). Basically this registers the from on the user&amp;#39;s system which converts the form from URI based to URN based so, at least in InfoPath 2003, the XDocument.Solution.URI property no longer returns the file path to the from template rather it returns the URN. The path below is specific to InfoPath 2003. I&lt;strike&gt; think it will be as simple as changing 11.0 to 12.0 for InfoPath 2007 but I haven&amp;#39;t gotten to that point yet.&lt;/strike&gt; The path if the client machine is running InfoPath 2007 will be the same with the &amp;quot;11.0&amp;quot; level omitted. The URN will of course need to be replaced with the URN from whatever form one may want to retrieve the path for.

&lt;/p&gt;&lt;p&gt;function
cad_getIPFTPath(){&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var WshShell = new
ActiveXObject(&amp;quot;WScript.Shell&amp;quot;);&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Get path for InfoPath 2003&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var thePath = WshShell.RegRead(&amp;quot;HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Office\\11.0\\InfoPath\\SolutionsCatalog\\urn:xxxxxx:xxxx\\Original
Location&amp;quot;);&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // XDocument.UI.Alert(&amp;quot;thePath is: &amp;quot; + thePath);&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return thePath;&lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;</description></item><item><title>Re: How can one get the .xsn template path from URN based form? (JScript)</title><link>https://www.infopathdev.com:443/forums/thread/22561.aspx</link><pubDate>Thu, 23 Aug 2007 08:38:06 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:22561</guid><dc:creator>Agni Jonnalagadda</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/22561.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=22561</wfw:commentRss><description>&lt;p&gt;Great that it has helped you. Why don&amp;#39;t you post your code to access the registry here? It will be helpful to others as well.&lt;/p&gt;</description></item><item><title>Re: How can one get the .xsn template path from URN based form? (JScript)</title><link>https://www.infopathdev.com:443/forums/thread/22550.aspx</link><pubDate>Wed, 22 Aug 2007 20:52:13 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:22550</guid><dc:creator>PseudoNym</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/22550.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=22550</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Agni, yep I was able to pull this off by creating a WScript.Shell ActiveXObject.&amp;nbsp; Presently I&amp;#39;m just hard coding the registry path but will later have to revisit this to search for the path as it will of course change depending on the version of MS Office the client is running.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Thanks once more for your input it was more helpful than you can imagine. Now I will succumb to the melting of my brain caused by the joys of scripting to make InfoPath do that which it was not meant to do&amp;nbsp; :P&lt;br /&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: How can one get the .xsn template path from URN based form? (JScript)</title><link>https://www.infopathdev.com:443/forums/thread/22545.aspx</link><pubDate>Wed, 22 Aug 2007 17:00:37 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:22545</guid><dc:creator>PseudoNym</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/22545.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=22545</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Agni,&lt;/p&gt;&lt;p&gt;&amp;nbsp;First let me thank you for your reply. This has got me going in the right direction as I have now located where the path is being stored in the registry. Now I&amp;#39;ve just got to whip up some more code that will search for this key and return its value.&lt;/p&gt;&lt;p&gt;Thanks again ... Nym&lt;br /&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: How can one get the .xsn template path from URN based form? (JScript)</title><link>https://www.infopathdev.com:443/forums/thread/22544.aspx</link><pubDate>Wed, 22 Aug 2007 16:07:03 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:22544</guid><dc:creator>Agni Jonnalagadda</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/22544.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=22544</wfw:commentRss><description>&lt;p&gt;Only way you can get this done is writing some custom code which accesses the registry. I think you should search in Google on how to access the registry from code. &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>How can one get the .xsn template path from URN based form? (JScript)</title><link>https://www.infopathdev.com:443/forums/thread/22534.aspx</link><pubDate>Wed, 22 Aug 2007 14:35:55 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:22534</guid><dc:creator>PseudoNym</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/22534.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=22534</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p class="MsoNormal"&gt;I’m not sure if this is the correct area to post this
question, but here goes.&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&amp;nbsp;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;I am working on an InfoPath form for which I have created an
install to place the .xsn on the end user’s local machine. At install the form
is made fully trusted (this is accomplished via the RegForm tool available in
the SDK). Once the user has run the install the form is apparently URN based
rather than URI. This is where my problem begins. The form contains budgeting
data that is written to an Excel spreadsheet (via Jscript) which is installed
to the same directory as the InfoPath .xsn file.&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&amp;nbsp;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;Now that the form is URN based the XDocument.Solution.URI
property no longer returns the directory path I need to provide in the script to
reference the location of the Excel file I need to write the data to. &lt;/p&gt;

&lt;p class="MsoNormal"&gt;&amp;nbsp;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;So my question is: Can anyone point me in the right
direction to how I might go about acquiring the directory path to a form’s
template (in JScript) such as C:\MyDirectory\MyInfoPathForm.xsn when the form
is URN based? Or, perhaps how I might be able to go about providing the user the
ability to browse for the file to provide the path like in HTML using the &amp;lt;input
type=&amp;quot;file&amp;quot; /&amp;gt; tag. I could use something like that just to pass
the path to the script.&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&amp;nbsp;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;Keep in mind that I have to use a pre-existing .xls document,
that contains too many custom features to recreate via scripting, not generate
it from scratch (which would of course make life easier of course :P) .&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>