moveBorderlessWindow

; ========================================================================================
; ========================================================================================
; Note: You can optionally release the ALT key after pressing down the mouse button 
; rather than holding it down the whole time.

~Alt & LButton::
    CoordMode, Mouse  ; Switch to screen/absolute coordinates.
    MouseGetPos, EWD_MouseStartX, EWD_MouseStartY, EWD_MouseWin
    WinGetPos, EWD_OriginalPosX, EWD_OriginalPosY,,, ahk_id %EWD_MouseWin%
    WinGet, EWD_WinState, MinMax, ahk_id %EWD_MouseWin% 
    if EWD_WinState = 0  ; Only if the window isn't maximized
        SetTimer, EWD_WatchMouse, 10 ; Track the mouse as the user drags it.
return

EWD_WatchMouse:
    GetKeyState, EWD_LButtonState, LButton, P
    if EWD_LButtonState = U  ; Button has been released, so drag is complete.
    {
        SetTimer, EWD_WatchMouse, off
        return
    }
    
    GetKeyState, EWD_EscapeState, Escape, P
    if EWD_EscapeState = D  ; Escape has been pressed, so drag is cancelled.
    {
        SetTimer, EWD_WatchMouse, off
        WinMove, ahk_id %EWD_MouseWin%,, %EWD_OriginalPosX%, %EWD_OriginalPosY%
        return
    }
    
    ; Otherwise, reposition the window to match the change in mouse coordinates
    ; caused by the user having dragged the mouse:
    CoordMode, Mouse
    MouseGetPos, EWD_MouseX, EWD_MouseY
    WinGetPos, EWD_WinX, EWD_WinY,,, ahk_id %EWD_MouseWin%
    SetWinDelay, -1   ; Makes the below move faster/smoother.
    WinMove, ahk_id %EWD_MouseWin%,, EWD_WinX + EWD_MouseX - EWD_MouseStartX, EWD_WinY + EWD_MouseY - EWD_MouseStartY
    EWD_MouseStartX := EWD_MouseX  ; Update for the next timer-call to this subroutine.
    EWD_MouseStartY := EWD_MouseY
return

autohotkey 双击隐藏/取消隐藏桌面图标

dclickhideicons
If ( A_PriorHotKey = A_ThisHotKey && A_TimeSincePriorHotkey < 350 )
{
	WinGetClass, Class, A
	If Class in Progman,WorkerW
		var:=(hidden=1)?"Show":"Hide"
	ControlGet, Selected, List, Selected, SysListView321, ahk_class %class%
	if selected
		return
	hidden:=!hidden
	Control, %var%,, SysListView321, ahk_class Progman
	Control, %var%,, SysListView321, ahk_class WorkerW
}
Return

autohotkey 发送commads

.ahk
; close context menu CTRL+ALT
Send {RCtrl DOWN}{Alt DOWN}{Alt UP}{RCtrl UP}

; detect context menu
closeContextMenu()
{
	GuiThreadInfoSize = 48
	VarSetCapacity(GuiThreadInfo, 48)
	NumPut(GuiThreadInfoSize, GuiThreadInfo, 0)
	if not DllCall("GetGUIThreadInfo", uint, 0, str, GuiThreadInfo)
	{
		MsgBox GetGUIThreadInfo() indicated a failure.
		return
	}
	; GuiThreadInfo contains a DWORD flags at byte 4
	; Bit 4 of this flag is set if the thread is in menu mode. GUI_INMENUMODE = 0x4
	if (NumGet(GuiThreadInfo, 4) & 0x4)
		send {escape}
}

autohotkey 中心窗口

FK中心窗口。

centerwindow.ahk
WinExist("A")
WinGetPos,,, sizeX, sizeY
WinMove, (A_ScreenWidth/2)-(sizeX/2), (A_ScreenHeight/2)-(sizeY/2)
return

autohotkey 调整大小500x300

FastKeys资源管理器

1000x.ahk
Width:=1000
Height:=555
WinGetPos,X,Y,W,H,A
If %Width% = 0
 Width := W
If %Height% = 0
 Height := H
WinMove,A,,710,370,%Width%,%Height%
;WinSet, Style, ^0xC00000, A 
Send, ^+3
Resize 500x300.ahk
Width:=500
Height:=300
WinGetPos,X,Y,W,H,A
If %Width% = 0
 Width := W
If %Height% = 0
 Height := H
