+ Post New Thread
Results 1 to 8 of 8
Scripts Thread, Urgent ind replace fline/append ine next to the line in html using batch file in Coding and Web Development; Hi, I would like to find the below line in Html file <ul data-role="listview" data-divider-theme="d" data-inset="false"> and replace with the ...
  1. #1

    Join Date
    Mar 2013
    Posts
    3
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Urgent ind replace fline/append ine next to the line in html using batch file

    Hi,

    I would like to find the below line in Html file

    <ul data-role="listview" data-divider-theme="d"
    data-inset="false">

    and replace with the below lines


    <ul data-role="listview" data-divider-theme="d" data-inset="false">

    <li><a href="https://a.363.apk" data-transition="slide">

    <img src="https://appstor.com/aaa.png"
    class="ui-li-thumb" />
    <h3
    class="ui-li-heading">Chase-Amazon_Appstore-uat-3.0.363.apk</h3>
    <p
    class="ui-li-desc">Chase-Amazon_Appstore-uat-3.0.363.apk</p></a></li>



    using a batch file.

    so batch file should read the htmk file find the line and replace wih the
    given lines

  2. #2
    ass17's Avatar
    Join Date
    Feb 2013
    Posts
    355
    Thank Post
    5
    Thanked 39 Times in 36 Posts
    Rep Power
    27
    I have done this in a VB script, can you use VB script as an alternative? Let me know and I will post it in full.

  3. #3
    ass17's Avatar
    Join Date
    Feb 2013
    Posts
    355
    Thank Post
    5
    Thanked 39 Times in 36 Posts
    Rep Power
    27
    Const ForReading = 1
    Const ForWriting = 2

    set objShell = CreateObject("WScript.Shell")
    Set objFSO = CreateObject("Scripting.FileSystemObject")

    Dim StringFind, StringReplace

    StringFind = "put your string in here to find"
    StringReplace = "put your replacement string in here"

    FileName = objFSO.GetFile("pathname and file name to file to look in")

    Set objFile = objFSO.OpenTextFile(FileName, ForReading)
    strContents = objFile.ReadAll
    objFile.Close

    If InStr(strContents,StringFind) then

    strContents = Replace(strContents, StringFind, StringReplace)

    Set objFile = objFSO.OpenTextFile(FileName, ForWriting)
    objFile.WriteLine strContents
    objFile.Close

    Else

    'Do nothing

    End If

  4. #4

    Join Date
    Mar 2013
    Posts
    3
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Thnak you but looking for a working .bat batch file

  5. #5

    nephilim's Avatar
    Join Date
    Nov 2008
    Location
    Dunstable
    Posts
    12,301
    Thank Post
    1,673
    Thanked 2,021 Times in 1,469 Posts
    Blog Entries
    2
    Rep Power
    457
    So...you want a batch to do the following...

    open a file
    find a line in the file
    replace the line in the file
    save the file
    close the file

    rinse and repeat..think you would be better off with a VBScript tbh, as a batch is more for mapping things and services etc.

  6. #6

    RabbieBurns's Avatar
    Join Date
    Apr 2008
    Location
    Sydney
    Posts
    5,531
    Thank Post
    1,341
    Thanked 470 Times in 307 Posts
    Blog Entries
    6
    Rep Power
    200
    notepad++ can do search and replace in multiple files

    http://notepad-plus-plus.org/download/v6.3.html

  7. #7

    Join Date
    Mar 2013
    Posts
    3
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Well,I already have a batch file with lots of scriptsand we need to append this as well to it.hence looking for the solution

  8. #8

    RabbieBurns's Avatar
    Join Date
    Apr 2008
    Location
    Sydney
    Posts
    5,531
    Thank Post
    1,341
    Thanked 470 Times in 307 Posts
    Blog Entries
    6
    Rep Power
    200
    so add a line in the batch file which runs the vbs from above?

  9. Thanks to RabbieBurns from:

    nephilim (18th March 2013)



SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 1
    Last Post: 6th March 2013, 08:09 PM
  2. Replies: 12
    Last Post: 29th September 2012, 10:27 PM
  3. Replies: 18
    Last Post: 4th November 2010, 10:22 PM
  4. Replies: 1
    Last Post: 21st May 2010, 06:02 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •