Edit XML manifest file using vbscript

XML file:

<?xml version="1.0" encoding="utf-8"?>
<PACKAGE GUID="{E28FABE0-2F55-4863-A854-C8D0C0DCF0AA}" NAME="Application_Suite" VERSION="1" VERSIONGUID="{E0BDCE67-46B5-4B75-A40A-DE03F58EB643}">
 <APPLIST>
  <APP NAME="Application_Shortcut_1" VERSION="1.0.0.0" ICON="%SFT_MIME_SOURCE%/Application_Suite Icons/Application_Shortcut_1 1.0.0.0.ico" OSD="%SFT_MIME_SOURCE%/Application_Shortcut_1 1.0.0.0.osd">
   <SHORTCUTLIST>
    <SHORTCUT LOCATION="%CSIDL_PROGRAMS%\Application Suite\Environment" ICON="%SFT_MIME_SOURCE%/Application_Suite Icons/Application_Shortcut_1 1.0.0.0.ico" DISPLAY="Application_Shortcut_1" PARAMETERS=""></SHORTCUT>
   </SHORTCUTLIST>
  </APP>
  <APP NAME="Application_Shortcut_2" VERSION="6.3.14.3" ICON="%SFT_MIME_SOURCE%/EBF_MCWS_2013_203_001V Icons/Application_Shortcut_2 6.3.14.3.ico" OSD="%SFT_MIME_SOURCE%/Application_Shortcut_2 6.3.14.3.osd">
   <SHORTCUTLIST>
    <SHORTCUT LOCATION="%CSIDL_PROGRAMS%\Application Suite\Environment" ICON="%SFT_MIME_SOURCE%/Application_Suite Icons/Application_Shortcut_2 6.3.14.3.ico" DISPLAY="Application_Shortcut_2" PARAMETERS=""></SHORTCUT>
   </SHORTCUTLIST>
  </APP>
 </APPLIST>
</PACKAGE>

I want to change the Location Attribute value "%CSIDL_PROGRAMS%\Application Suite\Environment" to ="%CSIDL_PROGRAMS%\App-V apps".The Location Attribute value may change from application to application.
Please help me to modify xml using vbscript.

I have created a script to this, but it is editing the first shortcut loation only.

VB Script

If UCase(objFSO.GetExtensionName(xmlFile.name)) = "XML" Then 
	manifestName = xmlFile.Name
	manifestName = packagePath & "\" & manifestName
		
	set docXML = CreateObject("Microsoft.XMLDOM")
	docXML.Async = "False"
	docXML.Load(manifestName)
	Set colNode = docXML.documentElement.selectSingleNode("//PACKAGE/APPLIST/APP/SHORTCUTLIST/SHORTCUT") 
	colNode.setAttribute "LOCATION", "%CSIDL_PROGRAMS%\App-V Applications"
	docXML.save(manifestName) 
	WSCRIPT.Echo manifestName &" got updated." 	
	End If

Thanks in Advance.

Regards,
Sriram Narra.

February 16th, 2015 5:36am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics