• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1457
  • Last Modified:

I would like an md5 sum or something like it for what is in the clipboard

I have a serices of error codes that come in 5 cells of a table ( in word) .  

there is NOT someting unique in any cell however all 5 cells together are unique.  

I need to Name a fix script and I was hopng that I could copy all 5 cells, right click and produce a number which would be the name of the fix for the error name that spans these 5 cells.

I can not however show you the table.  It is just 5 cells with stuff in them.
1 Solution
I am not sure if I am understand your question, but this prior Expert Exchange thread may help you out.  I don't know of something that's out there that you can just install and right click, but with VB scripting you are able to write the functionality you want within the world of MS apps.

TIMFOX123Author Commented:
Wow, that is not something I reall want to explore.

Ideally I would like to select text, bye <control><C> to copy it.
md5 sum the text
paste the md5sum of the text on the line after the text.

btanExec ConsultantCommented:
Some links to share
- selecting cell and copy into clipboard @ http://excel.bigresource.com/Track/excel-wqTVZRRF/
- clipboard script @ http://www.everythingaccess.com/tutorials.asp?ID=Copying-data-to-and-from-the-Clipboard-%28Acc-95%2B%29
- another similar to above - see the second page (or post #11) @ http://excel.bigresource.com/Track/excel-Feg4TJyz/ 
- VBscript of md5 @ http://www.lazygame.com/forum/viewthread.php?tid=83

possibly have them as macro in your working document and called it upon selection - passing in the strings for generating hash
but the challenge is that the hash need to store somewhere for verifications, maybe another separate file
SMB Security Just Got a Layer Stronger

WatchGuard acquires Percipient Networks to extend protection to the DNS layer, further increasing the value of Total Security Suite.  Learn more about what this means for you and how you can improve your security with WatchGuard today!

TIMFOX123Author Commented:
OK, I am going to be jiggy with the vpscript.   I know you have people there that love to do it.

Can someone scratch me up a simple script ( I can understand ) that I can simply REPLACE the contents of the with the md5sum of it.

I would copy to the clipboard.
click on an icon of the script created for me..
Now I can paste the md5 sum of what used to be in the clipboard.

I will be in word however the script can stand alone or not.  

I really need to learn this office scripting.  

TIMFOX123Author Commented:
actually the script would work better for me as a stand alone.
It's own icon.

TIMFOX123Author Commented:
Also it does not need to be an md5sum,  any hash would do.
TIMFOX123Author Commented:
cool thx

Is there only one line in the Word table?
Do you really need to use the clipboard?

Please create two Word documents with fake data and post it to this thread.  These documents would be the before and after of what you need.

As long as the code knows what you need, I suggest using Crypto API in VBA environment to generate the hash value which would then be inserted into the document.

I've used Ken Isaac's libraries in my applications:
TIMFOX123Author Commented:
Cool stuff. however I am not that good with vbscript.  Have not really figured out how to run it on my system.

Found an intresting read


I just want to take info into the clipboard and replace it with it's md5sum

I create the document and would like to have the option of using it other places.  I would like to have it more freestanding if possable.  

TIMFOX123Author Commented:
Here is an example of the 4 cells in text format ( it will produce a unique string using md5sum)

Unowned GID      Red      None      / etc / opt /license      :: 5551212
please answer my questions
TIMFOX123Author Commented:
Is there only one line in the Word table?  
the line waps around and it is not somethign you can depend on.  it is mutliple cells

Do you really need to use the clipboard?
I would really perfer it.  That way I can us it on the web page that produces it or I can use it in the word doc where I paste the same information.  

the clip board is the the only way I can think of making it truely portable.

Any sugesttions.  ?  I want to be able to do an md5 sum and the real objective it so call a unix shell script that fixes the issue.  I do not want it fully automated because I really need to verify the script needs to be run and if so, then run it.  

You can get the clipboard contents in two ways, API call and through the MSforms dataobject.

A decent API article with example code is here:

Below is a function that will return the text in the clipboard.  This code requires you to add a reference to the Microsoft Forms 2.0 library (Tools | References).  If you don't see it in your list, then click the Browse button and select FM20.DLL

You could also do the hashing of the string as well as repopulate the clipboard via the
objDataObject.SetText  'followed by the new text

Open in new window


Option Explicit

Public Function GetClipboardText() As String
    Dim objDataObject As New MSForms.DataObject
    Dim strCB As String
    strCB = objDataObject.GetText
    GetClipboardText = strCB
End Function

Open in new window

TIMFOX123Author Commented:

this cleary looks like we are in a good direction.  The issue is that I do not know how to impliment this script.  Back in the day I used to write wsh / vbscipt and all I did was put the information in a .vbs file.  

How does this work  ?

Can I do an md5sum on the clipboard ?

Thank you so much for helping me.  Where you are strong, I am not.  

This all runs in the Word environment.  Once you have the desired code, you would click a button that would invoke this 'macro' VBA code.

This is not done in a VBScript environment.

Please look at the various hashing links and play with the code.  Once you have the contents of the clipboard in a string variable, you can pass that to a hashing function.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Managed Security Services Webinar - March 15

Selecting the right managed security services platform to grow your business can be a huge undertaking. Join WatchGuard and Frost & Sullivan in an upcoming webinar as we dive into the key elements of selecting a vendor platform and partnership to fuel a successful MSSP business.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now