Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Open and Reading the file  (Read 39543 times)

0 Members and 1 Guest are viewing this topic.

srujana

  • Guest
Re: Open and Reading the file
« Reply #30 on: August 17, 2007, 03:57:16 AM »
Delta,

 I have placed following files in C:\log

 123.xml
 123.pdf

The XML code is as below:

 <?xml version="1.0" encoding="utf-8" ?>
- <!--   Copyright (C) 2006 Cognos Incorporated.  All Rights Reserved.
  Cognos (R) is a trademark of Cognos Incorporated.

  -->
- <!--   Experimental.
  Product features described in this file may not be supported in future releases.

  -->
- <outputDescriptor xmlns="http://developer.cognos.com/schema/OutputDescriptor/1.0" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <asOfTime>2007-08-12T13:38:08.093Z</asOfTime>
  <burstKey />
  <contact />
  <defaultDescription />
  <defaultName>2007-08-12T13:38:09.078Z</defaultName>
  <fileName>1376_1186940289078.pdf</fileName>
  <locale>en-us</locale>
  <owner>rgajendra</owner>
  <ownerNamespace>COGNOS-DEV Team</ownerNamespace>
  <parameterValues />
  <reportSearchPath>/content/package[@name='Provider']/report[@name='PRV-INT-001:Provider NCPDP Interface Error Report']</reportSearchPath>
  <reportViewSearchPath>/content/folder[@name='COGNOS-DEV Team']/reportView[@name='Report View of PRV-INT-001:Provider NCPDP Interface Error Report']</reportViewSearchPath>
  </outputDescriptor>

The name the PDF is to be changed to is:

PRV-INT-001:Provider NCPDP Interface Error Report.

The ' ' on either side of the name would never change.

Thanks...

