Patriotic Things

I put these on Facebook once and as they age they get harder to find. Re-posting them here.

“God who gave us life gave us liberty. And can the liberties of a nation be thought secure when we have removed their only firm basis, a conviction in the minds of the people that these liberties are of the Gift of God? That they are not to be violated but with His wrath? Indeed, I tremble for my country when I reflect that God is just, that His justice cannot sleep forever.” – Thomas Jefferson

“It cannot be emphasized too strongly or too often that this great nation was founded, not by religionists, but by Christians; not on religions, but on the Gospel of Jesus Christ. For this very reason peoples of other faiths have been afforded asylum, prosperity, and freedom of worship here.” – Patrick Henry

“I am sure that never was a people, who had more reason to acknowledge a Divine interposition in their affairs, than those of the United States: and I should be pained to believe that they have forgotten that agency, that was so often manifested during our Revolution, or that they failed to consider the omnipotence of that God who is alone able to protect them.” – George Washington, March 11, 1792.

“Why is it that, next to the birthday of the Savior of the world, your most joyous and most venerated festival returns on this day [July 4]? Is it not that, in the chain of human events, the birthday of the nation is indissolubly linked with the birthday of the Savior? That it forms a leading event in the progress of the Gospel dispensation? Is it not that the Declaration of Independence first organized the social compact on the foundation of the Redeemer’s mission upon earth? That it laid the cornerstone of human government upon the first precepts of Christianity?” – John Quincy Adams, July 4 1837.

“I have lived, Sir, a long time, and the longer I live, the more convincing proofs I see of this truth–that God Governs the affairs of men. And if a sparrow cannot fall to the ground without His notice, is it probable that an empire can rise without His aid?” – Benjamin Franklin

“The [fourth] day of July, 1776, will be the most memorable epoch in the history of America. I am apt to believe that it will be celebrated by succeeding generations as the great anniversary Festival. It ought to be commemorated, as the Day of Deliverance, by solemn acts of devotion to God Almighty. It ought to be solemnized with pomp and parade, with shows, games, sports, guns, bells, bonfires and illuminations, from one end of this continent to the other, from this time forward forever.” – John Adams

“A general dissolution of principles and manners will more surely overthrow the liberties of America than the whole force of the common enemy. While the people are virtuous they cannot be subdued; but when once they lose their virtue then will be ready to surrender their liberties to the first external or internal invader.” – Samuel Adams, 1779

“We have been the recipients of the choicest bounties of Heaven. We have been preserved, these many years, in peace and prosperity. We have grown in numbers, wealth and power, as no other nation has ever grown. But we have forgotten God. We have forgotten the gracious hand which preserved us in peace, and multiplied and enriched and strengthened us; and we have vainly imagined, in the deceitfulness of our hearts, that all these blessings were produced by some superior wisdom and virtue of our own. Intoxicated with unbroken success, we have become too self-sufficient to feel the necessity of redeeming and preserving grace, too proud to pray to the God that made us!” – Abraham Lincoln, upon proclaiming a National Fast Day (30 March 1863)

“I have been driven many times to my knees by the overwhelming conviction that I had nowhere else to go. My own wisdom, and that of all about me seemed insufficient for the day.” – Abraham Lincoln

“The fundamental basis of this nation’s law was given to Moses on the Mount. The fundamental basis of our Bill of Rights comes from the teaching we get from Exodus and St. Matthew, from Isaiah and St. Paul. I don’t think we emphasize that enough these days. If we don’t have the proper fundamental moral background, we will finally end up with a totalitarian government which does not believe in the right for anybody except the state.” – Harry S. Truman, February 15, 1950

AutoHotKey SQL Formatting Help

The script I posted back in (holy crap) 2012 has gotten several updates, and when I made the latest today, I decided to repost it, in case I need the updated version again later.

It binds to Win+, and when invoked presents these options for manipulating whatever text is currently in the clipboard:

1: Sort/De-Dupe (A, B, C)
2: Sort/De-Dupe + Quote (‘A’, ‘B’, ‘C’)
3: No Sort/De-Dupe (A, B, C, B)
4: No Sort/De-Dupe + Quote (‘A’, ‘B’, ‘C’, ‘B’)
5: SUM (A+B+C)
6: Prepend commas in row 2+ (A\n, B\n, C)

Use cases:
* You highlight a column of values in a recordset grid and want to copy/paste them into another select.
* You ended up with a recordset that contains duplicates and you want just the uniques without rerunning sql.
* You need to know the sum of a column without bothering to add a COMPUTE SUM() and rerunning.
* You ran sp_columns to get the list of fields in a table and now need to paste that as part of an insert to modify further.


; Lines-To-CSV.ahk
; AutoHotkey Version: 1.x
; Language: English
; Platform: Win9x/NT
; Author: A.N.Other
;
; Script Function:
; Search & Replace clipboard contents: Convert line feeds to comma+space
;
; Example:
; 1
; 2
; 3
;
; Becomes: 1, 2, 3
;

#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.

#,:: ; bind to [Win]+[,]

