Skip to content

Instantly share code, notes, and snippets.

@AfterLemon
AfterLemon / Class: Console
Last active August 29, 2015 13:56
Class: Console - Standardized Console GUI with Methods
class console
{ Time:=A_Now
__new(Name,x,y,w,h,TimeFormat:=1,Font:="Courier New",FontSize:=10)
{ global
If(Name="")
{ random,n,0
Name:="DebugID" n
}If(TimeFormat!=0&&TimeFormat!=1){
timeformat:=this.time
@AfterLemon
AfterLemon / AL_SubStr
Last active October 4, 2017 11:29
Custom Sub String Match checks left-to-right Supports {L}eft,{R}ight,{B}etween
; EXAMPLES
string := "111|222|333.444|555|444.777|888|999"
MsgBox, % AL_SubStr(string, "|","L",5) " _ " AL_SubStr(string, "|","R",5)
MsgBox, % AL_SubStr(string, ".","L",1) " _ " AL_SubStr(string, ".","R",1)
MsgBox, % AL_SubStr(string, ".","L",2) " _ " AL_SubStr(string, ".","R",2)
MsgBox, % AL_SubStr(string, ".","L",4) " _ " AL_SubStr(string, ".","R",4)
MsgBox, % AL_SubStr(string, "444","L",2) " _ " AL_SubStr(string, "444","R",2)
MsgBox, % AL_SubStr(string, "88","L", 2) " _ " AL_SubStr(string, "88","R")
Gui,Add,Text, x2 y5 w45 h20, //Type your Website Here//
Gui,Add,Edit, x50 y5 w48 h20 vMyEdit,
gui,add,button,x35 y30 w30 h20Default,Showit
gui,show, w100
return
GuiClose:
gui,destroy
exitapp
#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.
#SingleInstance Force
;double key short press and long press example:
~n & h:: ;pressing s while holding down n is the hotkey
#SingleInstance force
; Example: On-screen display (OSD) via transparent window:
CustomColor = FF8080 ; The transparent background color of the window, set this to something close to your text colour to avoid white highlighting
Gui +LastFound +AlwaysOnTop -Caption +ToolWindow +E0x20 ; +ToolWindow avoids a taskbar button and an alt-tab menu item.
Gui, Color, %CustomColor%
Gui, Font, s50 ; Set a large font size (12-point).
errorTail := "hello"
Gui, Add, Text, x0 y-10 vMyText cRed , %errorTail% ; add it, colour is Red, R5 sets 5 rows
Inputbox, key, Enter a number
Random, numChar, 2, 8
count := 0
charInside := 0
parameter := (numChar - charInside)
Loop
{
If (key >= parameter)
{
xp := 820
yp := 420
F16::
If !Wait
{
Wait := 1
yt := yp
Send {4}
;while Wait
FileName := "default2.ahk"
FileRead, FileIn, %FileName%
Loop, Parse, FileIn, `n, `r
{
If (A_Index < 2 || A_Index > 10)
Continue
else If !A_LoopField ; Test for "empty" line and skip it
Continue
lst .= A_LoopField . "`n`r"
}
SetTitleMatchMode, 2
#IfWinActive Pencil
^y:: Send, ^+z
#IfWinActive
InputBox, Input
Modifiers := Input
Hotkey, %Modifiers%1, Hotkey1
Hotkey, %Modifiers%2, Hotkey2
return
Hotkey1:
msgbox, you pressed %A_ThisHotkey%
Return