masamunecyrus Posted December 17, 2009 Posted December 17, 2009 All I want to do right now is come up with a way to consistently click on the "Work Offline" button in IE. I've tried Send, ControlSend, WinMenuSelectItem, but it's never 100% consistent because IE8's alt+command behavior isn't consistent.I've also been dabbling now with _IEAttach.$obj = _IEAttach($name) ConsoleWrite( "Offline: " & _IEPropertyGet($obj, "offline") & @CRLF )This returns the correct boolean value regarding the "Work Offline" state of IE.However, though _IEPropertySet can set it to true, the browser doesn't actually enter offline mode. From what I've been able to Google, the reason is because offline mode is a global mode and it should be changed in the WebBrowser object, not the Internet Explorer object. I don't really know how to do that, but I've tried this:$obj = _IEAttach($name) $obj.ExecWB( __OLECMDID__, 2)But in the entire list of OLECMDID enumerations, there is no "Work Offline". Could anyone help? I'd like to be able to toggle "Work Offline" on and off.
masamunecyrus Posted December 17, 2009 Author Posted December 17, 2009 I've come across this bit of code that utilizes wininet.dll to see whether or not I'm in Work Offline mode. Could I use this to set the offline state? Global Const $INTERNET_CONNECTION_MODEM = 0x1 Global Const $INTERNET_CONNECTION_LAN = 0x2 Global Const $INTERNET_CONNECTION_PROXY = 0x4 Global Const $INTERNET_CONNECTION_MODEM_BUSY = 0x8 Global Const $INTERNET_RAS_INSTALLED = 0x10 Global Const $INTERNET_CONNECTION_OFFLINE = 0x20 Global Const $INTERNET_CONNECTION_CONFIGURED = 0x40 Dim $State, $val $InetStruct = DllStructCreate("int") DllCall("wininet.dll", "int", "InternetGetConnectedState", "ptr", DllStructGetPtr($InetStruct), "dword", 0) $val = DllStructGetData($InetStruct, 1) If BitAND($val, $INTERNET_CONNECTION_MODEM) Then $State &= "Modem connection" & @LF If BitAND($val, $INTERNET_CONNECTION_LAN) Then $State &= "LAN connection" & @LF If BitAND($val, $INTERNET_CONNECTION_PROXY) Then $State &= "Proxy connection" & @LF If BitAND($val, $INTERNET_CONNECTION_MODEM_BUSY) Then $State &= "Modem bussy" & @LF If BitAND($val, $INTERNET_RAS_INSTALLED) Then $State &= "RAS installed" & @LF If BitAND($val, $INTERNET_CONNECTION_OFFLINE) Then $State &= "Offline connection" & @LF If BitAND($val, $INTERNET_CONNECTION_CONFIGURED) Then $State &= "Connection configured" MsgBox(0, "Connection", $State)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now