<?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: Close + NewFromSolution = Permission Denied</title><link>https://www.infopathdev.com:443/forums/thread/14520.aspx</link><pubDate>Wed, 03 May 2006 14:59:38 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14520</guid><dc:creator>klrosenberg</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14520.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14520</wfw:commentRss><description>&amp;gt;&amp;gt; 1. Did you run the MSI or .js file created by regform on each of the client machines?&lt;br /&gt;&lt;br /&gt;I wrote two quick batch files which secure and unsecure the .XSN files(which you are all welcome to use). Here is what they look like:&lt;br /&gt;&lt;br /&gt;@echo off&lt;br /&gt;REM ****************************************************&lt;br /&gt;REM 	SecureForm.BAT&lt;br /&gt;REM &lt;br /&gt;REM  Secure InfoPath .XSN form specified in parameter 1&lt;br /&gt;REM   (only enter the form name, not "XSN"&lt;br /&gt;REM ****************************************************&lt;br /&gt;if %1 == "" goto error&lt;br /&gt;REM&lt;br /&gt;set javafile=%1%.js&lt;br /&gt;set bakfile=%1%.bak&lt;br /&gt;set form=%1%.xsn&lt;br /&gt;set regform="C:\Program Files\Microsoft Office 2003 Developer Resources\Microsoft Office InfoPath 2003 SDK\Tools\regform.exe"&lt;br /&gt;REM&lt;br /&gt;REM ' Delete any former intermediate files&lt;br /&gt;REM &lt;br /&gt;echo Deleting former security files...&lt;br /&gt;if exist "%javafile%" del "%javafile%"&lt;br /&gt;if exist "%bakfile%" del "%bakfile%"&lt;br /&gt;REM&lt;br /&gt;REM ' Fully trust the form&lt;br /&gt;REM&lt;br /&gt;regform "%form%" /T Yes&lt;br /&gt;REM&lt;br /&gt;REM ' Now secure the InfoPath form, using the .js file&lt;br /&gt;REM&lt;br /&gt;if exist "%javafile%" cscript "%javafile%"&lt;br /&gt;goto END&lt;br /&gt;&lt;br /&gt;:ERROR&lt;br /&gt;echo "You need to supply the InfoPath file name"&lt;br /&gt;goto END&lt;br /&gt;&lt;br /&gt;:END&lt;br /&gt;PAUSE&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;echo off&lt;br /&gt;REM ****************************************************&lt;br /&gt;REM 	UnsecureForm.BAT&lt;br /&gt;REM &lt;br /&gt;REM  Unsecure InfoPath .XSN form specified in parameter 1&lt;br /&gt;REM   (only enter the form name, not "XSN"&lt;br /&gt;REM ****************************************************&lt;br /&gt;if %1 == "" goto error&lt;br /&gt;REM&lt;br /&gt;set javafile=%1%.js&lt;br /&gt;set bakfile=%1%.bak&lt;br /&gt;set form=%1%.xsn&lt;br /&gt;set regform="C:\Program Files\Microsoft Office 2003 Developer Resources\Microsoft Office InfoPath 2003 SDK\Tools\regform.exe"&lt;br /&gt;REM&lt;br /&gt;REM ' Delete any former intermediate files&lt;br /&gt;REM &lt;br /&gt;echo Deleting former security files...&lt;br /&gt;if exist "%javafile%" del "%javafile%"&lt;br /&gt;if exist "%bakfile%" del "%bakfile%"&lt;br /&gt;regform "%form%"&lt;br /&gt;REM&lt;br /&gt;REM ' Now secure the InfoPath form, using the .js file&lt;br /&gt;REM&lt;br /&gt;if exist "%javafile%" cscript "%javafile%" /uninstall&lt;br /&gt;goto END&lt;br /&gt;&lt;br /&gt;:ERROR&lt;br /&gt;echo "You need to supply the InfoPath file name"&lt;br /&gt;goto END&lt;br /&gt;&lt;br /&gt;:END&lt;br /&gt;PAUSE&lt;br /&gt;&lt;br /&gt;&amp;gt;&amp;gt; 2. Different versions of InfoPath?&lt;br /&gt;&lt;br /&gt;No, same versions.  Also, I noticed on my laptop that sometimes I get errors like: "Invalid Context for OM call", where other PC's don't when calling: "Application.XDocuments.Close(oActiveDoc);"  although this is happening after being involved in things like fileSystemObjects or ADO queries.  Or could it be timing issues (I have a very fast laptop).  Or scripting language differences?  I looked at InfoPath settings and other then MDI, came up with very little that could be changed.  Maybe Winscript?  &lt;br /&gt;&lt;br /&gt;Thanks for your assistance.&lt;br /&gt;</description></item><item><title>Re: Close + NewFromSolution = Permission Denied</title><link>https://www.infopathdev.com:443/forums/thread/14519.aspx</link><pubDate>Wed, 03 May 2006 13:51:00 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14519</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14519.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14519</wfw:commentRss><description>Hello Kenneth and welcome to the forum!&lt;br /&gt;&lt;br /&gt;It sounds like you have already checked descrpancies, but this is all I can think of:&lt;br /&gt;&lt;br /&gt;1. Did you run the MSI or .js file created by regform on each of the client machines?&lt;br /&gt;2. Different versions of InfoPath?</description></item><item><title>Close + NewFromSolution = Permission Denied</title><link>https://www.infopathdev.com:443/forums/thread/12855.aspx</link><pubDate>Wed, 03 May 2006 02:26:27 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:12855</guid><dc:creator>klrosenberg</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/12855.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=12855</wfw:commentRss><description>Via script, I'm trying to close the current form and reopen it, so I can quickly clear all data values (this is a multi-view form).  Also, this is a fully-trusted form.&lt;br /&gt;&lt;br /&gt;On my development laptop the script works like a champ - on all other machines it fails on the NewFromSolution line with a "permission denied" script error. &lt;br /&gt;&lt;br /&gt;(I've isolated this problem down to some simple code).  Here it is:&lt;br /&gt;&lt;br /&gt;1. Create a TestForm.xsn with one Button - btnCloseAndReopen.  Add the script below on the button's OnClick event.&lt;br /&gt;&lt;br /&gt;function btnCloseAndReopen::OnClick(eventObj)&lt;br /&gt;{&lt;br /&gt;   var oActiveDoc = Application.ActiveWindow.XDocument;&lt;br /&gt;   var ActiveURI = oActiveDoc.URI;&lt;br /&gt;   var sURI = XDocument.Solution.URI; &lt;br /&gt;   XDocument.UI.Alert("About to close Active Document...");&lt;br /&gt;   Application.XDocuments.Close(oActiveDoc); &lt;br /&gt;   // or XDocument.View.Window.Close(true); &lt;br /&gt;   // or Application.XDocuments.Close(0);&lt;br /&gt;   Application.XDocuments.NewFromSolution(sURI);&lt;br /&gt;}&lt;br /&gt;		&lt;br /&gt;2. Use regform to fully trust the form (/T Yes).&lt;br /&gt;&lt;br /&gt;3. Run it by double-clicking TestForm.xsn&lt;br /&gt;&lt;br /&gt;---&lt;br /&gt;&lt;br /&gt;On my Development machine, it works like a champ.  On everyone else's machine in the world, it fails on the NewFromSolution line, producing the message box: "A runtime error has occurred. Do you wish to debug?   The following error occurred: permission denied ... &lt;br /&gt;&lt;br /&gt;I can understand why it may not work (perhaps it's lost context, but why does it work on my machine).  By the way, for each test, I recreated the .XSN from scratch on each individual machine.&lt;br /&gt;&lt;br /&gt;If I remove the "Application Close" line, the form works on all machines, but obviously keeps creating more and more XDocuments.  I don't want this.&lt;br /&gt;&lt;br /&gt;What am I doing right (on my machine), and wrong (on others).  Is this a timing problem?  MDI.  Or Dumb user error.   I've used regmon, filemon, compared internet advanced settings to no avail.&lt;br /&gt;&lt;br /&gt;Any ideas?&lt;br /&gt;&lt;br /&gt;Thanks,&lt;br /&gt;&lt;br /&gt;</description></item></channel></rss>