Skip to content

Instantly share code, notes, and snippets.

@sheldonhull
Created January 21, 2015 19:32
Show Gist options
  • Save sheldonhull/01631b28176f71ce4789 to your computer and use it in GitHub Desktop.
Save sheldonhull/01631b28176f71ce4789 to your computer and use it in GitHub Desktop.
Monitors clipboard for ssms statistics IO being copied and opens URL, pastes, and submits so the results can be easily used
#SingleInstance force
#NoEnv
#Persistent
SetWorkingDir %A_ScriptDir%
SetTitleMatchMode, Slow
SetTitleMatchMode,2
DetectHiddenWindows, On
DetectHiddenText, On
SendMode, Input
return
; RUN THE HELPER FOR GUIDE ON HOTKEYS/HELPERS
GroupAdd, SSMSGroup, SQL
GroupAdd, SSMSGroup, Microsoft SQL Server Management Studio
GroupAdd, SSMSGroup, Microsoft SQL Server Management Studio
GroupAdd, SSMSGroup, ahk_class HwndWrapper[
#IfWinExist, SSMSGroup
OnClipboardChange:
IfInString, Clipboard, Scan count
{
BlockInput, On
RunWait, "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --app=http://statisticsparser.com/index.html, , Max, OutputVarPID ; this is the checkbox right before the field input to... thus one tab to allow input
Sleep, 2000
WinActivate, Statistics Parser
WinSet, AlwaysOnTop, On , Statistics Parser ; this helps ensure it always flips to the top
Loop 8
{
SendInput, {Tab}
sleep 50
}
CleanupInput := Clipboard
Clipboard = ; frees memory
CleanupInput := RegExReplace(CleanupInput, "im)_" ,"") ; for temp tables, remove the really long underscored name seperator for readability
Clipboard = %CleanupInput%
ClipWait, 2, 1
SendInput, ^v ; paste results instead of "inputting values", much faster
Sleep, 1000
Clipboard = ; free memory again
SendInput, {Tab} ; go to the submit button
SendInput, 500
SendInput, {Enter} ; submit
BlockInput, Off
WinSet, AlwaysOnTop, Off , Statistics Parser ; flip back the properties of window to allow to be in background
return
#IfWinActive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment