Jump to content
Tuts 4 You

Learn Autohotkey!


Guest bGraHam-AhK

Recommended Posts

Guest bGraHam-AhK

In true scripting and programming style,

i bring to you the 'Hello World' App!

But first,

we must set up our working enviroment:

For These Tutorials, we will need:

AutoHotKey

Notepad or a Text Editor

~~~~~~~~~~~~~~~~~~~~~~~~~~~

Simply install to your hard drive and the rest will happen itself

~~~~~~~~~~~~~~~~~~~~~~~~~~~

open a new txt document and type the following:

MsgBox, Hello World!

Now save the file as: "HelloWorld.ahk"

with the filetype as "any"

( if your using WordPad keep the "" )

The breakdown:

'MsgBox' is the command

' , ' defines where a command or option ends and begins

' Hello World ' in this case is the string to display

this can be letters or numbers.

If you wish add "`n", this adds a new line to the Message Box.

Since im strapped for time this is all i could get down, but i will write a new Tutorial in about 4 hours

( after work )

Link to comment
.386
.model flat, stdcall
option casemap:noneinclude kernel32.inc
include user32.inc
include windows.incincludelib kernel32.lib
includelib user32.lib.data
Caption db "Reply",0
Message db "Interesting stuff bGraHam-AhK",13,10
db "This is how a message box is coded in assembly!",0.code
start:
Invoke MessageBox, NULL, addr Message, addr Caption, MB_ICONINFORMATION+MB_OK
Invoke ExitProcess, NULL
end start
Link to comment
In true scripting and programming style,

i bring to you the 'Hello World' App!

You should mention, that it's mainly a macro (automation) language.

But afaik the best one out there... I'm using it sometimes -

nevertheless.. prolly has NOT much to do with rce, right ?

With it you don't learn anything about APIs or stuff.. :|

Link to comment
Guest bGraHam-AhK
In true scripting and programming style,

i bring to you the 'Hello World' App!

You should mention, that it's mainly a macro (automation) language.

But afaik the best one out there... I'm using it sometimes -

nevertheless.. prolly has NOT much to do with rce, right ?

With it you don't learn anything about APIs or stuff.. :|

How wrong you are Ufo,

with the help of some custom libries you can incorperate almost anything into this. ive made fully blown internet explorers, custom made Media Players, and even made a touchy intergration of them both,

although doing so is very hard. Yes it is a macro but thats just one small part of it, ill be showing you

how gui's work next.

Thanks for the positive feedback! ill be bringing 10 or so Tutorials in total...

Link to comment
Guest bGraHam-AhK
.386
.model flat, stdcall
option casemap:noneinclude kernel32.inc
include user32.inc
include windows.incincludelib kernel32.lib
includelib user32.lib.data
Caption db "Reply",0
Message db "Interesting stuff bGraHam-AhK",13,10
db "This is how a message box is coded in assembly!",0.code
start:
Invoke MessageBox, NULL, addr Message, addr Caption, MB_ICONINFORMATION+MB_OK
Invoke ExitProcess, NULL
end start

Nice Tipidy, i would like to mention that Autohotkey can use that exact code if you wanted.

merely by using Include __________.___.

that looks quite complex doesnt it? but it is probably a more powerful language engine!

Link to comment
..has NOT much to do with rce, right ?
...
fully blown internet explorers, custom made Media Players, and even made a touchy intergration of them both,
Eh ? :huh:

Anyway.. as mentioned, I really like AutoHotkey - for its purposes.

It wasn't meant in a negative way.. it was more like hoping to hear

something arsekicking regarding 'AutoHotkey goes RCE' :D

with the help of some custom libries
... and that's what I meant. Using done stuff -

which requires more fingersnipping rather than crawling through API sh!tz...

which is cool again.. > for it's purposes <

Nevertheless, keep on :)

Link to comment
ive made fully blown internet explorers, custom made Media Players, and even made a touchy intergration of them both, although doing so is very hard.

Interesting, would like to see the source code if available? ;)

Tipidy

Link to comment
Guest bGraHam-AhK
ive made fully blown internet explorers, custom made Media Players, and even made a touchy intergration of them both, although doing so is very hard.

Interesting, would like to see the source code if available? ;)

Tipidy

Sure heres the code for a MP3 Player i made, kind of works, its anoying coding...

MP3Player.ahk

