How to make a GUI | Intro to amazing GUIs with AutoHotkey in 2020

How to make a GUIHow to make a GUI

I’m so stoked to announce our Intro to GUIs with AutoHotkey course is now live!

Since I suck at GUIs I hired Isaias Baez (Raptor X / AHK Tuts on YouTube) to create the course and he did an amazing job!   Not only is it truly easy to follow, but the quality is top-notch!  In this course we show you how to make a GUI using the most proven GUIs in existence!

Not to boast but I truly believe GUIs are a great way to bring non-AutoHotkey people into AutoHotkey!

Have you ever given thought that, when we use AutoHotkey GUIs we’re able to use the most thoroughly tested GUIs on the planet?

Billions of people have used the Microsoft Windows GUIS!  Billions! Continue reading

Easily pushing delimited data into a ListView in AutoHotkey

I used to be a Data Scientist and often found data that I’d want to “peak” at.  AutoHotkey listviews are an easy way to do this!

Example Easily pushing delimited data into a ListView in AutoHotkey

https://youtu.be/XdHqE6v4Ov8

Here’s the code I used to Easily pushing delimited data into a ListView in AutoHotkey
 


#Include  
;**************************************
Data=
(
Email First_Name Last_Name Title Another more more2
[email protected] Joe Glines the-Automator LastFound one End
[email protected] Jon King King big guy Here
[email protected] Joseph GLines Something now what ok
)

Data1=
(
ONE,TWO,THREE,FOUR,FIVE,SIX
1one,1two,1three,1four,1five,1six
2one,2two,2three,2four,2five,2six
)
LV_Table(Data1,",",1,Title:="Example Tab delimited data & not using header") ;comma on variable
;~ Data_Source3:=A_ScriptDir . "\data.txt"
;~ LV_Table(Data_Source3,,0,Title:="Example large tab delimited FILE not using header") ;tab on file

;~ LV_Table(Post, delimiter:="`t",UseHeader:=1,Title:="Joe's posts")
LV_Table(Data_Source, delimiter="`t",UseHeader=1,Title=""){ ; default delimiter set to tab
if FileExist(Data_Source) ;if file exists use it as source
FileRead, Data_Source, %Data_Source% ;read in and store as variable

;***********parse the data in variable and store in object*******************
data_obj := StrSplit(Data_Source,"`n","`r") ;parse earch row and store in object
rowHeader:=StrReplace(data_obj.RemoveAt(1),Delimiter,"|",Numb_Columns) ; Remove header from Object and convert to pipe delimited
if (useHeader=0){
loop, % Numb_Columns+1
RH.="Col_" A_Index "|"
rowHeader:=RH
}

dCols:= (Numb_Columns<8) ? 400: ((Numb_Columns<80) ? 650 : 1100) ;if cols <10 use 400; if cols <80 use 650 ; else use 1100
dRows:= (data_obj.MaxIndex() >27) ? 26 : data_obj.MaxIndex() ;if rows >27 use 26 else use # of rows

Gui, Table_View: New,,%Title% ;create new gui window and set title
Gui, Add, ListView, w%dCols% r%dRows% grid , % rowHeader ;set headers

For Each, Row In data_obj ;add the data lines to the ListView
LV_Add("", StrSplit(Row, Delimiter)*) ;LV_Add is a variadic function

Gui, Table_View:Show
}

Resizable AutoHotkey GUI function for simple GUIs in 2020

