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 38083 times)

0 Members and 1 Guest are viewing this topic.

srujana

  • Guest
Re: Open and Reading the file
« Reply #15 on: August 17, 2007, 02:49:20 AM »
Both,

 Thanks for your responses. But, I have a problem here. I am unable to run the VB script. I tried executing it from command line but nothing seems to be happening.

I also tried to run batch file, but it just executes till changing the directory and then displays the following message:

 The system cannot find the file specified.
 Press any key to continue . . .


Could you please help me ... ???

Thanks...
Srujana

DeltaSlaya



    Apprentice
  • Google
    Re: Open and Reading the file
    « Reply #16 on: August 17, 2007, 02:54:31 AM »
    As I said, you will need to tell me what folders are used. The real folders, not examples. Thanks.
    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 #17 on: August 17, 2007, 03:00:28 AM »
      Quote
      That should work. Grabs filename (without ext) of newest xml (gives error if none exist) then looks in %input%.xml, using tokens finds the actual name. Then setting this name as the output it copies %input%.pdf to D:\%output%.pdf. I believe that is correct?

      Input folder has been set as C: in example, please change only the "CD ..." line to go to the INPUT directory.
      Output folder is D:\.

      Tell me first what the folders should be but otherwise that worked fine for me with your example xml file and a pdf file with same name.

      Answer all that, is it correct?
      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 #18 on: August 17, 2007, 03:03:38 AM »
      Everything is right. As of now, I am trying to test the program in my local folders and I made the changes accordingly. But, I donot understand the reason as to why its not being executed.

      DeltaSlaya



        Apprentice
      • Google
        Re: Open and Reading the file
        « Reply #19 on: August 17, 2007, 03:05:20 AM »
        Ok remove the @echo off line at the top of the script, run it again. Then right click on the window click 'MARK'. Select everything, make sure you have everything and then press 'ENTER'. You will then be able to paste that information here, thanks.
        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 #20 on: August 17, 2007, 03:08:02 AM »
          Also post if possible a "dir" of the input folder and the contents of the xml file. I will figure out where I went wrong. You didn't answer if the line which has the actual name is always the first and has four 's with the name between the THIRD and FOURTH.
          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)
          -

          ghostdog74



            Specialist

            Thanked: 27
            Re: Open and Reading the file
            « Reply #21 on: August 17, 2007, 03:24:06 AM »
            I am unable to run the VB script. I tried executing it from command line but nothing seems to be happening.
            how did you execute it? it should be : cscript /nologo myscript.vbs. try to put your script in the same directory as the files. Also change the script's srcFolder, dstFolder etc....according to your environment..? Don't just cut and paste...and expect it to work...

            srujana

            • Guest
            Re: Open and Reading the file
            « Reply #22 on: August 17, 2007, 03:24:24 AM »
            Hi,
             
             This is the output:

             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 output
            )

            C:\log>(
            set input=Test
             goto output
            )

            C:\log>set output=

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

            C:\log>copy "Test.pdf" "D:\.pdf"
            The system cannot find the file specified.

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

            C:\log>



            I created a folder called  "log" in C:\ drive. And, placed two files
             Test.xml
             123.pdf

            But, the program seems to be renaming the pdf with "Test".

            Please look into the same., thanks

            srujana

            • Guest
            Re: Open and Reading the file
            « Reply #23 on: August 17, 2007, 03:25:41 AM »
            Ghostdog, I made the modifications accordingly and only then tried executing the VBS file. But, nothing seems to be happening.

            DeltaSlaya



              Apprentice
            • Google
              Re: Open and Reading the file
              « Reply #24 on: August 17, 2007, 03:27:26 AM »
              JESUS CHRIST. You said the pdf file and the xml will always have the same name... Try rename them to both the same name and it will work...

              If they are not always going to both be the same then tell me and I will rewrite it a bit but that will take a while and may be less reliable. Try making the xml and pdf with same name..

              Quote
              For eg., for a Cognos report  "Rep1_test", two files exist in the current location:

                1325_123467.xml
                1325_123467.pdf
              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 #25 on: August 17, 2007, 03:32:40 AM »
                Sorry for the language but I'm just relieved that it wasn't my fault lol.

                Why didn't the code you copied have the 'cd ...' 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 #26 on: August 17, 2007, 03:35:55 AM »
                Yes,both the files exist with the same name. But, the program has to rename the PDF with the name present in the XML code (2nd @name) which it isnt doing.

                DeltaSlaya



                  Apprentice
                • Google
                  Re: Open and Reading the file
                  « Reply #27 on: August 17, 2007, 03:38:39 AM »
                  Well it worked fine for me when I tested it.

                  You MUST have an xml and a pdf file with the same name in the folder that it is CDing to.

                  Please post the contents of the xml file here. Because it's not grabbing the name.

                  And please start reading my posts and answering all questions so I don't have to keep reposting the same ones, thanks.
                  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 #28 on: August 17, 2007, 03:46:24 AM »
                  Ghost dog, this the output after running your script.

                  I included the execute statement in a batch file and ran it.

                  C:\log>cd\

                  C:\>batch_vbs.bat

                  C:\>CD C:\log

                  C:\log>cscript /nologo C:\log\vbs_text.vbs
                  found  123 123
                  The string to replace is  [@name='PRV-INT-001:Provider NCPDP Interface Erro
                  r Report']
                  d:\\[@name='PRV-INT-001:Provider NCPDP Interface Error Report']
                  Renaming pdf ...
                  C:\log>


                  DeltaSlaya



                    Apprentice
                  • Google
                    Re: Open and Reading the file
                    « Reply #29 on: August 17, 2007, 03:49:17 AM »
                    Please post A REAL example of an xml file used. Because judging by that script you have just posted it appears that 's are not always present. If you ANSWERED my question I would have used an alternative method.

                    Please post the xml and identify the name the pdf is to be changed to and two characters either side of it that will NEVER change..

                    Thanks, please make sure you are answering all those questions.
                    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)
                    -