;--------- March 2007 20:30:37 -------------- 
/*
......name = PlaylistM3U.ahk bGraham
......date = 2005-12-27
......modified = 2007-05-28 small correctur for use arrow up/down to listen
...... 2005-12-29 add search and date column
...... 2005-12-30 when splashimage red, wait
...... 2005-12-30 search counter
*/ ;PLAYER=%A_programfiles%\GRETECH\GomPlayer\gom.exe menu,S1,Add,&Set a predefined Folder,MH1
menu,S1,Add,&How to use,MH2
menu,S1,Add,&About,MH3
menu,myMenuBar,Add,Settings,:S1
gui,menu,MyMenuBar setformat,float,3.0
soundset, 0,master,mute ;SPEAKER=MASTER ON
SoundSet,100,master ;SPEAKER=MASTER volume
soundset, 0,WAVE,mute ;WAVE ON
SoundSet,100,WAVE ;WAVE
SoundGet,MAS,Master RU1=%A_SCRIPTDIR%\_M3U
ifnotexist,%RU1%
FileCreateDir,%RU1% R3K=%A_SCRIPTDIR%\_M3U\lastm3u.txt
DFT=%A_SCRIPTDIR%\_M3U\define.txt Gui, Color, 000000
Gui, Show, x0 y0 w720 h420,PlayerM3U Gui,Font, S10 CDefault , FixedSys
Gui,Add, ListView,grid y17 r17 w700 altsubmit gMLV,Name|PROGRAM|DATE ;Gui,Font,S13 CDefault,Lucida Console
;Gui,Add, ListView,backgroundteal csilver grid r15 w700 altsubmit gMLV,Name|PROGRAM|DATE Gui,1:Font, S8 cwhite, Verdana
Gui,1:Add,Edit, x12 y320 w700 h40 ReadOnly vH2, Gui,Add,Text,x20 y2 vTotal1 w100,%I%
Gui,Add,Text,x140 y2 vFolder1 w500,%FA% Gui,1:Font, S8 cblack, Verdana Gui,Add,Button, x280 y365 w130 h20,FolderM3U
Gui,Add,Button, x430 y365 w130 h20,LastCreated
Gui,Add,Button, x580 y365 w130 h20,CreatePlayList Gui,Add,Edit, x280 y390 w430 h20 vAL
Gui,Add,Button, default x620 y390 w0 h0 gSearch, Gui,Add,Button, x168 y365 w60 h46,ON/OFF
Gui,Add,Slider, x10 y365 w150 h20 vVolume Range0-100 gVolumeX,100
Gui,Add,Edit, x10 y390 w150 h20 vEditText3 gEdit3,
LB:
Gui,1:Default
Gui,1:Submit,nohide FileReadLine,LP,%R3K%,1
GuiControl,,Folder1,%LP%
R3X=%A_SCRIPTDIR%\_M3U\%LP% LB2:
LV_Delete()
LV_ModifyCol(1,560)
LV_ModifyCol(2,0)
LV_ModifyCol(3,110)
Splashimage,,b1 x140 y5 w500 h30 CWred zh0,START READ
I:=0
loop,read,%R3X%
{
BX1=
stringsplit,BX,A_LoopReadLine,`;,
ifnotexist,%BX1%
continue
I++
Filegettime,T1,%BX1%,C
stringleft,T1,T1,12
stringright,P2,BX1,3 stringlen, LenLine,BX1
StringGetPos,C,BX1,\,R1
If Errorlevel <> 0
C = 0
else
C := LenLine-C
stringright,SR,BX1,C-1 if P2=MP3
LV_Add("",SR,BX1,T1)
if P2=WAV
LV_Add("",SR,BX1,T1)
if P2=M3U
LV_Add("",SR,BX1,T1)
else
Continue
}
Splashimage,off
GuiControl,,total1,%I%
GuiControl,Focus,AL
return
;===================================
buttonLastCreated:
FileReadLine,LP,%R3K%,1
GuiControl,,H2,PLAYLIST= %LP%
GuiControl,,Folder1,%LP%
R3X=%A_SCRIPTDIR%\_M3U\%LP%
Goto,LB ;------------------
buttonFolderM3U:
GuiControl,,H2,
GuiControl,,H2,---- OPEN FILE M3U with RightClick --- or -- DoubleClick to play all
FA=%RU1%\allm3u.txt
Filedelete,%FA%
Loop,%RU1%\*.M3U, 0,1
{
Fileappend,%A_LoopFileFullPath%`r`n,%FA%
}
R3X=%FA%
Goto,LB2 ;-----------------------------
VolumeX:
Gui, Submit, NoHide
SoundSet,%volume%,master
SoundGet,MAS,Master
GuiControl,, EditText3,%volume%
Return Edit3:
Gui, Submit, Nohide
GuiControl,,volume,%EditText3%
Return
;-----------------------------------------
buttonON/OFF:
soundset,+1,master,mute
K++
transform,MD1,MOD,K,2
transform,pr,chr,37
if MD1=0
MD2=%MAS%%PR%
else
MD2=SPEAKER OFF
Gui,Add,Edit, cred x10 y390 w120 h20 ,%MD2%
return ;------------- search --------------------
search:
Gui,submit,nohide LV_Delete()
LV_ModifyCol(1,560)
LV_ModifyCol(2,0)
LV_ModifyCol(3,110)
Splashimage,,b1 x140 y0 w500 h30 CWred zh0,START READ if AL=*
{
I:=0
loop,read,%R3X%
{
BX1=
stringsplit,BX,A_LoopReadLine,`;,
ifnotexist,%BX1%
continue
Filegettime,T1,%BX1%,C ;M A
stringleft,T1,T1,12 I++
stringlen, LenLine,BX1
StringGetPos,C,BX1,\,R1
If Errorlevel <> 0
C = 0
else
C := LenLine-C
stringright,SR,BX1,C-1
LV_Add("",SR,BX1,T1)
} Splashimage,off
GuiControl,,total1,%I%
GUIControl,,Edit2,
return
}
I:=0
loop,read,%R3X%
{
BX1=
stringsplit,BX,A_LoopReadLine,`;,
ifnotexist,%BX1%
continue
Filegettime,T1,%BX1%,C ;M A
stringleft,T1,T1,12 ifinstring,BX1,%AL%
{
I++
stringlen, LenLine,BX1
StringGetPos,C,BX1,\,R1
If Errorlevel <> 0
C = 0
else
C := LenLine-C
stringright,SR,BX1,C-1 LV_Add("",SR,BX1,T1)
}
else
Continue
}
Splashimage,off
GuiControl,,total1,%I%
GUIControl,,Edit2,
return ;-----------------------------------------
MLV:
Gui,submit,nohide
if A_GuiEvent=Normal
{
LV_GetText(C1,A_EventInfo,1)
LV_GetText(C2,A_EventInfo,2)
C1=%C1%
stringright,C1R,C1,3
if C1R=M3U
{
GuiControl,,H2,---- OPEN FILE M3U with RightClick --- or -- DoubleClick to play all
Goto,NX1
}
if C2=
GuiControl,,H2,%C1%
else
GuiControl,,H2,%C2%
} NX1:
if A_GuiEvent=K
{ GetKeyState,state,UP
if state=D
{
RF:=LV_GetNext("F")
LV_GetText(C2,RF,2)
ifnotexist,%C2%
{
RF:=RF-1
LV_GetText(C2,RF,2)
}
GuiControl,,H2,%C2%
;run,"%PLAYER%" "%C2%",min
run,%C2%
gosub,winact
} GetKeyState,state,DOWN
if state=D
{
RF:=LV_GetNext("F")
LV_GetText(C2,RF,2)
ifnotexist,%C2%
{
RF:=RF+1
LV_GetText(C2,RF,2)
}
GuiControl,,H2,%C2%
;run,"%PLAYER%" "%C2%",min
run,%C2%
gosub,winact
}
} ;------ RightClick -----------------
if A_GuiEvent = RightClick
{
LV_GetText(C1,A_EventInfo,1)
C1=%C1%
stringright,C1R,C1,3
if C1R=M3U
{
GuiControl,,H2,%C5%`r`n%C2%
RN:=LV_GetNext("C") ;2 selected checked
RF:=LV_GetNext("F") ;2 selected focused
GC:=LV_GetCount() ;4 total
LV_GetText(C1,A_EventInfo,1)
GuiControl,,H2,%C1%
GuiControl,,Folder1,%C1%
R3X=%RU1%\%C1% LV_Delete()
LV_ModifyCol(1,560)
LV_ModifyCol(2,0)
LV_ModifyCol(3,110)
Splashimage,,b1 x140 y0 w500 h30 CWred zh0,START READ
I:=0
loop,read,%R3X%
{
BX1=
stringsplit,BX,A_LoopReadLine,`;,
ifnotexist,%BX1%
continue
I++
stringright,P2,BX1,3
stringlen, LenLine,BX1
StringGetPos,C,BX1,\,R1
If Errorlevel <> 0
C = 0
else
C := LenLine-C
stringright,SR,BX1,C-1
Filegettime,T1,%BX1%,C ;M A
stringleft,T1,T1,12
if P2=MP3
LV_Add("",SR,BX1,T1)
if P2=WAV
LV_Add("",SR,BX1,T1)
else
Continue
}
Splashimage,off
GuiControl,,total1,%I%
return
}
} ;------------------------
if A_GuiEvent=DoubleClick
{
LV_GetText(C2,A_EventInfo,2)
RF:=LV_GetNext("F")
if RF=0
{
msgbox,Select a row
return
} if C2=
{
msgbox,Column2 is empty
return
} Splashimage,,b1 x140 y0 w500 h30 CWred zh0,START
Sleep,1500
GuiControl,,H2,%C2%
ifnotexist,%C2%
{
msgbox,%C2% < no more exist on this place
Goto,EX4
}
run,%C2%
Splashimage, off
return
}
EX4:
Splashimage, off
return ;==============================
MH3:
msgbox,PlayerM3U.ahk 2005-12-27-- Braiden Graham`r`nhttp://www.autohotkey.com
return MH2:
msgbox,Start: shows last created`r`nFile M3U:open with right click or double click to play`r`nSearch:xy or * for all again
return MH1:
GuiControl,,H2,
MF=
FileSelectFolder,MF,,3
if MF=
return
Filedelete,%DFT%
GuiControl,,H2,Defined Folder= %MF%
fileappend,%MF%,%DFT%
return ;---------------------
buttonCreatePlayList:
GuiControl,,H2,
FileReadLine,DF,%DFT%,1
MF=
FileSelectFolder,MF,%DF%,3
if MF=
return
stringlen, LenLine, MF
StringGetPos,C, MF,\,R1
If Errorlevel <> 0
C = 0
else
C := LenLine-C stringleft,MFL,MF,1
stringright,SR,MF,C-1 R3F=_M3U\HD_%MFL%_%SR%.m3u
runwait,%comspec% /C del _M3U\HD_%MFL%_%SR%.m3u,,hide sleep,200 Splashimage,,b1 x140 y0 w500 h30 CWred zh0,START >> %SR%
mx:=0
Loop, %MF%\*.MP3, 0,1
{
Fileappend,%A_LoopFileFullPath%`r`n,%R3F%
mx++
} Loop, %MF%\*.WAV, 0,1
{
Fileappend,%A_LoopFileFullPath%`r`n,%R3F%
mx++
} Filedelete,%R3K%
Fileappend,HD_%MFL%_%SR%.m3u`r`n,%R3K%
Splashimage, off
GuiControl,,H2,--PLAYLIST= %MF% if MX=0
{
msgbox,Not found MP3 or WAV
return
}
GuiControl,,Folder1,%SR%
Goto,LB ;--------- WINACT:
sleep,1000
winactivate,ahk_class AutoHotkeyGUI
return ;---------------
GuiClose:
ExitApp

