{"id":22,"date":"2008-03-27T16:09:37","date_gmt":"2008-03-27T06:09:37","guid":{"rendered":"http:\/\/chuchuva.com\/pavel\/2008\/03\/how-to-insert-new-guid-with-one-key-press\/"},"modified":"2009-12-10T14:26:30","modified_gmt":"2009-12-10T04:26:30","slug":"how-to-insert-new-guid-with-one-key-press","status":"publish","type":"post","link":"https:\/\/chuchuva.com\/pavel\/2008\/03\/how-to-insert-new-guid-with-one-key-press\/","title":{"rendered":"How to insert new GUID with one key press"},"content":{"rendered":"<p>When I work with <a href=\"http:\/\/wix.sourceforge.net\/\">WiX<\/a> source code I need to create lots of GUIDs. In my Visual Studio 2005 editor all I need to do is to press Alt+G and new GUID magically appears at the cursor. Achieving this is very easy:<\/p>\n<ol>\n<li> Open Macros IDE by selecting Tools | Macros | Macros IDE.<\/li>\n<li>Create new macro:<\/li>\n<p style=\"margin: 0.3em 0pt 0pt\"><span style=\"font-size: 10pt\">Public<\/span><span style=\"font-size: 10pt\"> <span style=\"color: blue\">Sub<\/span> InsertGuid()<\/span><\/p>\n<p style=\"margin: 0pt\"><span style=\"font-size: 10pt\">    DTE.ActiveDocument.Selection.Text = Guid.NewGuid().ToString()<\/span><\/p>\n<p style=\"margin: 0pt 0pt 0.3em\"><span style=\"font-size: 10pt\">End<\/span><span style=\"font-size: 10pt\"> <span style=\"color: blue\">Sub<o:p><\/o:p><\/span><\/span><\/p>\n<li>Bind new macro to <strong>Alt+G<\/strong> keyboard shortcut. Open Options dialog, select Environment, then Keyboard on the left. Type &#8220;<strong>InsertGuid<\/strong>&#8221; to locate the macro you just created. Assign Alt+G to it.<br \/>\n<img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/chuchuva.com\/pavel\/images\/2008\/03\/vs-keyboard.gif?w=604\" \/><br \/>\nFortunately, no standard command is assigned to Alt+G by default.<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>When I work with WiX source code I need to create lots of GUIDs. In my Visual Studio 2005 editor all I need to do is to press Alt+G and new GUID magically appears at the cursor. Achieving this is very easy: Open Macros IDE by selecting Tools | Macros | Macros IDE. Create new &hellip; <a href=\"https:\/\/chuchuva.com\/pavel\/2008\/03\/how-to-insert-new-guid-with-one-key-press\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">How to insert new GUID with one key press<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[8],"tags":[],"class_list":["post-22","post","type-post","status-publish","format-standard","hentry","category-develop"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/chuchuva.com\/pavel\/wp-json\/wp\/v2\/posts\/22","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chuchuva.com\/pavel\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chuchuva.com\/pavel\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chuchuva.com\/pavel\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/chuchuva.com\/pavel\/wp-json\/wp\/v2\/comments?post=22"}],"version-history":[{"count":0,"href":"https:\/\/chuchuva.com\/pavel\/wp-json\/wp\/v2\/posts\/22\/revisions"}],"wp:attachment":[{"href":"https:\/\/chuchuva.com\/pavel\/wp-json\/wp\/v2\/media?parent=22"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chuchuva.com\/pavel\/wp-json\/wp\/v2\/categories?post=22"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chuchuva.com\/pavel\/wp-json\/wp\/v2\/tags?post=22"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}