WinMove,A,,710,370,%Width%,%Height%
;WinSet, Style, ^0xC00000, A 

autohotkey AHK杂项

misc.ahk
#SingleInstance, Force

Gui, -Caption
Gui, Color, Black
Gui, Font, s20
Gui, Add, Text, cWhite Border Center, First Test`n`nPress c to continue
Gui, Show
OnMessage(0x201, "WM_LBUTTONDOWN")
Return

GuiEscape:
GuiClose:
ExitApp
Control
DetectHiddenWindows, On
WinGet, ControlList, ControlList, ahk_class ThunderRT6MDIForm
RegExMatch(ControlList, "(?<=ToolbarWindow32)\d+(?!.*ToolbarWindow32)", nTB)
	

autohotkey AHK IE

ieDocumentComplete.ahk
ie := ComObjCreate("InternetExplorer.Application")

; Connects events to corresponding script functions with the prefix "IE_".
ComObjConnect(ie, "IE_")

ie.Visible := true  ; This is known to work incorrectly on IE7.
ie.Navigate("https://autohotkey.com/")
#Persistent

IE_DocumentComplete(ieEventParam, url, ieFinalParam) {
    global ie
    if (ie != ieEventParam)
        s .= "First parameter is a new wrapper object.`n"
    if (ie == ieFinalParam)
        s .= "Final parameter is the original wrapper object.`n"
    if ((disp1:=ComObjUnwrap(ieEventParam)) == (disp2:=ComObjUnwrap(ieFinalParam)))
        s .= "Both wrapper objects refer to the same IDispatch instance.`n"
    ObjRelease(disp1), ObjRelease(disp2)
    MsgBox % s . "Finished loading " ie.Document.title " @ " url
    ie.Quit()
    ExitApp
}
faq.txt
https://autohotkey.com/board/topic/47052-basic-webpage-controls-with-javascript-com-tutorial/
ieEvent.ahk
ComObjConnect(wb, "IE_")   ;// Connect the webbrowser object
loading := true            ;// Set the variable "loading" as TRUE
wb.Navigate("www.AutoHotkey.com")
while loading
   Sleep 10
MsgBox DONE!
ComObjConnect(wb)          ;// Disconnect the webbrowser object (or just wb := "")

IE_DocumentComplete() {    ;// "IE_" prefix corresponds to the 2nd param in ComObjConnect()
   global loading := false ;// Break the While-Loop
}https://autohotkey.com/board/topic/47052-basic-webpage-controls-with-javascript-com-tutorial/
ieReady.ahk
wb.Navigate("www.AutoHotkey.com")
while wb.busy or wb.ReadyState != 4
   Sleep 10
wbGet.ahk
WBGet(WinTitle="ahk_class IEFrame", Svr#=1) {               ;// based on ComObjQuery docs
   static msg := DllCall("RegisterWindowMessage", "str", "WM_HTML_GETOBJECT")
        , IID := "{0002DF05-0000-0000-C000-000000000046}"   ;// IID_IWebBrowserApp
;//     , IID := "{332C4427-26CB-11D0-B483-00C04FD90119}"   ;// IID_IHTMLWindow2
   SendMessage msg, 0, 0, Internet Explorer_Server%Svr#%, %WinTitle%
   if (ErrorLevel != "FAIL") {
      lResult:=ErrorLevel, VarSetCapacity(GUID,16,0)
      if DllCall("ole32\CLSIDFromString", "wstr","{332C4425-26CB-11D0-B483-00C04FD90119}", "ptr",&GUID) >= 0 {
         DllCall("oleacc\ObjectFromLresult", "ptr",lResult, "ptr",&GUID, "ptr",0, "ptr*",pdoc)
         return ComObj(9,ComObjQuery(pdoc,IID,IID),1), ObjRelease(pdoc)
      }
   }
}
getIE.ahk
IEGet(Name="")        ;Retrieve pointer to existing IE window/tab
{
    IfEqual, Name,, WinGetTitle, Name, ahk_class IEFrame
        Name := ( Name="New Tab - Windows Internet Explorer" ) ? "about:Tabs"
        : RegExReplace( Name, " - (Windows|Microsoft) Internet Explorer" )
    For wb in ComObjCreate( "Shell.Application" ).Windows
        If ( wb.LocationName = Name ) && InStr( wb.FullName, "iexplore.exe" )
            Return wb
} ;written by Jethrow