Hope you enjoy this!

Oh and just for the sake of it i wrote a script that opens a preset website.

This Requires 2 other AHK files, not made by me ( not smart enough ) Simply save the files as .ahk files with the EXACT SAME NAME, so IEControl.txt becomes IEControl.ahk : CoHelper.txt and IEControl.txt

so just rename these files to .ahk and your set, they must be in the same working directory as the below code.

#Include IEControl.ahk
#SingleInstance forceGoSub, GuiStartGui, +LastFound +Resize
Gui, Show, w800 h700 Left, Dragon Fable Player Build 1.0.03
hWnd := WinExist()CLSID_WebBrowser := "{8856F961-340A-11D0-A96B-00C04FD705A2}"
IID_IWebBrowser2 := "{D30C1661-CDAF-11D0-8A3E-00C04FC9E26E}"
pwb := CreateObject(CLSID_WebBrowser, IID_IWebBrowser2)AtlAxAttachControl(pwb, hWnd)IE_LoadURL(pwb, "http://dragonfable.battleon.com/game/")returnGuiStart:
AtlAxWinInit()
CoInitialize()
returnGuiClose:
ToolTip
Gui, %A_Gui%:Destroy
Release(pwb)
CoUninitialize()
AtlAxWinTerm()
ExitApp
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...