Skip to content

Instantly share code, notes, and snippets.

@DaneWeber
DaneWeber / NPP-Py-AnalyzeExcelFormula
Last active Aug 29, 2015
Notepad++ Python Script for Analyzing Nested Parentheses and Comma-Separated Arguments. Posted to https://sourceforge.net/p/notepad-plus/discussion/1290590/thread/c17ed459/
View NPP-Py-AnalyzeExcelFormula
#!/usr/bin/python
# 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
DaneWeber / NPP-Py-DeAnalyzeExcelFormula
Last active Aug 29, 2015
Notepad++ Python Script for De-Analyzing Nested Parentheses and Comma-Separated Arguments. Posted to https://sourceforge.net/p/notepad-plus/discussion/1290590/thread/c17ed459/
View NPP-Py-DeAnalyzeExcelFormula
input_text = editor.getSelText()
EVENTS = 3
STATES = 2
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
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
Return
View AHK-PastePlain.ahk
; Copied from http://www.autohotkey.com/board/topic/10412-paste-plain-text-and-copycut/
#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 FindNubWithJ.ijs
/:~ ~. 1!:1 <'C:/Path/ICD10/icd10withHierarchy.txt'
%&'()+,-./0123456789<=>ABCDEFGHIJKLMNOPQRSTUVWXYZ[]abcdefghijklmnopqrstuvwxyz
@DaneWeber
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
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 http://www.autohotkey.com/board/topic/39551-change-the-default-mailto-to-gmail/
; #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.
@DaneWeber
DaneWeber / jsoftware.xml
Created Sep 15, 2015
Notepad++ syntax highlighting for the J programming language (jsoftware.com) - unknown original source
View jsoftware.xml
<NotepadPlus>
<UserLang name="J" ext="ijs" udlVersion="2.1">
<Settings>
<Global caseIgnored="yes" allowFoldOfComments="no" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
<Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
</Settings>
<KeywordLists>
<Keywords name="Comments">00NB. 01 02 03 04</Keywords>
<Keywords name="Numbers, prefix1"></Keywords>
<Keywords name="Numbers, prefix2"></Keywords>
@DaneWeber
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: http://superuser.com/questions/642041/hacker-typer-style-application…
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
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: http://www.gmayor.com/installing_macro.htm
View WordFindAllInstances
Option Explicit
Sub FindAllInstances()
Dim MyAR() As String
Dim i As Long
Dim match As String
match = "has"
i = 0