Showing posts with label Windows. Show all posts
Showing posts with label Windows. Show all posts

Tuesday, September 27, 2011

inetwiz automation

inetwiz is a tool which I have been using in Windows XP to update the IE proxy setting.
The manual process has been a pain and I wanted to automate it badly.
Experimented with multiple tools - Registry updates, Python. A friend suggested to use VBS.
The VBS did the trick and I was able to use Wscript Run, AppActivate and sendKeys method to automate the proxy update and opening the URL in internet explorer.

Here is the script

option explicit

' Global variable used by mySendKeys function.

dim Wsh

set Wsh = Wscript.CreateObject("Wscript.Shell")

if (Wscript.Arguments.Count < 2) Then

Wscript.Echo "Usage: i /auto|/man URL"

Wscript.Quit(1)

End if

'WScript.Echo (Wsh.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable"))

if (Wscript.Arguments(0) = "/man") Then

' VB Script does not support double equal.

' If Proxy is not enabled, enable it.

if (Wsh.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable") = 0) Then

enableManProxy()

End if

Wsh.Run "iexplore " & Wscript.Arguments(1)

Elseif (Wscript.Arguments(0) = "/auto") Then

' If Auto Proxy is not enabled.

' VB Script does not support double equal.

if (Wsh.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable") = 1) Then

enableAutoProxy()

End if

Wsh.Run "iexplore " & Wscript.Arguments(1)

Else

Wscript.Echo "Usage: i /auto|/man URL"

End if

Function enableAutoProxy()

' Enable Automatic Proxy

Wsh.Run "inetwiz"

Wscript.Sleep 1000 ' Give time for application window to open.

mySendKeys "%n" ' Alt + n

mySendKeys " " ' Space

mySendKeys "{Tab}" ' Tab

mySendKeys " " ' Space

mySendKeys "{Tab}" ' Tab

mySendKeys "{Tab}" ' Tab

mySendKeys " " ' Space

mySendKeys "%n" ' Alt + n

mySendKeys "%o" ' Alt + 0

mySendKeys "%n" ' Alt + n

mySendKeys " " ' Space/Finish button

End Function

Function enableManProxy()

Wsh.Run "inetwiz"

Wscript.Sleep 1000 ' Give time for application window to open.

mySendKeys "%n" ' Alt + n

mySendKeys " " ' Space

mySendKeys "{Tab}" ' Tab

mySendKeys " " ' Space

mySendKeys "{Tab}" ' Tab

mySendKeys " " ' Space

mySendKeys "%n" ' Alt + n

mySendKeys "%n" ' Alt + n

mySendKeys "%n" ' Alt + n

mySendKeys "%o" ' Alt + 0

mySendKeys "%n" ' Alt + n

mySendKeys " " ' Space/Finish button

End Function

Function mySendKeys(key)

wsh.AppActivate "Internet Connection Wizard"

wsh.SendKeys key

End Function

Tuesday, January 04, 2011

Continuous Ping

ping -t


This is helpful when you do not want to open cmd window and execute ping command from the run prompt.

Sunday, December 31, 2006

Windows: Adding button to IE

run gpedit.msc
go to Windows Settings InternetExplorerMaintenance
Browser User Interface Browser ToolBar Customizations

Thursday, December 28, 2006

Windows: BookMarkelet to fill taxi requests

javascript:function jay(){var F = document.forms;var x=F[0].PURPOSE; x.options[x.selectedIndex].text='Late Stay';var y=F[0].LOC_TYPE; y.options[y.selectedIndex].text='Plot - 17';F[0].CHARGENO.value = 'STKL002',F[0].TO_PLACE.value='Gurgaon Patel Nagar',F[0].l_tele_no.value='9818203631';} jay();

You can find more information about book markelets from wikipedia