IEGet(name="") {
   IfEqual, Name,, WinGetTitle, Name, ahk_class IEFrame     ;// Get active window if no parameter
   Name := (Name="New Tab - Windows Internet Explorer")? "about:Tabs":RegExReplace(Name, " - (Windows|Microsoft)? ?Internet Explorer$")
   for wb in ComObjCreate("Shell.Application").Windows()
      if wb.LocationName=Name and InStr(wb.FullName, "iexplore.exe")
         return wb
}
ex_ie.ahk
wb := IEGet("Google") ;IE instance already open and tab named google exists
wb.Document.All.q.Value := "site:autohotkey.com tutorial"
wb.Document.All.btnG.Click()
IELoad(wb)
;or
wb := ComObjCreate("InternetExplorer.Application") ;create a IE instance
wb.Visible := True
wb.Navigate("Google.com")
IELoad(wb)
wb.Document.All.q.Value := "site:autohotkey.com tutorial"
wb.Document.All.btnG.Click()
IELoad(wb)
ieLoad.ahk
IELoad(wb)    ;You need to send the IE handle to the function unless you define it as global.
{
    If !wb    ;If wb is not a valid pointer then quit
        Return False
    Loop    ;Otherwise sleep for .1 seconds untill the page starts loading
        Sleep,100
    Until (wb.busy)
    Loop    ;Once it starts loading wait until completes
        Sleep,100
    Until (!wb.busy)
    Loop    ;optional check to wait for the page to completely load
        Sleep,100
    Until (wb.Document.Readystate = "Complete")
Return True
}
ie
wb_cIEEmbed := ComObjCreate("InternetExplorer.Application")

		
		url := "https://uptodate.appl.kp.org/goto_UpToDate_SOCAL.asp?srcsys=EPIC435395&unid=" nuid
		;_log("url[" url "]")
		wb := wb_cIEEmbed
		wb.Visible := true
		wb.Navigate(url)
		
		while wb.readystate != 4 or wb.busy {
			Sleep, 100
		}
		url := wb.document.location.href
		url := url "?search=" textSelection
		;_log("url[" url "]")
		
		wb.document.location.href := url

autohotkey com dll

DownloadComplete.ahk
#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
    }
}
shellScript.js
var shellObj = new ActiveXObject("WScript.Shell");
var nuid = shellObj.ExpandEnvironmentStrings("%UserName%")
getenv.js
function getEnv(env) {
	var shellObj = new ActiveXObject("WScript.Shell");
	var value = shellObj.ExpandEnvironmentStrings("%"+env+"%");
    
    return value;
}
ie.js
var ie = new ActiveXObject("InternetExplorer.Application");

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

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

xmlhttpGet.js
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);
xmlhttpPost.js
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));
remoteaApp
;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

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');")

autohotkey 在FF #ahk中打开地址

在FF #ahk中打开地址

openinff.ahk
;SaveClip := ClipboardAll
;Clipboard := ""
;WinWaitActive ahk_exe chrome.exe
Send ^l ;Ctrl C
sleep, 10
Send ^{vk43} ;Ctrl C

IfWinExist, ahk_exe Waterfox.exe
{
	WinActivate
	Send, ^t ;Ctrl C
	sleep, 30
	Send, ^l ;Ctrl C
	sleep, 160
	Send, ^v ;Ctrl C
	sleep, 20
	Send, {Enter}
	return
}


else
  {   
	Run, "C:\Program Files\Waterfox\waterfox.exe"
	WinActivate
	sleep, 100
	Send, ^t ;Ctrl C
	sleep, 30
	Send, ^l ;Ctrl C
	sleep, 160
	Send, ^v ;Ctrl C
	sleep, 20
	Send, {Enter}
	return
}

autohotkey 在ST3开放

选定的文本在ST3中打开

openinst3.ahk
;SaveClip := ClipboardAll
;Clipboard := ""
Send ^{vk43} ;Ctrl C
ClipWait 1
;Word := RegExReplace(Clipboard, "[^\w\s]")
;Clipboard := SaveClip
;SaveClip := ""
;sleep, 400
Run C:\Users\Mike\OneDrive\#portables\Sublime Text 3 (x64)\sublime_text.exe
WinWaitActive ahk_exe sublime_text.exe
;sleep, 200
Send ^n
;sleep, 100
Send ^v