Last active
August 22, 2019 17:48
-
-
Save JamoCA/7737c8a18e1cfd7a6aecd79a19a96e03 to your computer and use it in GitHub Desktop.
AutoHotKey script to convert a column of clipboard data (copied from Excel, Word, Outlook, text file, etc) to a SQL list for use in a IN() query.
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
; 20190822 https://gamesover2600.tumblr.com/post/187192578144/sql-macros-using-autohotkey-windows | |
^+l:: ;CTRL+Shift+L Takes clipboard and converts tab-delimited data to SQL-compatible comma-delimited row (adds single quotes if data consists of non-numeric values) | |
StringReplace,clipboard,clipboard,`n,`,,All | |
StringReplace,clipboard,clipboard,`r,,All | |
StringGetPos, pos, clipboard, ID`, ; remove "ID" if it is the first item in the list. | |
if pos = 0 | |
StringRight, clipboard, clipboard, StrLen(clipboard)-3 | |
testString = %clipboard% | |
StringReplace,testString,testString,`,,,All | |
testString := testString * 1 | |
if (testString is integer) { | |
} else { | |
StringReplace,clipboard,clipboard,`,,'`,',All | |
clipboard = '%clipboard%' | |
} | |
Send,^v | |
Return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment