Open Internet Explorer if a window doesn't already exist. Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
reboot689
Posts: 21
Joined: 10 Apr 2017, 14:49

Open Internet Explorer if a window doesn't already exist.

17 Feb 2018, 17:54

I have been trying to build a script that will open a new tab in IE, and go to a specific URL if an IE window is already open., and open an IE Window, if there isn't one open. The new tab if Open part works. But i cant get the other half to. I have gotten Notepad and such to work with similar scripts. But IE just isn't working. Here's the script i have so far.

Code: Select all

+#c::
Gui, 8: Show, w120 h170, CoachView
Gui, 8: Add, Text ,, Team Select
Gui, 8: Add, Button, g1, Jason
Gui, 8: Add, Button, g2, Wanda
Gui, 8: Add, Button, g3, CW
Gui, 8: Add, Edit, w50 vCustom hwndhCustom
Gui, 8: Add, Button, x65 y111 gCustom, Select
Return

Placeholder(hCustom, "Custom")

1:
SUP = jwf160
;MsgBox % SUP

ifWinExist ahk_exe iexplore.exe
{
WinActivate, ahk_exe iexplore.exe
WinWaitActive, ahk_exe iexplore.exe

SendPlay, ^t
SendPlay, http://google.com/%SUP% {Enter}
Return
}
Else
{
Run, "C:\Program Files\Internet Explorer\iexplore.exe"

WinWait ahk_exe iexplore.exe
;SendPlay, ^t
SendPlay, http://google.com/%SUP% {Enter}
}
Return

2: ;;(Similar)

3: ;;(Similar)

Custom:
;;(similar but with
;;Custom:
;;Gui, Submit, NoHide
;;SUP := Custom

;;IfWinExist, ahk_exe iexplore.exe
;;Send, ^t
;;Send, http://coachview.ftr.com/CoachView/?id=%SUP%
;;Return

8GuiClose:
Gui, 8:Destroy
Return
All other aspects of the code are working correctly. But the opening of IE when i press the "Jason" Button, (my test button) its not opening a window. Please help.
reboot689
Posts: 21
Joined: 10 Apr 2017, 14:49

Re: Open Internet Explorer if a window doesn't already exist.  Topic is solved

23 Feb 2018, 14:53

Got it!

Code: Select all

1:
SUP = clw055

IfWinExist, ahk_exe iexplore.exe
	{
		If WinActive ahk_exe iexplore.exe
		{
			SendPlay, ^t
			Sleep, 25
			SendPlay, http://google.com/%SUP% {Enter}
			Return
		}
		Else
		{
			WinActivate, ahk_exe iexplore.exe
			SendPlay, ^t
			Sleep, 25
			SendPlay, http://google.com/%SUP% {Enter}
			Return
		}
	}
Else
	{
		Run, C:\Program Files\Internet Explorer\iexplore.exe http://google.com/%SUP%
		Return
	}
It seemed to have been an issue of Brackets and Dirty Code.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], haomingchen1998, mikeyww and 244 guests