Code: Select all
proxy := "XXX.XXX.XXX.XXX:8080"
RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Internet Settings, ProxyEnable, 1
RegWrite, REG_SZ, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Internet Settings, ProxyServer, % proxy
Code: Select all
;http://ahkscript.org/boards/viewtopic.php?f=7&t=879
#NoEnv
#SingleInstance, Force
SetWorkingDir %A_ScriptDir%
Gui Add, Edit, w930 r1 vURL, http://www.whatsmyip.us/imgcode.php
Gui Add, Button, x+6 yp w44 Default, Go
Gui Add, ActiveX, xm w980 h640 E0x10000 vWB, Shell.Explorer
ComObjConnect(WB, WB_events)
;NO ERROR
WB.silent := true
ComObjError(0)
IOleInPlaceActiveObject_Interface := "{00000117-0000-0000-C000-000000000046}"
pipa := ComObjQuery( WB, IOleInPlaceActiveObject_Interface )
TranslateAccelerator := NumGet( NumGet( pipa+0 ) + 20 )
OnMessage( 0x0100, "WM_KeyPress" ) ; WM_KEYDOWN
OnMessage( 0x0101, "WM_KeyPress" ) ; WM_KEYUP
OnExit, GuiClose
Gui Show
ButtonGo:
Gui Submit, NoHide
WB.Navigate(URL)
Return
class WB_events
{
NavigateComplete2(wb, NewURL)
{
GuiControl,, URL, %NewURL% ; Update the URL edit control.
}
DocumentComplete( WB, NewURL )
{
; check all frames and elements for input focus
; WB.Document.Body.Focus()
}
}
GuiClose:
ObjRelease( pipa )
OnExit
ExitApp
Return
WM_KeyPress( wParam, lParam, nMsg, hWnd ) {
Global WB, pipa, TranslateAccelerator
Static Vars := "hWnd | nMsg | wParam | lParam | A_EventInfo | A_GuiX | A_GuiY"
WinGetClass, ClassName, ahk_id %hWnd%
If ( ClassName = "Shell DocObject View" && wParam = 0x09 ) {
WinGet, hIES, ControlListHwnd, ahk_id %hWnd% ; Find child of 'Shell DocObject View'
ControlFocus,, ahk_id %hIES%
Return 0
}
If ( ClassName = "Internet Explorer_Server" ) {
VarSetCapacity( MSG, 28, 0 ) ; MSG STructure http://goo.gl/4bHD9Z
Loop, Parse, Vars, |, %A_Space%
NumPut( %A_LoopField%, MSG, ( A_Index-1 ) * 4 )
Loop 2 ; IOleInPlaceActiveObject::TranslateAccelerator method http://goo.gl/XkGZYt
r := DllCall( TranslateAccelerator, UInt,pipa, UInt,&MSG )
Until wParam != 9 || WB.document.activeElement != ""
IfEqual, R, 0, Return, 0 ; S_OK: the message was translated to an accelerator.
}
}