Need help with error trying to write to XML

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I am deploying an application and need to add some info to the settings XML file that is stored within users appdata folder.... I have the script working that can copy a new XML to all users folders, but I am stuck on the one to add info to users who are
upgrading and need to retain their XML document but with the new info added. <br/>
<br/>
I know I am most likely doing something stupid with my script, I know enough VBS to be dangerious and I know very little about XML files so I need some help.
<br/>
<br/>
Here is the code I have so far
CODE
<span>On<span>â<span>Error<span>â<span>Resume<span>â<span>Next<span> <br/>
<br/>
<span>Const<span>â<span>HKEY_LOCAL_MACHINE<span>â=â&<span>H80000002 <br/>
<br/>
<br/>
strComputer<span>â=â<span>"."<span> <br/>
<span>Set<span>â<span>oShell<span>â=â<span>CreateObject<span>(<span>"Wscript.Shell"<span>)<span> <br/>
<span>Set<span>â<span>oSFolders<span>â=â<span>oShell<span>.<span>SpecialFolders<span> <br/>
<span>Set<span>â<span>FSO<span>â=â<span>CreateObject<span>(<span>"Scripting.FileSystemObject"<span>)â<span> <br/>
<span>Set<span>â<span>objRegistry<span>=<span>GetObject<span>(<span>"winmgmts:\"<span>â&â<span>_<span>â<span> <br/>
<span>ââââ<span>strComputer<span>â&â<span>"rootdefault:StdRegProv"<span>)<span> <br/>
appdata<span>=â<span>oSFolders<span>(<span>"AppData"<span>)<span> <br/>
strKeyPath<span>â=â<span>"SOFTWAREMicrosoftWindowsâNTCurrentVersionProfileList"<span> <br/>
objRegistry<span>.<span>EnumKey<span>â<span>HKEY_LOCAL_MACHINE<span>,â<span>strKeyPath<span>,â<span>arrSubkeys <br/>
<br/>
<span>For<span>â<span>Each<span>â<span>objSubkey<span>â<span>In<span>â<span>arrSubkeys <br/>
<span>ââââ<span>strValueName<span>â=â<span>"ProfileImagePath"<span> <br/>
<span>ââââ<span>strSubPath<span>â=â<span>strKeyPath<span>â&â<span>""â&âobjSubkey <br/>
ââââobjRegistry.GetExpandedStringValueâHKEY_LOCAL_MACHINE,strSubPath,strValueName,strValue <br/>
<br/>
dimâxmldoc,âoItemsNode,âoNewItemNode,âoNode <br/>
setâxmldoc=server.createobject("<span>msxml<span>.<span>domdocument<span>") <br/>
xmldoc.loadâ"<span>%<span>appdatafolder<span>%<span>Avaya<span><span>one<span>-<span>X<span>â<span>Agent<span><span>2.0<span><span>Profiles<span><span>default<span><span>settings<span>.<span>xml<span>"
<br/>
setâoItemsNodeâ=âxmldoc.selectsinglenode("<span>Settings<span>") <br/>
setâoNewItemNode=xmldoc.createelement("<span><<span>DirectorySetting<span>â<span>Name<span>=<span>"LotusâNotes"<span>â<span>Url<span>=<span>"ldap-adamqa.mmm.com"<span>â<span>Port<span>=<span>"389"<span>â<span>UserName<span>=<span>"cn=VoIPAdmin,ou=fapserviceaccounts,ou=fap,o=3m"<span>â<span>Password<span>=<span>"r+pjyGmVsm8nYDY3/bmj+JZnrs9rSUBug+lXBRcHfVdeZ5GUw7O3f7cF0MHBSPeaT48E61EmyVuhPNKdTQPGbrbUGmbVG3zJ"<span>â<span>SearchRoot<span>=<span>"ou=internal,ou=people,ou=fap,o=3m"<span>â<span>TimeOut<span>=<span>"100"<span>â<span>MaxEntries<span>=<span>"50"<span>â<span>ReadOnly<span>=<span>"false"<span>â<span>Type<span>=<span>"Simple"<span>â/><span>")
<br/>
<br/>
Next
/CODE
When I attempt to run it I am getting an error "expected )" line 25 char 64. I have tried removing the brackets, addind/removing quotes, and every variation I can think of for this. I know that I am doing something wrong with the needed quotes but for
the life of me I cant figure out what I am goofing up.

