Skip to content

Instantly share code, notes, and snippets.

@JamoCA
Last active August 22, 2019 17:48
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 JamoCA/94f3eae71c2d7cc52682f62c7cd3e984 to your computer and use it in GitHub Desktop.
Save JamoCA/94f3eae71c2d7cc52682f62c7cd3e984 to your computer and use it in GitHub Desktop.
AutoHotKey script to prepends a prompted tablename variable to a list of SQL field names or variables from the clipboard.
; 20190822 https://gamesover2600.tumblr.com/post/187192578144/sql-macros-using-autohotkey-windows
; CTRL+Q prepends a tablename to list of SQL field names or variables from the clipboard.
; (Copy the column names from a query and this script will remove extra spaces and prepend user-defined tablename to each column.)
^q::
InputBox, UserInput, Prepend Scope To List, Enter variable scope., ,300 ,125 , , , ,2147483, a
if ErrorLevel
RETURN
else
AutoTrim, on
string = %clipboard%
string := RegExReplace(string, "\t", "")
string := RegExReplace(string, "(\s)+", " ")
newScope := A_Space UserInput "."
string := StrReplace(Trim(string), A_Space, newScope)
clipboard := Trim(newScope string)
SendInput ^v
RETURN
#IfWinActive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment