Loading ...
Sorry, an error occurred while loading the content.

RE: [BATCH WORLD] Accepting Input from Windows Clipboard

Expand Messages
  • Gray M. Strickland
    I don t mind buying something. Heck, I d buy VB if I really thought it was the correct way to go. In case this brings any other ideas to mind, here s what I m
    Message 1 of 8 , Aug 1, 2002
    • 0 Attachment
      I don't mind buying something. Heck, I'd buy VB if I really thought it was
      the correct way to go. In case this brings any other ideas to mind, here's
      what I'm trying to acomplish. I want to create a batch/program (call it
      "Batchmaker") which creates batch files on demand using this logic:

      1. In Windows Explorer, user manually migrates to a folder and copies the
      destination path from the Explorer address bar to the clipboard. String
      copied will be something like, "J:\clients\CCCC clientname\MMMM mattername"
      where CCCC and MMMM are a four digit number and clientname and mattername
      are alpha descriptions. If Ken Mazie is client 1500 and his lawsuit against
      IBM is the 3rd case we're doing for him, his files might be found in
      "J:\clients\1500 Mazie, Ken\0003 Mazie vs. IBM."

      2. Start batchmaker.

      3. Batchmaker accepts text string containing the desired path from windows
      clipboard and saves it as variable1.

      4. Batchmaker parses the string to create variable2 in the form CCCC.MMMM.
      If variable1 is "J:\clients\1500 Mazie, Ken\0003 Mazie vs. IBM" then
      variable 2 should be "1500.0003."

      5. Batchmaker writes a plain text file which contains "explorer.exe
      [variable1]" and saves it to J:\tmw4\batch as CCCC.MMMM.bat. In this case,
      as 1500.0003.bat.

      We have a database which tracks all of our lawsuits. You can put a batchfile
      name in a field and it will run it on demand. When I look at a case record
      in the dB, I want to be able to execute a batch file which open a windows
      explorer session to the folder which contains all the lawsuit's electronic
      files. It's part of a poor man's document management system.

      My apologies to those bored silly by this post.

      Gray Strickland

      > -----Original Message-----
      > From: Kenneth.C.Mazie@... [mailto:Kenneth.C.Mazie@...]
      > Sent: Wednesday, July 31, 2002 4:45 PM
      > To: gray.strickland@...
      > Cc: batchworld@yahoogroups.com
      > Subject: Re: [BATCH WORLD] Accepting Input from Windows Clipboard
      >
      >
      > Gray,
      > I haven't found any direct means of getting text from the clipboard in a
      > batch file without an outside application.
      >
      > Don't know if you want to go this route or not. We use a program here
      > called "WinBatch" which is actually a Windows programming language. You
      > create executable files with it and it's quite powerfull. We use it to
      > customize our server build process. It has a ton of functionality in
      > Windows, the only disadvantage is that you need to do a bit of simple
      > programming to create anything. The help files are very concise
      > and their
      > web site has a great knowledge base. If you don't mind buying the
      > program and creating a compiled executable to handle your clipboard text
      > go look at it at http://www.winbatch.com
      >
      > Ken Mazie MCSE/CNE
      > Kaiser Permanente Server Engineering
      > ===========================================
      >
      >
      >
      >
      >
      >
      > "Gray M. Strickland" <gray.strickland@...>
      > 07/30/2002 07:07 PM
      > Please respond to batchworld
      >
      >
      > To: <batchworld@yahoogroups.com>
      > cc:
      > Subject: [BATCH WORLD] Accepting Input from
      > Windows Clipboard
      >
      >
      > What is the best way to write a batch file which pauses to accept input
      > from
      > the Windows Clipboard (ctrl-v), then displays when it received for
      > verification before proceeding? The input from the Clipboard will always
      > be
      > pure text -- or at least any valid input will be pure text.
      >
      >
      >
      >
      > To Post a message, send it to: batchworld@...
      >
      > To Unsubscribe, send a blank message to:
      > batchworld-unsubscribe@...
      >
      > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
      >
      >
    • kcmjr@onemain.com
      These manipulations of text can be done by a batch file but getting the initial string in will be the hard part. Michael might have some trick up his sleeve
      Message 2 of 8 , Aug 1, 2002
      • 0 Attachment
        These manipulations of text can be done by a batch file but getting the
        initial string in will be the hard part. Michael might have some trick up
        his sleeve for handling that. I thought I had a batch file saved
        somewhere that would interact with the clipboard but I'll be darned if I
        can find it. This could be easily done in WinBatch though. All the
        functions needed are built in and if you've ever done any programming in
        BASIC you can pick up Winbatch with very little trouble as I just recently
        did. I'm no programmer but my experience with batch files and my high
        school basic programming classes were enough to get my doing some
        impressive things in WinBatch (gosh I sound like some kind of
        advertisement, ugh...). You could dump the text into the clipboard and
        click an icon on the quick launch menu or start menu and run the compiled
        script. The script would do the rest and it would be done. I just checked
        and there are a whole slew of native clipboard functions. I might be able
        to whip up an executable to do what you need if I have time at lunch
        during the next few days. Is the format of the text correct as listed in
        your note?

        KCM






        "Gray M. Strickland" <gray.strickland@...>
        08/01/2002 08:21 AM


        To: Kenneth C Mazie/PO/KAIPERM@KAIPERM, <batchworld@yahoogroups.com>
        cc:
        Subject: RE: [BATCH WORLD] Accepting Input from Windows Clipboard


        I don't mind buying something. Heck, I'd buy VB if I really thought it was
        the correct way to go. In case this brings any other ideas to mind, here's
        what I'm trying to acomplish. I want to create a batch/program (call it
        "Batchmaker") which creates batch files on demand using this logic:

        1. In Windows Explorer, user manually migrates to a folder and copies the
        destination path from the Explorer address bar to the clipboard. String
        copied will be something like, "J:\clients\CCCC clientname\MMMM
        mattername"
        where CCCC and MMMM are a four digit number and clientname and mattername
        are alpha descriptions. If Ken Mazie is client 1500 and his lawsuit
        against
        IBM is the 3rd case we're doing for him, his files might be found in
        "J:\clients\1500 Mazie, Ken\0003 Mazie vs. IBM."

        2. Start batchmaker.

        3. Batchmaker accepts text string containing the desired path from windows
        clipboard and saves it as variable1.

        4. Batchmaker parses the string to create variable2 in the form CCCC.MMMM.
        If variable1 is "J:\clients\1500 Mazie, Ken\0003 Mazie vs. IBM" then
        variable 2 should be "1500.0003."

        5. Batchmaker writes a plain text file which contains "explorer.exe
        [variable1]" and saves it to J:\tmw4\batch as CCCC.MMMM.bat. In this case,
        as 1500.0003.bat.

        We have a database which tracks all of our lawsuits. You can put a
        batchfile
        name in a field and it will run it on demand. When I look at a case record
        in the dB, I want to be able to execute a batch file which open a windows
        explorer session to the folder which contains all the lawsuit's electronic
        files. It's part of a poor man's document management system.

        My apologies to those bored silly by this post.

        Gray Strickland

        > -----Original Message-----
        > From: Kenneth.C.Mazie@... [mailto:Kenneth.C.Mazie@...]
        > Sent: Wednesday, July 31, 2002 4:45 PM
        > To: gray.strickland@...
        > Cc: batchworld@yahoogroups.com
        > Subject: Re: [BATCH WORLD] Accepting Input from Windows Clipboard
        >
        >
        > Gray,
        > I haven't found any direct means of getting text from the clipboard in a
        > batch file without an outside application.
        >
        > Don't know if you want to go this route or not. We use a program here
        > called "WinBatch" which is actually a Windows programming language. You
        > create executable files with it and it's quite powerfull. We use it to
        > customize our server build process. It has a ton of functionality in
        > Windows, the only disadvantage is that you need to do a bit of simple
        > programming to create anything. The help files are very concise
        > and their
        > web site has a great knowledge base. If you don't mind buying the
        > program and creating a compiled executable to handle your clipboard text
        > go look at it at http://www.winbatch.com
        >
        > Ken Mazie MCSE/CNE
        > Kaiser Permanente Server Engineering
        > ===========================================
        >
        >
        >
        >
        >
        >
        > "Gray M. Strickland" <gray.strickland@...>
        > 07/30/2002 07:07 PM
        > Please respond to batchworld
        >
        >
        > To: <batchworld@yahoogroups.com>
        > cc:
        > Subject: [BATCH WORLD] Accepting Input from
        > Windows Clipboard
        >
        >
        > What is the best way to write a batch file which pauses to accept input
        > from
        > the Windows Clipboard (ctrl-v), then displays when it received for
        > verification before proceeding? The input from the Clipboard will always
        > be
        > pure text -- or at least any valid input will be pure text.
        >
        >
        >
        >
        > To Post a message, send it to: batchworld@...
        >
        > To Unsubscribe, send a blank message to:
        > batchworld-unsubscribe@...
        >
        > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
        >
        >
      • Michael Marquart
        Gray, Get Clip V2.2 from http://www.cmdtools.com/ and GnuSED V3.02.80 from http://www.student.northpark.edu/pemente/sed/
        Message 3 of 8 , Aug 1, 2002
        • 0 Attachment
          Gray, Get Clip V2.2 from http://www.cmdtools.com/
          and GnuSED V3.02.80 from http://www.student.northpark.edu/pemente/sed/
          http://www.student.northpark.edu/pemente/sed/sed3028a.zip

          Use them with this script and it should do as you wish.
          Lines commencing in column 1 have wrapped from the previous line.

          This uses a W2K+ input routine - other OS's will need modification for the
          user data verification portion.


          @echo off
          clip clientcase.txt /r
          sed 's/\(.*\)/set cs1=\1\n/'<clientcase.txt>clientcase.bat
          sed 's/.*clients\\\(....\).*\\\(....\).*/set cs2=\1.\2\n/'
          <clientcase.txt>>clientcase.bat
          call clientcase.bat
          del clientcase.bat
          cls
          echo The client path is "%cs1%"
          echo The client data is "%cs2%"
          echo.
          set /p input=is this correct? (Y/N and enter)
          echo.
          if not "%input%"=="Y" if not "%input%"=="y" echo Aborted, start over.
          if not "%input%"=="Y" if not "%input%"=="y" goto done
          echo "explorer.exe %cs1%">J:\tmw4\batch\%cs2%.bat
          echo %cs2%.bat created
          del clientcase.txt
          :done
          set input=
          set cs1=
          set cs2=



          On Thu, 1 Aug 2002 10:21:06 -0500, "Gray M. Strickland"
          <gray.strickland@...> wrote:

          >I don't mind buying something. Heck, I'd buy VB if I really thought it was
          >the correct way to go. In case this brings any other ideas to mind, here's
          >what I'm trying to acomplish. I want to create a batch/program (call it
          >"Batchmaker") which creates batch files on demand using this logic:
          >
          >1. In Windows Explorer, user manually migrates to a folder and copies the
          >destination path from the Explorer address bar to the clipboard. String
          >copied will be something like, "J:\clients\CCCC clientname\MMMM mattername"
          >where CCCC and MMMM are a four digit number and clientname and mattername
          >are alpha descriptions. If Ken Mazie is client 1500 and his lawsuit against
          >IBM is the 3rd case we're doing for him, his files might be found in
          >"J:\clients\1500 Mazie, Ken\0003 Mazie vs. IBM."
          >
          >2. Start batchmaker.
          >
          >3. Batchmaker accepts text string containing the desired path from windows
          >clipboard and saves it as variable1.
          >
          >4. Batchmaker parses the string to create variable2 in the form CCCC.MMMM.
          >If variable1 is "J:\clients\1500 Mazie, Ken\0003 Mazie vs. IBM" then
          >variable 2 should be "1500.0003."
          >
          >5. Batchmaker writes a plain text file which contains "explorer.exe
          >[variable1]" and saves it to J:\tmw4\batch as CCCC.MMMM.bat. In this case,
          >as 1500.0003.bat.
          >
          >We have a database which tracks all of our lawsuits. You can put a batchfile
          >name in a field and it will run it on demand. When I look at a case record
          >in the dB, I want to be able to execute a batch file which open a windows
          >explorer session to the folder which contains all the lawsuit's electronic
          >files. It's part of a poor man's document management system.
          >
          >My apologies to those bored silly by this post.
          >
          >Gray Strickland
        • Gray M. Strickland
          Michael, Thank you. I d like to understand what you wrote. The files which were in the SED zip are not viewable -- at least not easily viewable in Notepad. The
          Message 4 of 8 , Aug 1, 2002
          • 0 Attachment
            Michael,

            Thank you. I'd like to understand what you wrote. The files which were in
            the SED zip are not viewable -- at least not easily viewable in Notepad. The
            text is readable, but clearly the author meant the files (e.g. readme,
            sed.info and sed.man) to be viewed in some other way. I assume that one of
            these files documents all of the SED options and commands. If I could read
            teh manual, I could understand what you wrote.

            Again, thank you.

            Gray Strickland

            > -----Original Message-----
            > From: Michael Marquart [mailto:micm@...]
            > Sent: Thursday, August 01, 2002 1:33 PM
            > To: batchworld@yahoogroups.com
            > Subject: Re: [BATCH WORLD] Accepting Input from Windows Clipboard
            >
            >
            >
            > Gray, Get Clip V2.2 from http://www.cmdtools.com/
            > and GnuSED V3.02.80 from http://www.student.northpark.edu/pemente/sed/
            > http://www.student.northpark.edu/pemente/sed/sed3028a.zip
            >
            > Use them with this script and it should do as you wish.
            > Lines commencing in column 1 have wrapped from the previous line.
            >
            > This uses a W2K+ input routine - other OS's will need modification for the
            > user data verification portion.
            >
            >
            > @echo off
            > clip clientcase.txt /r
            > sed 's/\(.*\)/set cs1=\1\n/'<clientcase.txt>clientcase.bat
            > sed 's/.*clients\\\(....\).*\\\(....\).*/set cs2=\1.\2\n/'
            > <clientcase.txt>>clientcase.bat
            > call clientcase.bat
            > del clientcase.bat
            > cls
            > echo The client path is "%cs1%"
            > echo The client data is "%cs2%"
            > echo.
            > set /p input=is this correct? (Y/N and enter)
            > echo.
            > if not "%input%"=="Y" if not "%input%"=="y" echo Aborted, start over.
            > if not "%input%"=="Y" if not "%input%"=="y" goto done
            > echo "explorer.exe %cs1%">J:\tmw4\batch\%cs2%.bat
            > echo %cs2%.bat created
            > del clientcase.txt
            > :done
            > set input=
            > set cs1=
            > set cs2=
            >
            >
            >
            > On Thu, 1 Aug 2002 10:21:06 -0500, "Gray M. Strickland"
            > <gray.strickland@...> wrote:
            >
            > >I don't mind buying something. Heck, I'd buy VB if I really
            > thought it was
            > >the correct way to go. In case this brings any other ideas to
            > mind, here's
            > >what I'm trying to acomplish. I want to create a batch/program (call it
            > >"Batchmaker") which creates batch files on demand using this logic:
            > >
            > >1. In Windows Explorer, user manually migrates to a folder and copies the
            > >destination path from the Explorer address bar to the clipboard. String
            > >copied will be something like, "J:\clients\CCCC clientname\MMMM
            > mattername"
            > >where CCCC and MMMM are a four digit number and clientname and mattername
            > >are alpha descriptions. If Ken Mazie is client 1500 and his
            > lawsuit against
            > >IBM is the 3rd case we're doing for him, his files might be found in
            > >"J:\clients\1500 Mazie, Ken\0003 Mazie vs. IBM."
            > >
            > >2. Start batchmaker.
            > >
            > >3. Batchmaker accepts text string containing the desired path
            > from windows
            > >clipboard and saves it as variable1.
            > >
            > >4. Batchmaker parses the string to create variable2 in the form
            > CCCC.MMMM.
            > >If variable1 is "J:\clients\1500 Mazie, Ken\0003 Mazie vs. IBM" then
            > >variable 2 should be "1500.0003."
            > >
            > >5. Batchmaker writes a plain text file which contains "explorer.exe
            > >[variable1]" and saves it to J:\tmw4\batch as CCCC.MMMM.bat. In
            > this case,
            > >as 1500.0003.bat.
            > >
            > >We have a database which tracks all of our lawsuits. You can put
            > a batchfile
            > >name in a field and it will run it on demand. When I look at a
            > case record
            > >in the dB, I want to be able to execute a batch file which open a windows
            > >explorer session to the folder which contains all the lawsuit's
            > electronic
            > >files. It's part of a poor man's document management system.
            > >
            > >My apologies to those bored silly by this post.
            > >
            > >Gray Strickland
            >
            >
            >
            > To Post a message, send it to: batchworld@...
            >
            > To Unsubscribe, send a blank message to:
            > batchworld-unsubscribe@...
            >
            > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
            >
            >
          • Michael Marquart
            Manual sent via direct email. On Thu, 1 Aug 2002 14:43:28 -0500, Gray M. Strickland ... You re welcome. The manual is formatted for a Unix/Linux viewer - I
            Message 5 of 8 , Aug 2, 2002
            • 0 Attachment
              Manual sent via direct email.

              On Thu, 1 Aug 2002 14:43:28 -0500, "Gray M. Strickland"
              <gray.strickland@...> wrote:

              >Thank you. I'd like to understand what you wrote. The files which were in
              >the SED zip are not viewable -- at least not easily viewable in Notepad. The
              >text is readable, but clearly the author meant the files (e.g. readme,
              >sed.info and sed.man) to be viewed in some other way. I assume that one of
              >these files documents all of the SED options and commands. If I could read
              >teh manual, I could understand what you wrote.

              >Again, thank you.

              You're welcome. The manual is formatted for a Unix/Linux viewer - I wrote
              a small tool that reformats them as regular text and is the format I sent.

              I assume the SED portion is the part that has you curious.
              The two SED lines write a batch file with a SET var=text statement each.
              Each statement uses the sed text substitution syntax 's/oldtext/newtext/'

              This is the contents of the clipboard that I tested it with:
              J:\clients\CCCC clientname\MMMM mattername

              sed 's/\(.*\)/set cs1=\1\n/'<clientcase.txt>clientcase.bat

              This line takes the entire line .* from clientcase.txt and places it within
              a back reference \(\) where the \ is an escape character that identifies
              the character following as a "formatting" command.
              It replaces the oldtext with set cs1= and then the first back reference \1
              and then a newline \n (and there is only the one back reference here)

              The period in .* refers to any character, including no characters, and * is
              all following characters.

              sed 's/.*clients\\\(....\).*\\\(....\).*/set cs2=\1.\2\n/'
              <clientcase.txt>>clientcase.bat

              In this line a similar process takes place except two backreferences are
              used and this time they are defined as a portion of the input string.
              .*clients\\ is all text from the beginning of the string up to clients\
              remebering that \ is an escape character and must be duplicated to get a
              single literal \

              That is followed by 4 characters which comprises the first back reference
              \(....\)

              The nest portion is .*\\ which reads as "all text up until the LAST \
              character" (as SED is greedy in it's matches and will always match the
              greatest number of characters) which in this case is simply the next \

              That is followed by 4 characters which comprises the second back reference,
              which is then followed by the rest of the line .*

              The replacement portion is simply set cs2= followed by the two back
              references separated by a period (the period has no special significance in
              the replacement portion of the s command) and followed by a newline \n.
              BTW, the text .*clients\\ is case sensitive in this batch.


              Howzat?

              --
              Regards,
              Michael
            Your message has been successfully submitted and would be delivered to recipients shortly.