I have spent the last 3 days looking at this thing, searching various forums looking for tips and tricks, and I think I am close but I dont know forsure.<br/>
<br/>
What I am trying to accomplish is the following, I need to add the text, broken out by the slashes, to an existing XML document.....
<br/>
this is what the finished document structure should be
<span><?<span>xml version<span>=<span>"1.0"<span>?><span> <br/>
<span><Settings<span> <span>xmlns:xsi<span>=<span>"http://www.w3.org/2001/XMLSchema-instance"<span>
<span>xmlns:xsd<span>=<span>"http://www.w3.org/2001/XMLSchema"<span>
<span>Version<span>=<span>"2.0.09184.10"<span>
<span>SchemaVersion<span>=<span>"1.0.0.0"<span> <span>TerminateOnUnhandledError<span>=<span>"false"<span>
<span>DeleteOnExit<span>=<span>"false"<span> <span>DeleteWorkLogOnExit<span>=<span>"false"<span>
<span>DeleteContactsOnExit<span>=<span>"false"<span>
<span>WelcomeMessage<span>=<span>""<span> <span>UploadInterval<span>=<span>"10"<span>
<span>xmlns<span>=<span>"http://avaya.com/OneXAgent/Settings"<span>><span> <br/>
<span><Login><span> <br/>
<span><Telephony><span> <br/>
<span><Server><span> <br/>
<span><DialingRules<span> <span>OutsideLineAccessNumber<span>=<span>""<span>
<span>CountryCode<span>=<span>""<span> <span>AreaCode<span>=<span>""<span>
<span>LongDistancePrefix<span>=<span>""<span>
<span>InternationalPrefix<span>=<span>""<span> <span>InternalExtensionLength<span>=<span>""<span>
<span>NationalCallLength<span>=<span>""<span>
<span>IncludeAreaCityCode<span>=<span>"false"<span> <span>DisplayDialingWindow<span>=<span>"false"<span>
<span>/><span> <br/>
<span><CallServerAddress1<span>
<span>Value<span>=<span>"169.10.208.10"<span> <span>/><span> <br/>
<span></Server><span> <br/>
<span><User<span> <span>Station<span>=<span>"Enter Your extension"<span>
<span>Password<span>=<span>"r+pjyGmVsm8nYDY3/bmj+KFKxYwZQP6fNcjkncysjrnG63iYT8XjcCwForLe2aClyb/3nE7fSjAiYOdnsdc27aaxNCKGNtSz"<span>
<span>SavePassword<span>=<span>"true"<span> <span>AutoLogin<span>=<span>"true"<span>
<span>LoginOverride<span>=<span>"false"<span>
<span>AutoAnswerSupportRequired<span>=<span>"false"<span>
<span>LicenseType<span>=<span>"Agent"<span> <span>/><span> <br/>
<span><Type<span> <span>Mode<span>=<span>"MyComputer"<span>
<span>SelectedPhoneNumberId<span>=<span>""<span>
<span>/><span> <br/>
<span><License<span> <span>Type<span>=<span>"Agent"<span>
<span>/><span> <br/>
<span><PhoneNumbers<span> <span>/><span> <br/>
<span></Telephony><span> <br/>
<span><Agent<span> <span>Login<span>=<span>""<span>
<span>Password<span>=<span>""<span> <span>AutoLogin<span>=<span>"false"<span>
<span>SavePassword<span>=<span>"false"<span> <span>EnterAuxOnLogin<span>=<span>"true"<span>
<span>/><span> <br/>
<span><Im><span> <br/>
<span><Server<span> <span>Enabled<span>=<span>"false"<span>
<span>ServerAddress1<span>=<span>""<span> <span>/><span> <br/>
<span><User<span> <span>LoginId<span>=<span>""<span>
<span>Password<span>=<span>""<span> <span>Domain<span>=<span>""<span>
<span>AutoLogin<span>=<span>"false"<span> <span>SavePassword<span>=<span>"false"<span>
<span>/><span> <br/>
<span></Im><span> <br/>
<span></Login><span> <br/>
<span><WorkHandling><span> <br/>
<span><In<span> <span>AutoIn<span>=<span>"false"<span>
<span>/><span> <br/>
<span><Accept<span> <span>AutoAccept<span>=<span>"false"<span>
<span>/><span> <br/>
<span><Complete<span> <span>AutoComplete<span>=<span>"true"<span>><span> <br/>
<span><FollowUp<span> <span>IsTimedFollowUp<span>=<span>"true"<span>><span> <br/>
<span><TimedFollowUp<span> <span>TimerPeriod<span>=<span>"30"<span>
<span>AllowExtension<span>=<span>"true"<span>
<span>/><span> <br/>
<span></FollowUp><span> <br/>
<span></Complete><span> <br/>
<span><Hold<span> <span>AutoHold<span>=<span>"true"<span>
<span>/><span> <br/>
<span><Ready<span> <span>AutoReady<span>=<span>"true"<span>
<span>ReasonCode<span>=<span>"10"<span> <span>/><span> <br/>
<span><Transfer<span> <span>Consult<span>=<span>"true"<span>
<span>/><span> <br/>
<span><Conference<span> <span>Consult<span>=<span>"true"<span>
<span>/><span> <br/>
<span></WorkHandling><span> <br/>
<span><ContactLog<span> <span>DaysToKeepLog<span>=<span>"5"<span>
<span>ContactLogPerScreen<span>=<span>"25"<span>><span> <br/>
<span><Voice<span> <span>LogIncoming<span>=<span>"true"<span>
<span>LogOutgoing<span>=<span>"true"<span> <span>/><span> <br/>
<span><Im<span> <span>LogIncoming<span>=<span>"true"<span>
<span>LogOutgoing<span>=<span>"true"<span> <span>SaveIncomingTranscript<span>=<span>"true"<span>
<span>SaveOutgoingTranscript<span>=<span>"true"<span>
<span>/><span> <br/>
<span><Tty<span> <span>LogIncoming<span>=<span>"true"<span>
<span>LogOutgoing<span>=<span>"true"<span> <span>SaveIncomingTranscript<span>=<span>"true"<span>
<span>SaveOutgoingTranscript<span>=<span>"true"<span>
<span>/><span> <br/>
<span></ContactLog><span> <br/>
<span><Video><span> <br/>
<span><Basic<span> <span>CloseWindowAfterEveryCall<span>=<span>"false"<span>
<span>OpenWindowOnLogin<span>=<span>"false"<span>
<span>EnableVideoCall<span>=<span>"true"<span> <span>BroadcastVideoAuto<span>=<span>"false"<span>
<span>AllowVideoFilePlay<span>=<span>"true"<span>
<span>/><span> <br/>
<span><Advanced<span> <span>AudioBufferSize<span>=<span>"20"<span>
<span>PerformanceMode<span>=<span>"MotionSmoothness"<span>
<span>CpuPriority<span>=<span>"Balanced"<span>
<span>/><span> <br/>
<span></Video><span> <br/>
<span><Im><span> <br/>
<span><Permissions<span> <span>AllowIMToNonContacts<span>=<span>"true"<span>
<span>/><span> <br/>
<span><Greeting<span> <span>Text<span>=<span>"Hello"<span>
<span>/><span> <br/>
<span><IdleTime<span> <span>Time<span>=<span>"15"<span>
<span>/><span> <br/>
<span></Im><span> <br/>
<span><Tty><span> <br/>
<span><Greeting<span> <span>Text<span>=<span>"Hello, GA"<span>
<span>/><span> <br/>
<span></Tty>
<span> <span> ///////////////////////////////////////////////////////////////////This is the text that needs to be added/////////////////////////////////////////////// <br/>
<span><Directory<span> <span>Readonly<span>=<span>"false"<span>><span>
<span><DirectorySetting<span> <span>Name<span>=<span>"Lotus Notes"<span>
<span>Url<span>=<span>"ldap-adamqa.mmm.com"<span>
<span>Port<span>=<span>"389" <span>UserName<span>=<span>"cn=VoIPAdmin,ou=fapserviceaccounts,ou=fap,o=3m"<span>
<span>Password<span>=<span>"r+pjyGmVsm8nYDY3/bmj+JZnrs9rSUBug+lXBRcHfVdeZ5GUw7O3f7cF0MHBSPeaT48E61EmyVuhPNKdTQPGbrbUGmbVG3zJ"<span>
<span>SearchRoot<span>=<span>"ou=internal,ou=people,ou=fap,o=3m"<span>
<span>TimeOut<span>=<span>"100"<span> <span>MaxEntries<span>=<span>"50"<span>
<span>Type<span>=<span>"Simple"<span> <span>/><span> <br/>
<span></Directory><span>
<span>/////////////////////////////////////////////////////////End of text that needs to be added/////////////////////////////////////////////////////////// <br/>
<span><OutlookContact<span> <span>Password<span>=<span>"r+pjyGmVsm8nYDY3/bmj+FRRyXPBfJLRd70plfJljS5gbuAn/YbdTXbmlgZ0+CPwcWBb+EthWQiwsV1lO/bEZA=="<span>
<span>TimeOut<span>=<span>"30"<span> <span>/><span> <br/>
<span><Logging<span> <span>Appender<span>=<span>"LocalLogging_GeneralFormat"<span>
<span>LogLevel<span>=<span>"DEBUG"<span> <span>CentralLoggingHost<span>=<span>""<span>
<span>DaysToKeepLog<span>=<span>"30"<span> <span>/><span> <br/>
<span><VoiceMail<span> <span>EnableMessageAccess<span>=<span>"false"<span>
<span>Action<span>=<span>"Dial"<span> <span>PhoneNumber<span>=<span>""<span>
<span>Path<span>=<span>""<span> <span>Url<span>=<span>""<span>
<span>/><span> <br/>
<span><LaunchApplication<span> <span>/><span> <br/>
<span><Profile<span> <span>/><span> <br/>
<span><ClickToDial<span> <span>Active<span>=<span>"false"<span>
<span>/><span> <br/>
<span><DesktopSharing<span> <span>Enabled<span>=<span>"true"<span>
<span>/><span> <br/>
<span></Settings><span>
I am asking for help becuase I have not been able to figure out my quoting error (that is causing the current error), and I am not sure if the rest of my code is correct, so I am asking for someone to point me in the correct direction on the quoting issue,
and hopefully take a look at the rest of the code to make sure it looks correct.

Thank you
Bill

View the full article
 
Back
Top