Here’s a handy Re-sizable GUI Function in AutoHotkey that I used to use a lot more (before I had access to the Debug window in AHK Studio and Output Window in SciTE4AutoHotkey

Resizable AutoHotkey GUI Function

Code for Resizable AutoHotkey GUI Function in AutoHotkey


Resizable_GUI(Data,x=900,y=600){
	static EditWindow
	Gui,12:Destroy
	Gui,12:Default
	Gui,+Resize
	Gui,Font,s12 cBlue q5, Courier New
	Gui,Add,Edit,w%x% h%y% -Wrap HScroll hwndEditWindow, %Data%
	Gui,Show
	return
	12GuiEscape:
	12GuiClose:
	Gui,12:Destroy
	return
	12GuiSize:
	GuiControl,12:Move,%EditWindow%,% "w" A_GuiWidth-30 " h" A_GuiHeight-25
	return
}

API Call with AutoHotkey to pull WordPress Statistics

I stumbled upon something I had worked on years ago to pull stats from WordPress and decided to have a little fun. In this script I show how you can perform API calls with AutoHotkey to extract your stats from WordPress.

API Call with AutoHotkey to pull WordPress Statistics

API Call with AutoHotkey to pull WordPress Statistics


#SingleInstance,Force
Blog_URI:="https://the-Automator.com" ;note, even if WordPress is in another folder, use this
IniRead, API_Key,Auth.ini,API, Key ;API Key is your key to Akismet

;*******************************************************
;*********Make sure you have not turned-off your API access in WordPress!******
;~ some documentation here: https://stats.wordpress.com/csv.php
;~ period = days,week,month
;~ limit = deault is 100 -1 is unlimitedIniRead, API_Token ,Auth.ini,API, Token
;~ table = One of views, postviews, referrers, referrers_grouped, searchterms, clicks, videoplays.
;********************Views***********************************
If (){
oAHK:=API_Call({"api_key":api_key,"blog_uri":Blog_URI,"table":"views","period":"days","format":"json"})
data:="Views`tDate`n"
for k, v in oAHK
data.=v.views "`t" v.date "`n"
LV_Table(Clipboard:=data,delimiter:="`t",UseHeader:=1,Title:="Views")
}

;********************Refererrs***********************************
If (0){
oAHK:=API_Call({"api_key":api_key,"blog_uri":Blog_URI,"table":"referrers","period":"month","days":"-1","format":"json"})
data:="Views`tReferrers`n"
for k, v in oAHK.1.referrers
data.=v.views "`t" v.referrer "`n"
LV_Table(Clipboard:=data,delimiter:="`t",UseHeader:=1,Title:="Search terms")
}

;********************clicks***********************************
If (0){
oAHK:=API_Call({"api_key":api_key,"blog_uri":Blog_URI,"table":"clicks","period":"month","days":"30","format":"json"}) ;,"summarize":""
data:="Clicks`tURL`n"
for a, b in oAHK
for c,d in b.clicks
data.=d.views "`t" d.click "`n"
LV_Table(Clipboard:=data, delimiter:="`t",UseHeader:=1,Title:="Clicks") ;Still need to aggregate numbers
}
;********************Search***********************************
If (1){
oAHK:=API_Call({"api_key":api_key,"blog_uri":Blog_URI,"table":"searchterms","period":"month","days":"-1","format":"json"})
data:="Views`tSearch Terms`n"
for k, v in oAHK
for a,b in v.SearchTerms{
if (b.SearchTerm !="encrypted_search_terms")
data.=b.views "`t" b.searchterm "`n"
}
LV_Table(Clipboard:=data,delimiter:="`t",UseHeader:=1,Title:="Search terms")
}

;********************API Call***********************************
API_Call(QS){
QS:=QSB(QS)
HTTP := ComObjCreate("WinHttp.WinHttpRequest.5.1") ;Create COM Object
HTTP.Open("GET","http://stats.wordpress.com/csv.php" QS ) ; "&summarize" this will return summary of metric
HTTP.SetRequestHeader("User-Agent","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9")
HTTP.Send() ;If POST request put data in "Payload" variable
oAHK:=ParseJSON(HTTP.ResponseText) ;Make sure the ParseJSON function is in your library
return oAHK
}
;********************Query String Builder***********************************
QSB(x){
for a,b in x
String.=(A_Index=1?"?":"&") a "=" b
return String
}

;********************Shove inot List View***********************************
LV_Table(Data_Source, delimiter="`t",UseHeader=1,Title=""){ ; default delimiter set to tab
if FileExist(Data_Source) ;if file exists use it as source
FileRead, Data_Source, %Data_Source% ;read in and store as variable

;***********parse the data in variable and store in object*******************
data_obj := StrSplit(Data_Source,"`n","`r") ;parse earch row and store in object
rowHeader:=StrReplace(data_obj.RemoveAt(1),Delimiter,"|",Numb_Columns) ; Remove header from Object and convert to pipe delimited
if (useHeader=0){
loop, % Numb_Columns+1
RH.="Col_" A_Index "|"
rowHeader:=RH
}

dCols:= (Numb_Columns<8) ? 400: ((Numb_Columns<80) ? 650 : 1100) ;if cols <10 use 400; if cols <80 use 650 ; else use 1100
dRows:= (data_obj.MaxIndex() >27) ? 26 : data_obj.MaxIndex() ;if rows >27 use 26 else use # of rows

Gui, Table_View: New,,%Title% ;create new gui window and set title
Gui, Add, ListView, w%dCols% r%dRows% grid , % rowHeader ;set headers

For Each, Row In data_obj ;add the data lines to the ListView
LV_Add("", StrSplit(Row, Delimiter)*) ;LV_Add is a variadic function

Gui, Table_View:Show
}

;********************Maestrit Parse JSON***********************************
ParseJSON(jsonStr){
static SC:=ComObjCreate("ScriptControl"),C:=Chr(125)
SC.Language:="JScript",ComObjError(0),SC.ExecuteStatement("function arrangeForAhkTraversing(obj){if(obj instanceof Array){for(var i=0; i }ConvertJScriptObjToAhks(JSObj){
if(JSObj[0]="Object"){
Obj:=[],Keys:=JSObj[1][0],Values:=JSObj[1][1]
while(A_Index<=Keys.length)
Obj[Keys[A_Index-1]]:=ConvertJScriptObjToAhks(Values[A_Index-1])
return Obj
}else if(JSObj[0]="Array"){
Array:=[]
while(A_Index<=JSObj[1].length)
Array.Push(ConvertJScriptObjToAhks(JSObj[1][A_Index-1]))
return Array
}else
return JSObj[1]
}