-
June 1st, 2015, 07:54 AM
#1
Change code to batch process
Hello all Members,
I have made this code in VB I am totally a beginner.
If you see in my code I have hardcoded absolute folderpaths and filenames.
I would like instead, You press on a button from the button you select a folder the script loops through a folder select all "xml" files. then save with same name.
See code here:
Code:
Dim analyse
Dim exactContexts
Dim subnode
Dim repeated
Dim realRepeated
Dim tmpValue
Set analyse = CreateObject("Msxml2.DOMDocument.6.0")
analyse.Load "C:\00_Projekte_temp\analyse.xml" 'HERE IS HARDCODED
Set exactContexts = analyse.SelectNodes("//inContextExact")
For i = 0 To exactContexts.Length - 1
Set subnode = exactContexts(i)
For Each att In subnode.Attributes
If att.Name = "words" Then
att.Value = "0"
Exit For
End If
Next att
Next i
Set repeated = analyse.SelectNodes("//crossFileRepeated")
For i = 0 To repeated.Length - 1
Set subnode = repeated(i)
For Each att In subnode.Attributes
If att.Name = "words" Then
tmpValue = att.Value
att.Value = "0"
Exit For
End If
Next att
Set realRepeated = subnode.NextSibling
For Each att In realRepeated.Attributes
If att.Name = "words" Then
att.Value = Val(att.Value) + Val(tmpValue)
Exit For
End If
Next att
Next i
analyse.Save "C:\00_Projekte_temp\analyse2.xml" 'HERE IS HARDCODED
Could someone help me out?
Thank you uin advance
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|