<?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: Getting users Username</title><link>https://www.infopathdev.com:443/forums/thread/26703.aspx</link><pubDate>Sat, 23 Feb 2008 17:27:00 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:26703</guid><dc:creator>dpsol</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/26703.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=26703</wfw:commentRss><description>&lt;p&gt;&lt;font face="Times New Roman" size="3"&gt;Hi,&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Times New Roman" size="3"&gt;I am new to infoPath2003 and been reading this post and how do you add this code into infopath?&amp;nbsp; I am trying to get the current user that opens the form onto a test field also.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Times New Roman" size="3"&gt;kinda clueless on my way around infoPath.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Times New Roman" size="3"&gt;thanks for any help.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;Sol&lt;/p&gt;
&lt;p&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Getting users Username</title><link>https://www.infopathdev.com:443/forums/thread/13587.aspx</link><pubDate>Thu, 03 Aug 2006 20:51:53 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13587</guid><dc:creator>lotusvball</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13587.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13587</wfw:commentRss><description>&lt;blockquote id="quote"&gt;&lt;font size="1" face="Verdana, Arial, Helvetica" id="quote"&gt;quote:&lt;hr height="1" noshade id="quote"&gt;&lt;i&gt;Originally posted by lotusvball&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;I have this code in vbScript;&lt;br /&gt;&lt;br /&gt;Sub XDocument_OnLoad(eventObj)&lt;br /&gt;' Write your code here&lt;br /&gt;	Dim wsh&lt;br /&gt;	Dim un&lt;br /&gt;	Set wsh = CreateObject("WScript.Network")&lt;br /&gt;	un = wsh.UserName&lt;br /&gt;	XDocument.DOM.selectSingleNode("//my:myFields/my:tmpFields/my:Field1").text = un&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;I am trying to populate a text box (Field1) with the value of the username.  I can get XDocument.UI.Alert(un) to work. but when I try to populate with above code I get "object required" error.  What am I missing?&lt;br /&gt;&lt;hr height="1" noshade id="quote"&gt;&lt;/font id="quote"&gt;&lt;/blockquote id="quote"&gt;&lt;br /&gt;&lt;br /&gt;Nevermind... &lt;br /&gt;XDocument.DOM.selectSingleNode("//my:myFields/my:tmpFields/my:Field1").text = un   should have been&lt;br /&gt;&lt;br /&gt;XDocument.DOM.selectSingleNode("//dfs:myFields/my:tmpFields/my:Field1").text = un&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;duh.....</description></item><item><title>Re: Getting users Username</title><link>https://www.infopathdev.com:443/forums/thread/13586.aspx</link><pubDate>Thu, 03 Aug 2006 19:38:37 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13586</guid><dc:creator>lotusvball</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13586.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13586</wfw:commentRss><description>I have this code in vbScript;&lt;br /&gt;&lt;br /&gt;Sub XDocument_OnLoad(eventObj)&lt;br /&gt;' Write your code here&lt;br /&gt;	Dim wsh&lt;br /&gt;	Dim un&lt;br /&gt;	Set wsh = CreateObject("WScript.Network")&lt;br /&gt;	un = wsh.UserName&lt;br /&gt;	XDocument.DOM.selectSingleNode("//my:myFields/my:tmpFields/my:Field1").text = un&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;I am trying to populate a text box (Field1) with the value of the username.  I can get XDocument.UI.Alert(un) to work. but when I try to populate with above code I get "object required" error.  What am I missing?</description></item><item><title>Re: Getting users Username</title><link>https://www.infopathdev.com:443/forums/thread/13585.aspx</link><pubDate>Fri, 16 Sep 2005 19:59:29 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13585</guid><dc:creator>Patrick Halstead</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13585.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13585</wfw:commentRss><description>Ah. Extranetted forms. Search the forum (upper right search button) for the term "extranet" and you will see some stuff.&lt;br /&gt;&lt;br /&gt;Patrick Halstead [InfoPath MVP]&lt;br /&gt;InfoPathDev</description></item><item><title>Re: Getting users Username</title><link>https://www.infopathdev.com:443/forums/thread/13584.aspx</link><pubDate>Thu, 15 Sep 2005 14:02:25 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13584</guid><dc:creator>drobins</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13584.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13584</wfw:commentRss><description>That was it.&lt;br /&gt;&lt;br /&gt;Thanks Patrick.&lt;br /&gt;&lt;br /&gt;My big problem now is forms for users that don't have access to our network. I just can't seem to get that to work.</description></item><item><title>Re: Getting users Username</title><link>https://www.infopathdev.com:443/forums/thread/13583.aspx</link><pubDate>Thu, 15 Sep 2005 06:08:35 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13583</guid><dc:creator>Patrick Halstead</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13583.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13583</wfw:commentRss><description>Hi guys,&lt;br /&gt;Make the form Full Trust. Then it will work.&lt;br /&gt;&lt;br /&gt;Patrick Halstead [InfoPath MVP]&lt;br /&gt;InfoPathDev</description></item><item><title>Re: Getting users Username</title><link>https://www.infopathdev.com:443/forums/thread/13582.aspx</link><pubDate>Wed, 14 Sep 2005 15:37:51 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13582</guid><dc:creator>drobins</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13582.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13582</wfw:commentRss><description>is there a specific dll that must be registered for the vb to work or does the dll cover both vb and jscript?</description></item><item><title>Re: Getting users Username</title><link>https://www.infopathdev.com:443/forums/thread/13581.aspx</link><pubDate>Wed, 14 Sep 2005 14:45:31 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13581</guid><dc:creator>drobins</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13581.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13581</wfw:commentRss><description>Yes i tried that as well and it gave a similar error that it couldn't create wscript.shell</description></item><item><title>Re: Getting users Username</title><link>https://www.infopathdev.com:443/forums/thread/13580.aspx</link><pubDate>Wed, 14 Sep 2005 14:40:57 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13580</guid><dc:creator>vt_asparagus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13580.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13580</wfw:commentRss><description>The code works for me.  I do not have an explanation why you are getting the error in VBScript but you run this in JScript it works.&lt;br /&gt;&lt;br /&gt;Where you able to try the code I posted that used Wscript.Shell?&lt;br /&gt;&lt;br /&gt;Anyone else run into this issue before???</description></item><item><title>Re: Getting users Username</title><link>https://www.infopathdev.com:443/forums/thread/13579.aspx</link><pubDate>Wed, 14 Sep 2005 14:31:11 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13579</guid><dc:creator>drobins</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13579.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13579</wfw:commentRss><description>here is my code for the onload&lt;br /&gt;&lt;br /&gt;Sub XDocument_OnLoad(eventObj)&lt;br /&gt;&lt;br /&gt;Dim wsh&lt;br /&gt;Set wsh = CreateObject("WScript.Network")&lt;br /&gt;un = wsh.UserName&lt;br /&gt;XDocument.DOM.selectSingleNode("//my:myFields/my:field14").text = un&lt;br /&gt;&lt;br /&gt;End Sub</description></item><item><title>Re: Getting users Username</title><link>https://www.infopathdev.com:443/forums/thread/13578.aspx</link><pubDate>Wed, 14 Sep 2005 14:16:45 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13578</guid><dc:creator>vt_asparagus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13578.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13578</wfw:commentRss><description>I find it hard to believe but it is happening.  Post up the code you are running and let me see if I or someone else can generate the error.</description></item><item><title>Re: Getting users Username</title><link>https://www.infopathdev.com:443/forums/thread/13577.aspx</link><pubDate>Wed, 14 Sep 2005 12:47:18 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13577</guid><dc:creator>drobins</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13577.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13577</wfw:commentRss><description>This is the error i am getting&lt;br /&gt;A runtime error has occured&lt;br /&gt;Do you want to debug?&lt;br /&gt;&lt;br /&gt;ActiveX component can't create object: 'WScript.Network'&lt;br /&gt;file: script.vbs&lt;br /&gt;line: 23&lt;br /&gt;&lt;br /&gt;how is it that i can create the object in jscript but not vb?</description></item><item><title>Re: Getting users Username</title><link>https://www.infopathdev.com:443/forums/thread/13576.aspx</link><pubDate>Tue, 13 Sep 2005 21:07:43 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13576</guid><dc:creator>vt_asparagus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13576.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13576</wfw:commentRss><description>I would think if the jscript works, then the vbscript would work.&lt;br /&gt;&lt;br /&gt;What is the exact error message that you are getting?  Does it have anything do with ActiveX not being allowed to run in IE on your machine as I described above?</description></item><item><title>Re: Getting users Username</title><link>https://www.infopathdev.com:443/forums/thread/13575.aspx</link><pubDate>Tue, 13 Sep 2005 20:28:35 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13575</guid><dc:creator>drobins</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13575.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13575</wfw:commentRss><description>if the jscript works should the vbscript work?&lt;br /&gt;&lt;br /&gt;do i need to have anything special installed for the vb version to work?</description></item><item><title>Re: Getting users Username</title><link>https://www.infopathdev.com:443/forums/thread/13574.aspx</link><pubDate>Tue, 13 Sep 2005 20:27:12 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13574</guid><dc:creator>vt_asparagus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13574.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13574</wfw:commentRss><description>Bummer that worked for me when I threw that into an OnLoad event.&lt;br /&gt;&lt;br /&gt;This one also works for me...after that I am not sure I know what else will work.&lt;br /&gt;&lt;br /&gt;Dim sUserName&lt;br /&gt;sUserName = CreateObject("Wscript.Shell").Environment("Process").Item("UserName")&lt;br /&gt;XDocument.UI.Alert(sUserName)</description></item></channel></rss>