Имя пользователя:
Пароль:  
Помощь | Регистрация | Забыли пароль?  

Показать сообщение отдельно

Ветеран


Сообщения: 27449
Благодарности: 8087

Профиль | Отправить PM | Цитировать


Kadoh, на WSH:
Скрытый текст
Код: Выделить весь код
Option Explicit

Dim strFile

Dim strCurrCorrespAccValue
Dim strNewCorrespAccValue

Dim objXMLDOMElement


strCurrCorrespAccValue = "30101810600000000758"
strNewCorrespAccValue  = "30109810060340000009"

If WScript.Arguments.Count = 1 Then
	strFile = WScript.Arguments.Item(0)
	
	If WScript.CreateObject("Scripting.FileSystemObject").FileExists(strFile) Then
		With WScript.CreateObject("MSXML2.DOMDocument")
			.async = False
			
			If .load(strFile) Then
				For Each objXMLDOMElement In .selectNodes("/PacketEPD/ED101/Payee/Bank[@CorrespAcc=""" & strCurrCorrespAccValue & """]")
					objXMLDOMElement.setAttribute "CorrespAcc", strNewCorrespAccValue
				Next
				
				.save strFile
			Else
				WScript.Echo "Can't load xml content from [" & strFile & "]."
			End If
		End With
	Else
		WScript.Echo "File [" & strFile & "] not found"
	End If
Else
	WScript.Echo "Usage: " & WScript.ScriptName & " <xml-file>"
End If

WScript.Quit 0

Путь к файлу xml задаётся параметром скрипта (также можно просто перетянуть xml-файл на скрипт в Проводнике).

Отправлено: 19:25, 10-11-2017 | #18