Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Done Function to create GUID

Dec
238
2
I can (and often do) generate a GUID and get it into a variable this way:

set xyzzy=%@execstr[uuidgen.exe]

Or, as often as not, like this:

set xyzzy=%@upper[%@replace[-,,%@execstr[uuidgen.exe]]]

But of course that calls for always having UUIDGEN on tap. If there's some other tool for this other than ActiveState's Perl, with its Win32 extensions, I haven't run across it.

Any chance of ever having a variable function such as %@guid[], which would immediately generate it? The frosting on the cake would be switches for returning the GUID in upper- or lower-case, and with or without hyphens separating the number groups.
 
If there's some other tool for this other than ActiveState's Perl, with its Win32 extensions, I haven't run across it.

Every Windows system, from XP forward, comes with VBC.EXE, which is the Visual Basic Compiler for .NET. I have mine aliased as follows;

Code:
which vbc
vbc is an alias : c:\Windows\Microsoft.NET\Framework\v4.0.30319\vbc.exe

You can create your own GUID generator with the following VB.NET code;

Code:
Imports System

Class Sample
  Public Shared Sub Main()
  Dim g As Guid
  g = Guid.NewGuid()
  Console.WriteLine(g)
  End Sub 'Main
End Class 'Sample

Save the code as guid.bas, and execute the following;

Code:
vbc guid.bas

This will create the file guid.exe, which you can use to create your own unique guid.

Joe
 
Joe:
Could someone more familiar with VBC etc. than I am use your code above as the framework for a plugin, instead of creating an external executable? Of course, while we do not usually think of them that way, plugins are actually also externals, so the function would still use an external, just a different type (and the load time delay, if any, would occur at a different time).
 
Updated: https://sites.google.com/site/jlcprogrammingstuff/home/tcc/jlcguid

Contains the @guid[] variable function, and the guid command.

guid -h

UUID Generator v2013.10 Build 14

usage: guid [-cdh]
c - Output GUID in upper case
d - Remove Hyphens
h - Display command option summary


echo @guid[] returns a UUID in uppercase, with hyphens, and {} braces.

Joe
 
Thanks! But a simple request - TCC's defaults to slash "/", just like CMD's, as the option prefix, not the POSIX-style hyphen. My own few utilities accept both (they predate TCC). Most plugins which process commands with options expect the slash...
 
Thanks. Talk about instant gratification. : ) ... a few minutes later ... not having used 4NT or TCC plugins before, I guess I need to do some catching-up. I made a PLUGINS subdirectory of the install directory for TCC, added the new DLL to it, and closed and launched TCC.

c:\takecommand> echo %@guid[]

produced an error message about an incorrect function. Ok, let's load the DLL manually.

plugin /L plugins\jlcGuid.dll

Result: TCC: (Sys) plugins\jlcGuid.dll is not a valid Win32 application.

or in case TCC assumes you've used a PLUGINS subdirectory:

plugin /L jlcGuid.dll (same result)

...and echo %@guid[] had the same result as earlier

So -- there must be some simple step I'm omitting here...
 
Last edited:
Thanks. Talk about instant gratification. : ) ... a few minutes later ... not having used 4NT or TCC plugins before, I guess I need to do some catching-up. I made a PLUGINS subdirectory of the install directory for TCC, added the new DLL to it, and closed and launched TCC.

c:\takecommand> echo %@guid[]

produced an error message about an incorrect function. Ok, let's load the DLL manually.

plugin /L plugins\jlcGuid.dll

Result: TCC: (Sys) plugins\jlcGuid.dll is not a valid Win32 application.

Works here. Are you by any chance using a 64-bit build of TCC?
 
Maybe, during your download of the file, it became corrupt?

Delete the jlcGuid.dll and jlcGuid.zip, and download the file again.

This may not be the problem, but it will eliminate one possibility.

Joe
 
The compiler that I use is 32-bit, and the company has no plans to make a 64-bit version of their compiler.

If you want, I can make a 32-bit .EXE version of the plugin for you.

Joe
 
Interesting decision on their part, given that 64-bit devices seem to be taking over. I appreciate the offer. I think I'm good with what I have, because I also have 4NT on a creaky old WinXP box, and I would think the DLL will work with that version.
 
Interesting decision on their part, given that 64-bit devices seem to be taking over.

Since Bob Zale passed away, I'm not sure what direction PowerBASIC is taking. There have been assurances from his wife, Vivian Zale, that they are "preparing to launch new and innovative products", but I remember a year ago Bob saying that, since PowerBASIC is written in assembler, it is quite the task to create "new development syntax for hundreds of thousands of lines of assembler code. New generated machine code. New calling conventions. New optimization techniques. New register preservation."

Bob Zale was PowerBASIC, and I will just have to wait and see what happens.

Joe
 

Similar threads

Back
Top