Jump to content

Aacini

Member
  • Posts

    2
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    Mexico

Posts posted by Aacini

  1. Hi. The big problem with my code is that in this line:


    for /F "delims=" %%c in ('findstr /C:"<a>" "%source%" ^| findstr /C:"%pdf%"') do (

    the start of tag must be "<a " instead of "<a>", as Yzöwl noted:

    ... then the following will always fail:
    findstr /C:"<a>"

    I had fixed this problem in my original post above.

    As I said in the original site, I don't know much about .PDF files and this detail was confused because the tag <a> was mentioned there. However, I noted this point when I indicated that I tested this program with this "GEN 0 GENERAL.html" example file:


    Line one
    <a>href="/Dokumenter/EK_GEN_0_X_en.pdf" class="uline"><b>GEN 0.X Preface</b></a>
    Line three
    <a>href="/Dokumenter/EK_GEN_0_1_en.pdf" class="uline"><b>GEN 0.1 Preface</b></a>
    Line five

    I apologize for any trouble caused by this detail...

  2. Hi. I am newbie at this forum. I was invited here by DosCode to post my last solution to this problem that was developed in detail in other site. So here it is:


    @echo off
    setlocal EnableDelayedExpansion
    set "source=GEN 0 GENERAL.html"
    set "pdf=0_1_en.pdf"
    echo In file: "%source%"
    echo Look for anchor: "%pdf%"

    for /F "delims=" %%c in ('findstr /C:"<a " "%source%" ^| findstr /C:"%pdf%"') do (
    set "tag=%%c"
    rem Get the value of "<b>" sub-tag
    set "tag=!tag:<b>=$!"
    set "tag=!tag:</b>=$!"
    for /F "tokens=2 delims=$" %%b in ("!tag!") do set title=%%b
    echo Title found: "!title!"
    )

    If you wish, you may review the development of this solution at this site

    Regards...

    Antonio

    EDIT: I fixed a detail in my code (changed "<a>" by "<a ") that prevent it to correctly run...

×
×
  • Create New...