AutoHotkey Webinar- CloudAHK / CloudAHK in a bottle is an AMAZING tool to launch in 2020

CloudAHKJune 2020 marks our 48th  AutoHotkey Webinar!

CloudAHK

AutoHotkey Webinar 08/2018 Hour 1-Helping work through scripts
AutoHotkey Webinar 08/2018 Hour 2-GeekDude explaining his work on CloudAHK / CloudAHK in a bottle

In Hour 2 GeekDude also explains how he was able to “pack up” all of the resources in

Podcasts

061  Hierarchy of Competence

062  Updating / Fixing Automate my Task

063  GUI RPA software & Computer Knowledge in the workplace

Udemy Courses

Alerts / Update newsletter from the-Automator

  • What I’ve automated
  • Cool scripts from forum / Facebook / Reddit, etc.
  • Podcast that week
  • Time-saving tip (not AutoHotkey related)

Subscribe to my alerts and be entered into chance to win 1 of 10  Intermediate AutoHotkey course giveaway!  The drawing will be held on June 31st

Script Highlight: Push to GIST

xmlHTTPRequest vs. WinHTTPRequest- What killer advantages does the xmlRequest have?

xmlHTTPRequestIn this video I walk through both the xmlHTTPRequest and the WinHTTPRequest.  As I mention in the video, Jackie Sztuk and I have a great  AutoHotkey webinar on Intro to API calls.  I also have several examples on my API page.

I also mention using Fiddler to monitor the browser traffic and grab your cookies / headers.

WinHTTPRequest vs. xmlHTTPRequest tutorial


Here’s the syntax I used for the WinHTTPRequest example

WinHTTPRequest syntax

And here’s the corresponding two XML API calls I demonstrated in the video

xmlHTTPRequest example using Msxml2.XMLHTTP COM object

Here’s the example connecting to the IE page and sending the API request with the xmlHTTPRequest()

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]
}


Disabling Spelling and Grammar check in MS Word with AutoHotkey

Microsoft WordI’ve been shoving AutoHotkey code into MS Word a lot lately and got tired of going through all the steps to disable the spell check and grammar checker each time. I tried looking for a button inside MS Word to add to my toolbar but I couldn’t find a button to apply the settings (or to get me to the Proofing page) so I decided to write it in AutoHotkey. Here’s the video explaining how I got the code and the hiccups I had along the way.

Disabling Spelling and Grammar check in MS Word with AutoHotkey

Disabling Spelling and Grammar check in MS Word with AutoHotkey


#SingleInstance,Force
doc:=ComObjActive("Word.Application") ;this would activate an open one
doc.Application.ScreenUpdating := False
doc.Options.CheckSpellingAsYouType:=True
doc.Options.CheckGrammarAsYouType :=True
doc.ActiveDocument.ShowSpellingErrors := False
doc.ActiveDocument.ShowGrammaticalErrors := False
doc.Application.ScreenUpdating := True ;Update the screen