Skip to content

Instantly share code, notes, and snippets.

DaneWeber / Magic-Button-Masher.ahk
Created Sep 23, 2013
This is my attempt at a program that will allow you to type randomly on the keyboard and have pre-determined text entered instead. This can be useful when performing live demonstrations or when you want to impress someone (ha!). Started as a response to a question on SuperUser:…
View Magic-Button-Masher.ahk
#UseHook ; Avoid loops of the Send command triggering the hotkey again.
AutoTrim, Off ; Don't auto-trim spaces and tabs from the beginning and end of the sourcetext.
SendMode InputThenPlay ; Try to prevent the user from corrupting the buffer text.
SetWorkingDir %A_ScriptDir%
Suspend, On ; Start suspended
FileRead, MasherBuffer, magic-button-masher-text.txt
if ErrorLevel
MasherBuffer = Type or paste text here. You can also drag-and-drop text files here.
DaneWeber / WordFindAllInstances
Created Nov 26, 2013
Find All Instances of the match value. You can see the results inserted into the "Immediate" debug area. Press Ctrl+G if you don't see it. See this page if you don't know how to install a macro:
View WordFindAllInstances
Option Explicit
Sub FindAllInstances()
Dim MyAR() As String
Dim i As Long
Dim match As String
match = "has"
i = 0
DaneWeber / NPP-Py-AnalyzeExcelFormula
Last active Aug 29, 2015
Notepad++ Python Script for Analyzing Nested Parentheses and Comma-Separated Arguments. Posted to
View NPP-Py-AnalyzeExcelFormula
# input_text = editor.getSelText()
input_text = '=HLOOKUP(TablePeriods[[#Headers],[YearMonth]],TablePeriods[[#All],[YearMonth]],MATCH([@Date],INDIRECT("TablePeriods[[#All],["&[@Account]&"]]"),-1))'
# initialize the state table
state_table = {}
# event list and corresponding state table
event_list = ( "\"", "&", "(", ")", ",", "\n\r\t ", "[", "]", "{", "}" ) # last event is anything that doesn't match one of the other actions
DaneWeber / NPP-Py-DeAnalyzeExcelFormula
Last active Aug 29, 2015
Notepad++ Python Script for De-Analyzing Nested Parentheses and Comma-Separated Arguments. Posted to
View NPP-Py-DeAnalyzeExcelFormula
input_text = editor.getSelText()
state_table = [[[0,0] for x in range(EVENTS)] for x in range(STATES)]
event_list = [ "\"", "\n\r\t " ] # last event is anything that doesn't match one of the other actions
state_table[0] = [[1,0], [0,1], [0,0]] # normal state
state_table[1] = [[0,0], [1,0], [1,0]] # double-quote comment
DaneWeber / AHK-LiteralTabPaste.ahk
Last active Apr 7, 2016
Literal paste of tabular data into Excel via AHK hotkey
View AHK-LiteralTabPaste.ahk
#z:: ; Text–only paste from ClipBoard
KeyWait, LWin
KeyWait, RWin
Clip0 = %ClipBoardAll% ; Save formatted text for later
ExcelBound = %Clipboard%
Loop, parse, ExcelBound, `r`n
if A_LoopField =
nonemptyline := A_LoopField
View AHK-PastePlain.ahk
; Copied from
#v:: ; Text–only paste from ClipBoard | WIN and V keys are the hotkey
KeyWait, LWin ; Wait for the Windows key to be lifted,
KeyWait, RWin ; since it would sometimes combine with the pasted text.
OldClip = %ClipBoardAll% ; Save formatted text for later
ClipBoard = %ClipBoard% ; Convert to text
Send ^v ; For best compatibility: SendPlay | simulates pressing CRTL and V keys
Sleep 50 ; Don't change clipboard while it is pasted! (Sleep > 0)
ClipBoard = %OldClip% ; Restore original ClipBoard
VarSetCapacity(OldClip, 0) ; Free memory
View AHK-TypeClipboard.ahk
#b:: ; Simulate typing of the text on the clipboard
KeyWait, LWin ; Ensure that the Windows key has been lifted.
KeyWait, RWin
ToPaste = %ClipBoard% ; Convert to text
Sleep 100
StringReplace, ToPaste, ToPaste, `r`n, `n, All ; Prevent CR+LF from causing two newlines
Sleep 100
SendRaw %ToPaste% ; SendRaw simulates typing the characters exactly, including AHK's special !^#+ characters
View FindNubWithJ.ijs
/:~ ~. 1!:1 <'C:/Path/ICD10/icd10withHierarchy.txt'
DaneWeber / AHK-per-file-7zip.ahk
Last active Aug 29, 2015
Use 7Zip on each file within a directory, saving the resulting archives to a new directory
View AHK-per-file-7zip.ahk
InputBox, password, Enter Password for Archives, The generated archives will be protected with the password you enter below. Your input will be masked., hide
; Using FileSelectFolder is just one way of choosing your folders.
FileSelectFolder, sourcepath,,, Source Folder
sourcepath := RegExReplace(sourcepath, "\\$") ; Removes the trailing backslash, if present.
FileSelectFolder, destinationpath,,, Destination Folder
destinationpath := RegExReplace(destinationpath, "\\$") ; Removes the trailing backslash, if present.
sourcelen := StrLen(sourcepath) + 1 ; Determine the start of the variable part of the path.
Loop, Files, %sourcepath%\*.*, R
DaneWeber / AHK-mailto-gmail.ahk
Last active Sep 13, 2015 — forked from anonymous/AHK-mailto-gmail.ahk
AHK script to be Windows default mailto app, forwarding to Gmail
View AHK-mailto-gmail.ahk
; Copied from
; #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.
Haystack = %1%
;~ If no paramter is given when the run of it, it registers itself as the default mailto
; commented out because I'd rather set it as default by myself.