Mart
(KiX Supporter)
2006-02-10 10:43 AM
Scripting GUIDGen.exe

Guy's,

I started messing around with a script that creates buttons and/or menu items in IE. MS has a tutorial on this. In the tutorial the GUIDGen.exe tool is used to create a GUID. Is it possible to script the workings of GUIDGen.exe? All other stuff is just simple registry writes but a new GUID is needed before any registry writes can be done. Never did anything with calling an API from a script so I have no idea where to start.

Adding Toolbar Buttons to IE
Adding Menu Items to IE
Get GUIDGen.exe here

A registry suitable GUID to use within kix is what I'm looking for.

A quote from the readme included in the download.
Quote:


The GUID Generator component lets you generate globally unique identifiers, or GUIDs, that you can use to identify your Microsoft® ActiveX® classes, objects, and interfaces. GUIDGen does this by calling the CoCreateGuid application programming interface (API) function to generate a new GUID. The resulting GUID is copied to the Clipboard in one of four formats for insertion into your application’s source code.

The four formats are:
•Defined in an IMPLEMENT_OLECREATE macro, which allows instances of a CCmdTarget-derived class to be created by Automation clients. For example:
// {CA761230-ED42-11CE-BACD-00AA0057B223}
IMPLEMENT_OLECREATE(<>, <>,
0xca761230, 0xed42, 0x11ce, 0xba, 0xcd, 0x0, 0xaa, 0x0, 0x57, 0xb2, 0x23);

•Defined using the DEFINE_GUID macro, which is commonly used in programming that does not use Microsoft Foundation Classes (MFC). For example:
// {CA761231-ED42-11CE-BACD-00AA0057B223}
DEFINE_GUID(<>, 0xca761231, 0xed42, 0x11ce, 0xba, 0xcd, 0x0, 0xaa, 0x0, 0x57, 0xb2, 0x23);

•Declared as a statically allocated structure. For example:
// {CA761232-ED42-11CE-BACD-00AA0057B223}
static const GUID <> = { 0xca761232, 0xed42, 0x11ce, { 0xba, 0xcd, 0x0, 0xaa, 0x0, 0x57, 0xb2, 0x23 } };

•Specified in a form suitable for registry entries or Registry Editor scripts. For example:
{CA761233-ED42-11CE-BACD-00AA0057B223}





Richard H.Administrator
(KiX Supporter)
2006-02-10 11:12 AM
Re: Scripting GUIDGen.exe

What you actually want to script is this:
Quote:

GUIDGen does this by calling the CoCreateGuid application programming interface (API) function to generate a new GUID




This API is not part of GUIDGen - GUIDGen is just a wrapper exe to allow you to call the API.

If you search around for scripts which call coCreateGUID you should be able to find something that you can convert or use directly.

If not, post again.


Richard H.Administrator
(KiX Supporter)
2006-02-10 11:20 AM
Re: Scripting GUIDGen.exe

I thought I'd already done this, but it looks like it may not be that easy...

Richard H.Administrator
(KiX Supporter)
2006-02-10 11:49 AM
Re: Scripting GUIDGen.exe

There is a free GUID generator called GUIDMaker which has a scriptable component available here: http://www.serverobjects.com/products.htm

Download the small zip, extract the DLL, copy to your system32 directory and register it.

Once you've done that you can issue GUIDs to your heart's content.

Here's one I prepared earlier:
Code:
$sGUID=CreateObject("GuidMakr.GUID").GetGUID
"GUID="+$sGUID+@CRLF



Output:
Quote:

GUID={BA456FCA-FC6F-45D4-A72B-2C9DFAF07E89}




Mart
(KiX Supporter)
2006-02-10 11:49 AM
Re: Scripting GUIDGen.exe

I should have been clearer in my first post.

I meant to say: "scripting the workings of GUIDGen.exe". So if it calls external stuff to do the work how then to script that.

Will do some searching but if anyone has some ideas on this Id' be happy to listen.


Mart
(KiX Supporter)
2006-02-10 11:51 AM
Re: Scripting GUIDGen.exe

Will have a look at that. Going to do some testing and will be back with the results.

Thanx


Sealeopard
(KiX Master)
2006-02-11 12:58 PM
Re: Scripting GUIDGen.exe

And we even have a UDF to create a GUID: CreateGUID - Creates a GUID (globally unique identifier)

Mart
(KiX Supporter)
2006-02-13 09:15 PM
Re: Scripting GUIDGen.exe

For the current status of the project this functionality is used in have a look at the link below.

http://www.kixtart.org/ubbthreads/showflat.php?Cat=0&Number=156824&an=0&page=0&vc=1