-
-
Save mlhDevelopment/6ef44209afbccbcd3a80fcf182b17b2a to your computer and use it in GitHub Desktop.
AutoHotkey (AHK) v2 script to generate & paste a 32 character random hex string and format it like a GUID (i.e. a psuedo GUID)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Exposes two hotkeys: | |
; - Win+G generates & pastes a new lowercase psuedo guid | |
; - Win+Shift+G generates & pastes a new UPPERCASE psuedo guid | |
; In both cases, the psuedo guid is left on the clipboard so you can easily paste it more than once. | |
; NOTE: this is technically not a GUID as defined by RFC 9562 since it does not attempt to use the | |
; recommended algorithms and no timestamp is embedded. It is only a 128 bit random number formatted | |
; as 32 hex values in the 8-4-4-4-12 GUID format. | |
; Win+G - Generate and paste a psuedo GUID | |
#g:: | |
{ | |
pGuid := "" | |
Loop 8 { | |
pGuid := pGuid . Format("{:x}", Random(0, 15)) | |
} | |
pGuid := pGuid . "-" | |
Loop 4 { | |
pGuid := pGuid . Format("{:x}", Random(0, 15)) | |
} | |
pGuid := pGuid . "-" | |
Loop 4 { | |
pGuid := pGuid . Format("{:x}", Random(0, 15)) | |
} | |
pGuid := pGuid . "-" | |
Loop 4 { | |
pGuid := pGuid . Format("{:x}", Random(0, 15)) | |
} | |
pGuid := pGuid . "-" | |
Loop 12 { | |
pGuid := pGuid . Format("{:x}", Random(0, 15)) | |
} | |
A_Clipboard := pGuid | |
Send pGuid | |
} | |
; Win+Shift+G - Generate an UPPERCASE psuedo GUID | |
#+g:: | |
{ | |
pGuid := "" | |
Loop 8 { | |
pGuid := pGuid . Format("{:X}", Random(0, 15)) | |
} | |
pGuid := pGuid . "-" | |
Loop 4 { | |
pGuid := pGuid . Format("{:X}", Random(0, 15)) | |
} | |
pGuid := pGuid . "-" | |
Loop 4 { | |
pGuid := pGuid . Format("{:X}", Random(0, 15)) | |
} | |
pGuid := pGuid . "-" | |
Loop 4 { | |
pGuid := pGuid . Format("{:X}", Random(0, 15)) | |
} | |
pGuid := pGuid . "-" | |
Loop 12 { | |
pGuid := pGuid . Format("{:X}", Random(0, 15)) | |
} | |
A_Clipboard := pGuid | |
Send pGuid | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment