Skip to content

Instantly share code, notes, and snippets.

@prashanthrajagopal
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prashanthrajagopal/a81e0590a54491599456 to your computer and use it in GitHub Desktop.
Save prashanthrajagopal/a81e0590a54491599456 to your computer and use it in GitHub Desktop.
Get the browser from URL for firefox and IE with auto it
if $CmdLine[0] >= 1 Then
$userInput = $CmdLine[1]
Else
$userInput = InputBox("GetURL", "Enter the bame of the browser", "firefox", "", "")
EndIf
if $userInput == "firefox" Then
$window = "[CLASS:MozillaWindowClass]"
if not winexists($window)=1 then;
MsgBox(0, "GetURL", "Mozilla Firefox is not running")
Else
WinActivate($window)
Send("^l")
Send("^c")
$url = ClipGet()
MsgBox(0, "URL", $url)
EndIf
ElseIf $userInput == "ie" Then
$window = "[CLASS:IEFrame]"
if not winexists($window)=1 then;
MsgBox(0, "GetURL", "Internet Explorer is not running")
Else
WinActivate($window)
$url = ControlGetText($window,'',"Edit1")
MsgBox(0, "URL", $url)
EndIf
Else
MsgBox(0, "GetURL", "Only IE and firefox are supported")
EndIf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment