Skip to content

Instantly share code, notes, and snippets.

@Lokno
Last active August 29, 2015 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Lokno/bfa4b2405f213f05e9d9 to your computer and use it in GitHub Desktop.
Save Lokno/bfa4b2405f213f05e9d9 to your computer and use it in GitHub Desktop.
Autohotkey Script for trimming bar codes
; Pause : ctrl+a, ctrl+c , delete prefix, ctrl+v
; Home : delete the prefix
; Esc : close the running script
prefixLength := 8
codeLength := 30
remainder := codeLength-prefixLength
TrimBarCode()
{
global prefixLength
global remainder
clipboard := RegExReplace( clipboard, "^\d{" . prefixLength . "}(\d{" . remainder . "})$", "$1" )
}
Esc::ExitApp
Pause::
SendInput ^a
SendInput ^c
TrimBarCode()
SendInput ^v
return
$Home::
SendInput {Home}
Loop, %prefixLength%
{
SendInput +{Right}
}
SendInput {Backspace}
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment