Skip to content

Instantly share code, notes, and snippets.

View hoppfrosch's full-sized avatar

hoppfrosch hoppfrosch

  • Hesse, Germany
View GitHub Profile
@hoppfrosch
hoppfrosch / Class_RegEx.ahk
Created March 25, 2014 11:26
RegEx Class #ahk #class
/*
Created by Frankie Bagnardi
Forum topic: http://www.autohotkey.com/forum/topic74340.html
Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
v0.5
Modified by R3gX - http://www.autohotkey.com/board/topic/69236-regex-class/page-2#entry582249
*/
class RegEx
@hoppfrosch
hoppfrosch / git-log2json.sh
Last active August 29, 2015 14:13 — forked from textarcana/git-log2json.sh
git-log2json #git #script
#!/usr/bin/env bash
# Use this one-liner to produce a JSON literal from the Git log:
git log \
--pretty=format:'{%n "commit": "%H",%n "author": "%an <%ae>",%n "date": "%ad",%n "message": "%f"%n},' \
$@ | \
perl -pe 'BEGIN{print "["}; END{print "]\n"}' | \
perl -pe 's/},]/}]/'
@hoppfrosch
hoppfrosch / ListGlobalVars.ahk
Created September 25, 2015 05:07
ListGlobalVars() - list of all variables
; Written by Lexikos - see: http://www.autohotkey.com/board/topic/20925-listvars/#entry156570
Loop {
tick := A_TickCount
ToolTip % ListGlobalVars()
}
ListGlobalVars()
{
static hwndEdit, pSFW, pSW, bkpSFW, bkpSW
@hoppfrosch
hoppfrosch / Args.ahk
Last active September 25, 2015 05:30
Args.ahk - Returns command line parameters as array
Args( CmdLine := "", Skip := 0 ) { ; By SKAN, http://goo.gl/JfMNpN, CD:23/Aug/2014 | MD:24/Aug/2014
Local pArgs := 0, nArgs := 0, A := []
pArgs := DllCall( "Shell32\CommandLineToArgvW", "WStr",CmdLine, "PtrP",nArgs, "Ptr" )
Loop % ( nArgs )
If ( A_Index > Skip )
A[ A_Index - Skip ] := StrGet( NumGet( ( A_Index - 1 ) * A_PtrSize + pArgs ), "UTF-16" )
Return A, A[0] := nArgs - Skip, DllCall( "LocalFree", "Ptr",pArgs )
@hoppfrosch
hoppfrosch / NbArrElem.ahk
Created September 18, 2012 09:33
PROBLEM: Determine number of Array elements [#ahk #problem
test := GetTimeZones()
ExitApp
GetTimeZones() {
; Taken from: http://www.autohotkey.com/community/viewtopic.php?t=73951
OutputDebug % "**** GetTimeZones START ****"
; Get the "Time Zones" entries from registry
RegRoot := "HKEY_LOCAL_MACHINE"
RegKey := "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones"
@hoppfrosch
hoppfrosch / JUnit.ahk
Created December 7, 2012 07:54
AHK: JUnit XML output for Yunit-Framework [#ahk #snippet #unittest #function
;############################
; description: Generate JUnit-XML output for Yunit-Framework (https://github.com/Uberi/Yunit)
;
; author: hoppfrosch
; date: 20121207
;############################
class xml{
; Credits:By Maestrith (http://www.autohotkey.com/board/topic/85010-xml-parser/?hl=msxml)
__New(param*){
ref:=param.1,root:=param.2,file:=param.3
@hoppfrosch
hoppfrosch / AHK_version.ahk
Created September 11, 2013 05:18
Determine version of Autohothey #ahk #script #snippet
;shows what version of ahk the user is running
; i think sinkfaze might have come up with this originally (dist. by camerb)
info := "AutoHotkey:`t" "AutoHotkey" ((A_AhkVersion < 1.1) ? " Classic ": ((A_IsDll ? "_H (DLL)":"_L")))
. "`nAHK Version:`t" A_AhkVersion
. "`nUnicode:`t`t" (A_IsUnicode ? "Yes " ((A_PtrSize=8) ? "(64-bit)" : "(32-bit)") : "No")
. "`nOperating System:`t" (!A_OSVersion ? A_OSType : A_OSVersion) " " (A_Is64bitOS ? "(64-bit)" : "(32-bit)")
. "`nAdmin Rights:`t" (A_IsAdmin ? "Yes" : "No")
MsgBox, 68, Support Information, %info%`n`nWould you like to copy this information to the Clipboard?
IfMsgBox Yes
@hoppfrosch
hoppfrosch / NamedParameters.ahk
Created October 9, 2013 11:21
Named functions parameters using variadic and JSON-Syntax #ahk #script #snippet
; Named parameters for functions
;
; Credits: named parameters by lexikos (http://www.autohotkey.com/board/topic/62504-variadic-functions)
; Note the Brackets around the parameters and the trailing star {...}*!!! (Brackets: JSON - Star: Variadic ...)
Test({WinTitle: "ahk_class Notepad", ExcludeTitle: "Untitled", Cmd: "PID"}*)
Test2({WinTitle: "ahk_class Notepad", ExcludeTitle: "Untitled2", Cmd: "PID2"}*)
; Simple Variadic: All parameters are accesible through prms-Array
Test(prms*) {
@hoppfrosch
hoppfrosch / CallStack.ahk
Created November 27, 2013 07:45
Get the current AHK-callstack #ahk #script #function #debug
CallStack(deepness = 5, printLines = 1)
{
loop % deepness
{
lvl := -1 - deepness + A_Index
oEx := Exception("", lvl)
oExPrev := Exception("", lvl - 1)
FileReadLine, line, % oEx.file, % oEx.line
if(oEx.What = lvl)
continue
@hoppfrosch
hoppfrosch / NumifyVersion.ahk
Last active April 4, 2016 06:18
Conversion of a version given as string to a numerical version (to allow version comparison) #ahk #script #function
; Conversion of a version given as string to a numerical version (to allow version comparison)
;
; see: http://www.autohotkey.com/board/topic/62037-conversion-of-version-string-to-number/
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Example: Does current AHK-Version meet my requirements?
; Which version of Autohotkey is required?
versionAHKReq := "1.0.90.0"
vAHKCurr := NumifyVersion(A_AhkVersion)
vAHKReq := NumifyVersion(versionAHKReq)