SlickEdit Community

SlickEdit Product Discussion => SlickEditĀ® => Slick-CĀ® Macro Programming => Topic started by: robgreen on July 29, 2006, 03:33:29 am

Title: uuidgen
Post by: robgreen on July 29, 2006, 03:33:29 am
I need to generate 100's of guids all the time.. right now i run uuidgen then right click, then paste into slickedit.  i would either like a uuidgen type macro, or someone to tell me how to execute uuidgen and get its output into the clipboard so i can paste it.  i looked at shell() but that doesnt appear to redirect to clipboard.

thanks,
rob
Title: Re: uuidgen
Post by: gary_ash on July 29, 2006, 03:00:37 pm
I wrote an extension dll to insert GUIDs that you may be able to modify
http://www.wideopenwest.com/~gary_ash/SlickMisc.zip
Title: Re: uuidgen
Post by: hs2 on July 29, 2006, 03:51:54 pm
Here we go ...
Code: [Select]
_command int uuid ()
{
   _str cmdline = maybe_quote_filename ( "C:\\Programme\\Microsoft Visual Studio .NET 2003\\Common7\\Tools\\uuidgen.exe" ) " > uuid.gen";
   // shell (cmdline,"W"); // strange: 'W' MUST be specified, otherwise 0-byte file is created
   // anyway better to use concur_command() to see what's going on
   concur_command (cmdline, false, true, false, false);
   // sleep 5 * 100ms to 'sync' to execution
   delay(5);

   int orig_wid=p_window_id;
   int temp_view_id,orig_view_id;
   int status=_open_temp_view('uuid.gen',temp_view_id,orig_view_id);
   if (!status)
   {
      top();
      _str uuid;
      get_line(uuid);
      // 'surround with' if needed
      uuid = '{' uuid '}';

      push_clipboard_itype ('CHAR','',1,true);  // use e.g. 'LINE' type to get another paste-behaviour
      append_clipboard_text (uuid);

      _delete_temp_view(temp_view_id);
      p_window_id=orig_wid;

      // add some 'feedback'
      _beep ();
   }
   return(status);
}

Bind to a key and tell me your uuid/minute rate ;)

HS2
Title: Re: uuidgen
Post by: hs2 on July 29, 2006, 03:57:46 pm
Thanks for sharing it gary_ash !
[thumb-up]
HS2
Title: Re: uuidgen
Post by: Matthew on July 31, 2006, 05:26:27 pm
I posted a pure Slick-C version that I wrote a couple of months ago in a new top-level topic.
http://community.slickedit.com/index.php?topic=202 (http://community.slickedit.com/index.php?topic=202)
Title: Re: uuidgen
Post by: robgreen on August 01, 2006, 01:22:10 am
ok, maybe i am a little thick, but how do i call the function in the dll from slickc?  this is all the help for slickC says..  iow no help..

"DLL interface
SlickEdit products have a DLL interface for Windows. Use the Slick-C macro language instead of the DLL interface except when you need an interface to the DLL in another program, when better speed is needed, or when the Slick-C macro language is missing a function that you want.

After a DLL function is added, call it from a Slick-C macro just like any other Slick-C function. DLL functions can be used for timer call backs and anyplace a Slick-C function is used.

To get started using the DLL interface, edit the simple.c file in the <vslick>\samples\simple directory. The VSAPI functions have the prefix vs.
Title: Re: uuidgen
Post by: gary_ash on August 01, 2006, 03:48:56 pm
you call a dll function just like any other

example:

InsertGUID();

once you execute a dload on the dll functions that it exports really do act just like they're build into Slick-C

if you're still working on the same problem that started this thread I'd suggest you try using the Slick-C guid generator that Matthew wrote. his code will help you generate the bunches of guids that you need I wrote my handle my need to generate the one or two at a time that I some times need