DeltaSlaya



    Apprentice
  • Google
    Re: Open and Reading the file
    « Reply #31 on: August 17, 2007, 04:02:14 AM »
    Will the line always be on 21 or will it be the only line that has a @name OR 'reportsearchpath' on it, or both? And are there always FOUR ' on that line?
    System specs:
    Intel Core 2 Duo E6600 (up to 3.3 stock V and air)
    ASUS Striker Extreme
    XFX 8600GT XXX Edition
    2x 1gB Corsair XMS2 DDR2-800
    Seagate Barracuda 320gB SATA
    Raidmax Ninja 918 (520W ATXV2.0 PSU)
    -

    srujana

    • Guest
    Re: Open and Reading the file
    « Reply #32 on: August 17, 2007, 04:05:09 AM »
    It will be the only line which has @name in it, which is second in the order.

    DeltaSlaya



      Apprentice
    • Google
      Re: Open and Reading the file
      « Reply #33 on: August 17, 2007, 04:10:57 AM »
      Ok will it also be the only line with "reportSearchPath" on it, because that would be easier to find.
      System specs:
      Intel Core 2 Duo E6600 (up to 3.3 stock V and air)
      ASUS Striker Extreme
      XFX 8600GT XXX Edition
      2x 1gB Corsair XMS2 DDR2-800
      Seagate Barracuda 320gB SATA
      Raidmax Ninja 918 (520W ATXV2.0 PSU)
      -

      srujana

      • Guest
      Re: Open and Reading the file
      « Reply #34 on: August 17, 2007, 04:12:32 AM »
      Yes.

      DeltaSlaya



        Apprentice
      • Google
        Re: Open and Reading the file
        « Reply #35 on: August 17, 2007, 04:35:55 AM »
        Filenames cannot contain ":". Thats why the batch wasn't working.
        System specs:
        Intel Core 2 Duo E6600 (up to 3.3 stock V and air)
        ASUS Striker Extreme
        XFX 8600GT XXX Edition
        2x 1gB Corsair XMS2 DDR2-800
        Seagate Barracuda 320gB SATA
        Raidmax Ninja 918 (520W ATXV2.0 PSU)
        -

        srujana

        • Guest
        Re: Open and Reading the file
        « Reply #36 on: August 17, 2007, 04:37:59 AM »
        Oh..k so is there no other alternative?

        DeltaSlaya



          Apprentice
        • Google
          Re: Open and Reading the file
          « Reply #37 on: August 17, 2007, 04:40:54 AM »
          Yes I can change the : to an alternative character before the file is renamed, what would you like unusable characters to be altered to? The unusable characters are: "\ / : ? " < > |" but "< > |" will cause the batch file to crash anyway.
          System specs:
          Intel Core 2 Duo E6600 (up to 3.3 stock V and air)
          ASUS Striker Extreme
          XFX 8600GT XXX Edition
          2x 1gB Corsair XMS2 DDR2-800
          Seagate Barracuda 320gB SATA
          Raidmax Ninja 918 (520W ATXV2.0 PSU)
          -

          srujana

          • Guest
          Re: Open and Reading the file
          « Reply #38 on: August 17, 2007, 04:50:45 AM »
          Can you change the character to '-' (hiphen)

          DeltaSlaya



            Apprentice
          • Google
            Re: Open and Reading the file
            « Reply #39 on: August 17, 2007, 04:53:50 AM »
            Yes. What of those characters may be present? Just the :?
            System specs:
            Intel Core 2 Duo E6600 (up to 3.3 stock V and air)
            ASUS Striker Extreme
            XFX 8600GT XXX Edition
            2x 1gB Corsair XMS2 DDR2-800
            Seagate Barracuda 320gB SATA
            Raidmax Ninja 918 (520W ATXV2.0 PSU)
            -

            DeltaSlaya



              Apprentice
            • Google
              Re: Open and Reading the file
              « Reply #40 on: August 17, 2007, 04:58:52 AM »
              Quote
              @echo off

              :: Change "C:\OUTPUT" to output directory with NO "\" at end.
              set outdir=C:\OUTPUT
              if not exist "%outdir%" (
                 echo Output folder not exist.
                 pause >nul
                 exit
              )

              :: Change "C:\" to input directory with "\" at end.
              cd C:\

              cls

              set input=

              :: Check for xmls
              if not exist "*.xml" (
                 echo No .xml files.
                 pause >nul
                 exit
              )

              :: Set input to last modified .xml in dir
                 for /f "usebackq delims=" %%I in (`dir /b /a:-d /o:-d *.xml`) do (
                 set input=%%~nI
                 goto out
              )

              :out

              :: Grab 'actual' name of pdf from xml
              set output=

              for /f "usebackq tokens=4 delims='" %%I in (`findstr /i "reportSearchPath" "%input%.xml"`) do (
                 set output=%%I
                 goto copy
              )

              :copy
              set output=%output::=-%
              copy "%input%.pdf" "%outdir%\%output%.pdf"
              pause

              There you go.. Don't forget to change the input and output folders according to the information.
              System specs:
              Intel Core 2 Duo E6600 (up to 3.3 stock V and air)
              ASUS Striker Extreme
              XFX 8600GT XXX Edition
              2x 1gB Corsair XMS2 DDR2-800
              Seagate Barracuda 320gB SATA
              Raidmax Ninja 918 (520W ATXV2.0 PSU)
              -

              srujana

              • Guest
              Re: Open and Reading the file
              « Reply #41 on: August 17, 2007, 05:13:18 AM »
              Hey! this is the output, it still seems to consider the XML name and not the name inside it...


              C:\log>set input=

              C:\log>if not exist "*.xml" (
              echo No .xml files.
               pause  1>nul
               exit
              )

              C:\log>for /F "usebackq delims=" %I in (`dir /b /a:-d /o:-d *.xml`) do (
              set input=%~nI
               goto out
              )

              C:\log>(
              set input=123
               goto out
              )

              C:\log>set output=

              C:\log>for /F "usebackq tokens=4 delims='" %I in (`findstr /i "reportSearchPath
               "123.xml"`) do (
              set output=%I
               goto copy
              )

              C:\log>set output=:=-

              C:\log>copy "123.pdf" "D:\:=-.pdf"
              The filename, directory name, or volume label syntax is incorrect.
                      0 file(s) copied.

              C:\log>pause
              Press any key to continue . . .

              C:\log>

              DeltaSlaya



                Apprentice
              • Google
                Re: Open and Reading the file
                « Reply #42 on: August 17, 2007, 05:17:29 AM »
                Hmmm, that works for me, are you sure the line format is the same as this?

                "<reportSearchPath>/content/package[@name='Provider']/report[@name='PRV-INT-001:Provider NCPDP Interface Error Report']</reportSearchPath>"

                Try replacting the "reportSearchPath" for "@name" in the second for statement.
                System specs:
                Intel Core 2 Duo E6600 (up to 3.3 stock V and air)
                ASUS Striker Extreme
                XFX 8600GT XXX Edition
                2x 1gB Corsair XMS2 DDR2-800
                Seagate Barracuda 320gB SATA
                Raidmax Ninja 918 (520W ATXV2.0 PSU)
                -

                srujana

                • Guest
                Re: Open and Reading the file
                « Reply #43 on: August 17, 2007, 06:03:58 AM »
                Hey! it still doesnt work :(

                ghostdog74



                  Specialist

                  Thanked: 27
                  Re: Open and Reading the file
                  « Reply #44 on: August 17, 2007, 09:11:35 AM »
                  Ghostdog, I made the modifications accordingly and only then tried executing the VBS file. But, nothing seems to be happening.
                  show me your version of the vb script. Also, don't just say not happening. describe in more detail. does it mean you did not see the changed file? or it does change but not to your specs?  for me it works.