Last active
April 26, 2021 15:36
-
-
Save JoeGlines/fe5d51d8fdebf88d5f51b7c25cd6c2ea to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;******************************************************* | |
; Want a clear path for learning AutoHotkey; Take a look at our AutoHotkey Udemy courses. They're structured in a way to make learning AHK EASY | |
; Right now you can get a coupon code here: https://the-Automator.com/Learn | |
;******************************************************* | |
;~ #Include <default_Settings> | |
IniRead, API_Token ,Auth.ini,API, Token ;you need to provide your API key in order for this to work | |
Meeting:="83266038140", data:="" ;data:="email`tFirst_Name`tLast_Name`tDate_Reg`n", | |
loop{ | |
Reg:=ZooMeetingRegistrants(API_Token,Meeting,Reg.next_page_token) | |
} until (!Reg.next_page_token) ;Keep running loop until there is no token returned | |
for k, v in Reg.Resp ;Now flatten file and share | |
data.=k a_tab v.First_name a_tab v.Last_name a_tab SubStr(v.Create_time,1,10) "`n" | |
clipboard:="email`tFirst_Name`tLast_Name`tDate_Reg`n" data | |
DebugWindow(clipboard,Clear:=1,LineBreak:=1,Sleep:=500,AutoHide:=0) | |
return | |
;******************************************************* | |
ZooMeetingRegistrants(API_Token,Meeting,Page_Token){ | |
static Att:={}, Resp:={} | |
HTTP:=ComObjCreate("WinHttp.WinHttpRequest.5.1") ;Create COM Object | |
HTTP.Open("GET","https://api.zoom.us/v2/meetings/" meeting "/registrants?page_size=2&next_page_token=" Page_Token) | |
HTTP.SetRequestHeader("Authorization","Bearer " API_Token) ;Authorization in the form of a Bearer token | |
HTTP.SetRequestHeader("Content-Type","application/json") ;JSON | |
HTTP.Send() | |
oAHK:=ParseJSON(HTTP.ResponseText) ;Make sure the ParseJSON function is in your library | |
for k, v in oAHK.registrants { | |
Att.Resp[v.email]:=[] ;Need to create the object first | |
Att.Resp[v.email].First_name:=v.first_name | |
Att.Resp[v.email].Last_name:=v.Last_name | |
Att.Resp[v.email].Create_time:=v.Create_time | |
Att.next_page_token:=oAHK.next_page_token | |
;~ DebugWindow(Obj2String(att),1,1,200,0) | |
;~ MsgBox pause to show data inside function | |
} | |
Return Att | |
} | |
;********************Other used functions*********************************** | |
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<obj.length; ++i)obj[i]=arrangeForAhkTraversing(obj[i]);return ['array',obj];" C "else if(obj instanceof Object){var keys=[],values=[];for(var key in obj){keys.push(key);values.push(arrangeForAhkTraversing(obj[key]));" C "return ['object',[keys,values]];" C "else return [typeof obj,obj];" C ";obj=" jsonStr) | |
return convertJScriptObjToAhks(SC.Eval("arrangeForAhkTraversing(obj)")) | |
}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] | |
} | |
Obj2String(Obj,FullPath:=1,BottomBlank:=0){ | |
static String,Blank | |
if(FullPath=1) | |
String:=FullPath:=Blank:="" | |
if(IsObject(Obj)&&!Obj.XML){ | |
for a,b in Obj{ | |
if(IsObject(b)&&b.OuterHtml) | |
String.=FullPath "." a " = " b.OuterHtml | |
else if(IsObject(b)&&!b.XML) | |
Obj2String(b,FullPath "." a,BottomBlank) | |
else{ | |
if(BottomBlank=0) | |
String.=FullPath "." a " = " (b.XML?b.XML:b) "`n" | |
else if(b!="") | |
String.=FullPath "." a " = " (b.XML?b.XML:b) "`n" | |
else | |
Blank.=FullPath "." a " =`n" | |
} | |
} | |
}else if(Obj.XML) | |
String.=FullPath Obj.XML "`n" | |
return String Blank | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment