Find the specified word in multiple XML files, replace with new.

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
chngrcn
Posts: 190
Joined: 29 Feb 2016, 08:55

Find the specified word in multiple XML files, replace with new.

14 Dec 2017, 04:21

Code: Select all

Gui, Add, Edit, x22 y20 w180 h20 , http://www.abc.com.tr
Gui, Add, Edit, x22 y50 w180 h20 , http://www.123abc.com.tr
Gui, Add, Button, x212 y20 w90 h50 , Run
; Generated using SmartGUI Creator for SciTE
Gui, Show, w326 h106, Untitled GUI
return

GuiClose:
ExitApp

In the rar file I added in the attachment, there is 1 folder.
This folder contains files with xml extension.

button, I want to change the contents of all xml files in the folder as I mentioned below.

It is to find "http://www.abc.com.tr" addresses in the files with all xml extensions in the folder and replace them with "http://www.123abc.com.tr" address.

Thank you in advance for your help.


XML CONTENT

Code: Select all

<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet type="text/xsl" href="http://www.abc.com.tr"?>
<Onay>
  <BelgeOnay>
    <Species >APPLE</Species>
    <Sherry >A</Sherry>
    <Quantity >50</Quantity>
    <Unvan>RAMAZAN TAHMAZ  </Unvan>
    <Name>APPLE</Name>
    <Name>APPLE</Name>
    <Name>APPLE</Name>
    <Name>APPLE</Name>      
  </BelgeOnay>
</Onay>
Attachments
xml.rar
(1.62 KiB) Downloaded 17 times
User avatar
divanebaba
Posts: 805
Joined: 20 Dec 2016, 03:53
Location: Diaspora

Re: Find the specified word in multiple XML files, replace with new.

14 Dec 2017, 07:34

Hmm.
What exactly do you want to replace?
Maybe, in your example, RAMAZAN into ÖZLEM or Belge Onay into Hande Yener?
Should not so difficult to change content, when you loop the folder for xml-files with Loop, Files. The derived results of A_LoopFileFullPath you have to store in a list.
After getting the list with the full paths you had to parse this list with ...
More info, when you ask.

EDIT: My english is so bad, because my education is german version for foreigners.
You want to replace content of Edit1 with content of Edit2.

I will look to give a little bit support
Einfach nur ein toller Typ. :mrgreen:
chngrcn
Posts: 190
Joined: 29 Feb 2016, 08:55

Re: Find the specified word in multiple XML files, replace with new.

14 Dec 2017, 07:45

divanebaba wrote: EDIT: My english is so bad, because my education is german version for foreigners.
You want to replace content of Edit1 with content of Edit2.

I will look to give a little bit support

deutsche Version
Hallo, danke für dein Interesse.

In der Datei "ahk" suchen Sie in den XML-Dateien nach dem Wort in edit1 und ersetzen es stattdessen durch den Text in edit2.

Wenn wir den Knopf drücken,
das heißt, anstatt "= http://www.abc.com.tr" in edit1 zu finden,
in edit2 mit dem text = "http://www.123abc.com".

Danke.


for English
hello, thank you for your interest.

In the "ahk" file you will search for the word in edit1 in the xml files and replace it with the text in edit2 instead.

When we hit the button,
that is, instead of finding "= http://www.abc.com.tr" in edit1,
in edit2 with the text = "http://www.123abc.com".

thank you.
User avatar
divanebaba
Posts: 805
Joined: 20 Dec 2016, 03:53
Location: Diaspora

Re: Find the specified word in multiple XML files, replace with new.

14 Dec 2017, 08:03

Try this:
If you have questions, ask me.
Einfach nur ein toller Typ. :mrgreen:
chngrcn
Posts: 190
Joined: 29 Feb 2016, 08:55

Re: Find the specified word in multiple XML files, replace with new.

14 Dec 2017, 08:20

Vielen Dank. Ich habe es versucht.

thank you so much. I tried.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: CrowexBR, mebelantikjaya, Spawnova and 307 guests