Skip to content

Instantly share code, notes, and snippets.

@JoeGlines
Created March 10, 2023 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JoeGlines/330b8e1b0556363540e0cb57b0fa0421 to your computer and use it in GitHub Desktop.
Save JoeGlines/330b8e1b0556363540e0cb57b0fa0421 to your computer and use it in GitHub Desktop.
Gui, Submit ; Save the input from the user to each control's associated variable.
Filename:= (SubStr(filename,-3)=".ahk")?(SubStr(Filename,1,StrLen(Filename)-4)):Filename ;just in case they end it with .ahk
Body:=Jxon_Dump({content:Clipboard}) ;need to encode it
Data={"description": "%Descr%","public": true,"files": {"%FileName%.ahk": %Body%}} ;build data for post havnig double quotes
Obj:=ParseJSON(Send(Token,"https://api.github.com/gists","POST",Data)) ;make post and return information about it
Clipboard:="Use the following for a webpage post:`n<script src='https://gist.github.com/" GitName "/"(SubStr(obj.url,Instr(obj.url,"/",,0)+1))".js'></script>`n`nYou can get the code here: " obj.html_url
WinGetTitle, ActiveWindow , A ;Get active title
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment