att
9/9/2018 - 6:43 PM

com dll

#SingleInstance, off
OnExit,OnExit

;url := "http://example.com/"
url := "file:///D:/Google Drive/__DEVELOPMENT/_ahk/caregap/html/caregap.html"

Gui Add, ActiveX, x0 y0 w640 h480 vie, Shell.Explorer  ; The final parameter is the name of the ActiveX component.
ie.silent := true ;Surpress JS Error boxes
;ie.navigate("http://example.com/") ;put your web address here...
ie.navigate(url) ;put your web address here...

ComObjConnect(ie, Class_ieEvent)  ; Connect WB's events to the WB_events class object.
Gui Show, w640 h480

return

GuiClose:
OnExit:
ExitApp

class Class_ieEvent
{
    ;NavigateComplete2(ie, urlNew)
    ;DownloadComplete(ie, urlNew)
    DocumentComplete(ie, urlNew)
    {
        if (ie.ReadyState == 4) { ; see http://stackoverflow.com/a/9835755/883015
            Sleep, 300 ;wait 300 ms

            ;Do what you here...
            ;for example, click the first link on the page, you can change this for a button.
            ie.document.getElementsByTagName("a")[0].click()
            ;MsgBox Item was clicked.
        }
        return
    }
}
var shellObj = new ActiveXObject("WScript.Shell");
var nuid = shellObj.ExpandEnvironmentStrings("%UserName%")
function getEnv(env) {
	var shellObj = new ActiveXObject("WScript.Shell");
	var value = shellObj.ExpandEnvironmentStrings("%"+env+"%");
    
    return value;
}
var ie = new ActiveXObject("InternetExplorer.Application");

ie.Navigate(url);
ie.Visible = true;

var doc = ie.Document;
var body = doc.body;
var win = doc.parentWindow;

var xmlhttp;		// = new XMLHttpRequest();
if (window.XMLHttpRequest) {
// code for modern browsers
xmlhttp = new XMLHttpRequest();
} else {
// code for old IE browsers
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}

xmlhttp.onreadystatechange = function () {
if(xmlhttp.readyState === 4) {
if(xmlhttp.status === 200 || xmlhttp.status == 0) {        
display_cures_search_result(xmlhttp.responseText, request);					
}
}
}
xmlhttp.open("GET", report_template_url, true);
xmlhttp.send(null);
var data = [
	["One", "Two"],
	["One", "Two"]
];


var url = "http://sdrad.rsct.ca.kp.org/sites/mmodal/toolbar.html";


xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("POST", url);
xmlhttp.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
xmlhttp.send(JSON.stringify(data));
;https://autohotkey.com/board/topic/58215-middle-click-titlebartaskbar-close-windows-semi-solved/

  WinGet, pidTaskbar, PID, ahk_class Shell_TrayWnd 

    hProc := DllCall("OpenProcess", "Uint", 0x38, "int", 0, "Uint", pidTaskbar) 
    pRB := DllCall("VirtualAllocEx", "Uint", hProc 
        , "Uint", 0, "Uint", 20, "Uint", 0x1000, "Uint", 0x4) 

    VarSetCapacity(pt, 8, 0) 
    NumPut(x, pt, 0, "int") 
    NumPut(y, pt, 4, "int") 
    
    ; Convert screen coords to toolbar-client-area coords. 
    DllCall("ScreenToClient", "uint", ctl, "uint", &pt) 
    
    ; Write POINT into explorer.exe. 
    DllCall("WriteProcessMemory", "uint", hProc, "uint", pRB+0, "uint", &pt, "uint", 8, "uint", 0) 

;     SendMessage, 0x447,,,, ahk_id %ctl%  ; TB_GETHOTITEM 
    SendMessage, 0x445, 0, pRB,, ahk_id %ctl%  ; TB_HITTEST 
    btn_index := ErrorLevel 
    ; Convert btn_index to a signed int, since result may be -1 if no 'hot' item. 
    if btn_index > 0x7FFFFFFF 
        btn_index := -(~btn_index) - 1 
    
    
    if (btn_index > -1) 
    { 
        ; Get button info. 
        SendMessage, 0x417, btn_index, pRB,, ahk_id %ctl%   ; TB_GETBUTTON 
    
        VarSetCapacity(btn, 20) 
        DllCall("ReadProcessMemory", "Uint", hProc 
            , "Uint", pRB, "Uint", &btn, "Uint", 20, "Uint", 0) 
    
        state := NumGet(btn, 8, "UChar")  ; fsState 
        pdata := NumGet(btn, 12, "UInt")  ; dwData 
        
        ret := DllCall("ReadProcessMemory", "Uint", hProc 
            , "Uint", pdata, "UintP", hwnd, "Uint", 4, "Uint", 0) 
    } else 
        hwnd = 0 

        
    DllCall("VirtualFreeEx", "Uint", hProc, "Uint", pRB, "Uint", 0, "Uint", 0x8000) 
    DllCall("CloseHandle", "Uint", hProc) 

ie := ComObjCreate("InternetExplorer.Application")
url := "about:blank"
ie.Navigate(url)
ie.Visible := true
doc := ie.Document
body := doc.body
win := doc.parentWindow

doc.parentWindow.execScript("alert('foobar');")