; Grab the current clipboard contents. Call it haystack
haystack := Clipboard

; Define what we're splitting on: CR+LF
needle := "\r\n"

; Check to see if there's any lines to convert here.
FoundPos := RegExMatch(haystack, "\r\n")
if FoundPos = 0
{
MsgBox, 64, Convert Lines to CSV, Clipboard contains no lines to convert to CSV., 2
return
}

; Prompt user for quote option
;MsgBox 3, Convert Clipboard Lines to CSV, Converting Clipboard lines to CSV`n`nWrap lines in single quotes?
;IfMsgBox Cancel
; return
;else IfMsgBox Yes
; quote := 1
;else
; quote := 0

; Can we auto-determine quote option? Get the first 10 items in the list, if they're all numeric, no quotes.
; Can always save & tweak this script as a separate hot key to force quotes.
test := RegExReplace(haystack, needle, ",")
RunParam := 1
sample :=
Loop, parse, test, `,
{
if a_index < 4 { sample := sample . A_LoopField . ", " } if A_LoopField is not number { RunParam := 2 break } if a_index > 10
break
}

; Ok, so we can auto-determine, but a week later, I've got 4 variants of this script:
; +Sorting +Auto-Quoting (Default)
; -Sorting +Auto-Quoting
; -Sorting !Quoting (anti-quoting... reverse normal quoting)
; +Sorting !Quoting
; OOOh, cool: -Sorting, !Quoting, just Add a ", " in the front and don't replace line endings.

; And I can't remember which stupid key is assigned to which stupid script. I was better off with a prompt.
; But let's make it so the default prompt option is the one we want based on the quote test above.

; 0 or blank = QUIT
; 1 = Sort Quote
; 2 = Sort Reverse Quote
; 3 = No Sort Quote
; 4 = No Sort Reverse Quote
; 5 = SUM Numbers
; 6 = No Sort No Quote, just ", "

options:="
(
1: Sort/De-Dupe (A, B, C)
2: Sort/De-Dupe + Quote ('A', 'B', 'C')
3: No Sort/De-Dupe (A, B, C, B)
4: No Sort/De-Dupe + Quote ('A', 'B', 'C', 'B')
5: SUM (A+B+C)
6: Prepend commas in row 2+ (A\n, B\n, C)
)"

; Prompt user for quote option
InputBox, RunParam, Convert line to CSV, % options , ,375,220, , , , , %RunParam%
if ErrorLevel
return
else {
if RunParam = 1
{
vSort := 1
quote := 0
vAdd := 0
vPre := 0
}
if RunParam = 2
{
vSort := 1
quote := 1
vAdd := 0
vPre := 0
}
if RunParam = 3
{
vSort := 0
quote := 0
vAdd := 0
vPre := 0
}
if RunParam = 4
{
vSort := 0
quote := 1
vAdd := 0
vPre := 0
}
if RunParam = 5
{
vSort := 0
quote := 0
vAdd := 1
vPre := 0
}
if RunParam = 6
{
vSort := 0
quote := 0
vAdd := 0
vPre := 1
}
}

If quote > 0
replacement := "', '"
else
replacement := ", "

if vSort = 1
{
; Optional Sort & remove Dupes If you don't want sorting, comment this out.
; If we're using quotes, sort as text. If not using quotes, sort as numbers...
; Sort haystack, use linefeed as delimiter, remove duplicates
If quote > 0
Sort, haystack, U
else
Sort, haystack, N U
}

if vPre = 1
{
needle := "m)(\r\n)^(\s*)\b"
replacement := "$1$2, "
}

; Perform the RegEx find and replace operation,
result := RegExReplace(haystack, needle, replacement)

; If using quotes, the result string needs a first & last single quote added
If quote > 0
result := "'" . result . "'"

if vAdd = 0
{
; Empty the Clipboard
Clipboard =
; Copy the result to the Clipboard.
Clipboard := result
; Wait for the Clipboard to fill.
ClipWait

; Optional Paste:
send, {CTRLDOWN}v{CTRLUP} ;send normal paste command

}

; If adding, loop over the list, uh, adding.
If vAdd > 0
{
sumtotal := 0
Loop, parse, result, `,
{
sumtotal += A_LoopField

}

; Empty the Clipboard
Clipboard =
; Copy the result to the Clipboard.
Clipboard := sumtotal
; Wait for the Clipboard to fill.
ClipWait

}

; Done!
return

Needed: Automatic screenshots on window changes

I can’t find windows software anywhere that will attach to a window/process, and automatically take a screenshot of that window (or child windows) every x seconds or whenever a change is detected. If the attached-to app is running and a progress bar in it updates, or a confirmation popup appears, or the text in that window changes, or an error occurs… I want an app to tell me when that change occurred (from the time I started recording) and what it looked like (screenshot).

Bonus points if I don’t have to have the attached-to app visible/on screen… like I can have other windows on top of it, and the “on change” detection & screenshots still work.

If the “on change” part just isn’t possible, then “every x seconds” would be ok, I guess. Can’t find this anywhere. Anybody know of an app for this?