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

Author Topic: [solved] Create 100 files in a folder  (Read 13665 times)

0 Members and 2 Guests are viewing this topic.

Esgrimidor

    Topic Starter


    Hopeful

    Thanked: 1
    Re: Create 100 files in a folder
    « Reply #15 on: August 22, 2009, 12:26:59 PM »
    I'm trying to understand why multiple batch files are even necessary.

    Is for my program Goldmine 5.5 from Frontrange.

    This program make macros with the structure   user.800 .... user.899

    When I launch from the exterior a user.800.bat ...... user.899.bat I'm launching the program with my parameters and a specified macro.

    In this way

    user.860.bat launch

    echo off
    taskkill.exe /im gmw5.exe /f
    Y:\GoldminePrg\gmw5.exe /i:esm /u:JOSE /p: /m:Y:\GoldminePrg\Macros\user.860
    exit

    P.D. Each macro goes o search for a certain field in the database. So is equivalent to enter Goldmine and go to the field determined by the interior macro.....

    I hope is understood.

    Thanksxxxx

    No dejes que tu felicidad dependa de lo que no depende de tí.

    Esgrimidor

      Topic Starter


      Hopeful

      Thanked: 1
      Re: Create 100 files in a folder
      « Reply #16 on: August 22, 2009, 12:34:13 PM »
      I'm trying to understand why multiple batch files are even necessary.

      Well.
      I use excel 2002 and have a check list. I would like to link this list with certain contacts in the database.
      Each bat is used to link to a contact predetermined with a internal goldmine macro.

      In an excel cell I put the path to the bat :  <path>\pepe.800.bat

      Each bat execute the program goldmine and a internal macro , and goes to a predetermined contact in the database. And edit that contact.

      I hope this is understood.

      I have to make one internal macro for each contact to search.

      And one corresponding bat for each internal macro.

      The internal macro have the structure   pepe.800
      and the bats have the structure  pepe.800.bat

      ....



      No dejes que tu felicidad dependa de lo que no depende de tí.

      Esgrimidor

        Topic Starter


        Hopeful

        Thanked: 1
        Re: Create 100 files in a folder
        « Reply #17 on: August 22, 2009, 12:40:48 PM »
        Esgrimidor, what do you need 100 batch files for anyways? 1 file, about 10 lines, and a good for loop can probably do what all these files would do..

        and really, this is confusing me,
        here you go
        Code: [Select]
        @echo off
        :begin
        set pth=
        echo.
        set /p pth=Path of folder:
        if not exist "%pth%" (
        mkdir "%pth%"
        goto :PRE
        )
        echo.
        echo ERROR: Folder exists
        goto :begin
        :PRE
        set /p pr=Prefix for files:
        echo.
        echo IF THE PREFIX CONTAINS INVALID CHARACTERS, FILES WOULD NOT BE CREATED.
        pause
        cd /d "%pth%"
        for /l %%a in (800,1,899) do (
        echo @echo off>%pr%.%%a.bat
        echo taskkill.exe /im gmw5.exe /f>>%pr%.%%a.bat
        echo Y:\GoldminePrg\gmw5.exe /i:esm /u:JOSE /p: /m:Y:\GoldminePrg\Macros\%pr%.%%a >>%pr%.%%a.bat
        echo exit>>%pr%.%%a.bat
        )


        Please tell me if this modification is correct or not :

        Code: [Select]
        @echo off
        :begin
        set pth=
        echo.
        set /p pth=Path of folder:
        if not exist "%pth%" (
        mkdir "%pth%"
        goto :PRE
        )
        echo.
        echo ERROR: Folder exists
        goto :begin
        :PRE
        set /p pr=Prefix for files:
        echo.
        echo IF THE PREFIX CONTAINS INVALID CHARACTERS, FILES WOULD NOT BE CREATED.
        pause
        cd /d "%pth%"
        for /l %%a in (800,1,899) do (
        echo @echo off>%pr%.%%a
        echo taskkill.exe /im gmw5.exe /f>>%pr%.%%a
        echo Y:\GoldminePrg\gmw5.exe /i:esm /u:JOSE /p: /m:Y:\GoldminePrg\Macros\%pr%.%%a >>%pr%.%%a
        echo exit>>%pr%.%%a
        )
        No dejes que tu felicidad dependa de lo que no depende de tí.

        BatchFileBasics



          Hopeful

          Thanked: 18
          Re: Create 100 files in a folder
          « Reply #18 on: August 22, 2009, 12:41:24 PM »
          sorry, i mean the extensions it is being output to is not in bat

          following your..."requests"

          this is it:
          Code: [Select]
          @echo off
          :begin
          set pth=
          echo.
          set /p pth=Path of folder:
          if not exist "%pth%" (
          mkdir "%pth%"
          goto :PRE
          )
          echo.
          echo ERROR: Folder exists
          goto :begin
          :PRE
          set /p pr=Prefix for files:
          echo.
          echo IF THE PREFIX CONTAINS INVALID CHARACTERS, FILES WOULD NOT BE CREATED.
          pause
          cd /d "%pth%"
          for /l %%a in (800,1,899) do (
          echo @echo off>%pr%.%%a.bat
          echo taskkill.exe /im gmw5.exe /f>>%pr%.%%a.bat
          echo Y:\GoldminePrg\gmw5.exe /i:esm /u:JOSE /p: /m:Y:\GoldminePrg\Macros\%pr%.%%a >>%pr%.%%a.bat
          echo exit>>%pr%.%%a.bat
          )
          When the power of love overcomes the love of power the world will know peace - Jimi Hendrix.

          Esgrimidor

            Topic Starter


            Hopeful

            Thanked: 1
            Re: Create 100 files in a folder
            « Reply #19 on: August 22, 2009, 12:47:07 PM »
            Of course you are right

            Sure there are a lots of ways of doing this : DDE, API Goldmine, COM procedures, etc.
            But in the goldmine forum , at the present moment, they don't give support for via VB create an script for seek a record in the database without need to open goldmine.

            This way is one of many ways, and for me is enough.

            Thank very much.

            100 is the number of macros you can create with a user. Each user can have 100 macros. And the user JOSE can use the macros of other users......

            In this way I can have all the links I need from excel, word.

            To make "fussions" Goldmine have an utility : gmlinks I use to prepared personalyzed writes....













            No dejes que tu felicidad dependa de lo que no depende de tí.

            Esgrimidor

              Topic Starter


              Hopeful

              Thanked: 1
              Re: Create 100 files in a folder
              « Reply #20 on: August 22, 2009, 12:55:01 PM »
              sorry, i mean the extensions it is being output to is not in bat

              following your..."requests"

              this is it:
              Code: [Select]
              @echo off
              :begin
              set pth=
              echo.
              set /p pth=Path of folder:
              if not exist "%pth%" (
              mkdir "%pth%"
              goto :PRE
              )
              echo.
              echo ERROR: Folder exists
              goto :begin
              :PRE
              set /p pr=Prefix for files:
              echo.
              echo IF THE PREFIX CONTAINS INVALID CHARACTERS, FILES WOULD NOT BE CREATED.
              pause
              cd /d "%pth%"
              for /l %%a in (800,1,899) do (
              echo @echo off>%pr%.%%a.bat
              echo taskkill.exe /im gmw5.exe /f>>%pr%.%%a.bat
              echo Y:\GoldminePrg\gmw5.exe /i:esm /u:JOSE /p: /m:Y:\GoldminePrg\Macros\%pr%.%%a >>%pr%.%%a.bat
              echo exit>>%pr%.%%a.bat
              )



              I see.....

              How can I do bat files pepe.800.bat and inside the bat : pepe.800 only ?

               
              No dejes que tu felicidad dependa de lo que no depende de tí.

              BatchFileBasics



                Hopeful

                Thanked: 18
                Re: Create 100 files in a folder
                « Reply #21 on: August 22, 2009, 12:56:58 PM »
                thats what it is, they are all .bat files.
                but inside are just pre.800
                no .bat inside
                When the power of love overcomes the love of power the world will know peace - Jimi Hendrix.

                Esgrimidor

                  Topic Starter


                  Hopeful

                  Thanked: 1
                  Re: Create 100 files in a folder
                  « Reply #22 on: August 22, 2009, 01:00:09 PM »
                  Oh yes.

                  Perfect. Is enough for me.
                  You have saved me a lot of work.
                  With the bats is another thing....

                  No dejes que tu felicidad dependa de lo que no depende de tí.

                  smeezekitty

                  • Guest
                  Re: Create 100 files in a folder
                  « Reply #23 on: August 22, 2009, 01:24:59 PM »
                  Code: [Select]
                  @echo off
                  set /p prefix=Enter Prefix:
                  for %%d in (0, 1, 100) do (
                  set /A i=%%d+800
                  taskkill.exe /im gmw5.exe /f
                  Y:\GoldminePrg\gmw5.exe /i:esm /u:JOSE /p: /m:Y:\GoldminePrg\Macros\%%prefix.%%i.bat
                  )
                  exit