Archived from groups: microsoft.public.scripting.vbscript,microsoft.public.win98.gen_discussion (More info?)
I created a .vbs file using AutoIt code to activate the open instance of
Word. It works fine, and is faster than the Windows script I had used
for the same purpose:
Set oAutoIt = WScript.CreateObject("AutoItX3.Control")
oAutoIt.WinActivate "Microsoft Word", ""
However, I couldn't do same thing with IE, because with AutoIt the title
must include the specific title that appears, and with IE the first
thing that appears is not "Internet Explorer" but the title of the
particular document, and there's no way to know what that title will be.
So I couldn't get this AutoIt code to work for IE:
Set oAutoIt = WScript.CreateObject("AutoItX3.Control")
' [none of these three alternative lines would work]
oAutoIt.WinActivate "Title - Internet Explorer", ""
oAutoIt.WinActivate "Internet Explorer", ""
oAutoIt.WinActivate """ - Internet Explorer", ""
So I went back and used regular Windows script instead that I had
previously used for Word, and it works for IE. This activates the most
recently activated instance of IE:
Option Explicit
dim w
With WScript.CreateObject("WScript.Shell")
w = .AppActivate("Internet Explorer")
End With
This is a great convenience, which I recommend to anyone. Suppose I
have eight windows open including two IE windows and I want to do a
google search. I want to open one of the IE windows in order to access
the Google toolbar that is installed on my IE. I either have to hit
Alt+Tab several times to get to one of the IE instances, or reach for
the Mouse and click the pointer on the taskbar, which is inefficient.
But with this .vbs file, all I do is press Winkey+G which I've assigned
to the .vbs file. That instantly activates the most recently activated
IE window, and then I press Alt+G to put the cursor in the Google search
window in the Google toolbar. Something that use to take a few steps is
now almost instant.
Larry
I created a .vbs file using AutoIt code to activate the open instance of
Word. It works fine, and is faster than the Windows script I had used
for the same purpose:
Set oAutoIt = WScript.CreateObject("AutoItX3.Control")
oAutoIt.WinActivate "Microsoft Word", ""
However, I couldn't do same thing with IE, because with AutoIt the title
must include the specific title that appears, and with IE the first
thing that appears is not "Internet Explorer" but the title of the
particular document, and there's no way to know what that title will be.
So I couldn't get this AutoIt code to work for IE:
Set oAutoIt = WScript.CreateObject("AutoItX3.Control")
' [none of these three alternative lines would work]
oAutoIt.WinActivate "Title - Internet Explorer", ""
oAutoIt.WinActivate "Internet Explorer", ""
oAutoIt.WinActivate """ - Internet Explorer", ""
So I went back and used regular Windows script instead that I had
previously used for Word, and it works for IE. This activates the most
recently activated instance of IE:
Option Explicit
dim w
With WScript.CreateObject("WScript.Shell")
w = .AppActivate("Internet Explorer")
End With
This is a great convenience, which I recommend to anyone. Suppose I
have eight windows open including two IE windows and I want to do a
google search. I want to open one of the IE windows in order to access
the Google toolbar that is installed on my IE. I either have to hit
Alt+Tab several times to get to one of the IE instances, or reach for
the Mouse and click the pointer on the taskbar, which is inefficient.
But with this .vbs file, all I do is press Winkey+G which I've assigned
to the .vbs file. That instantly activates the most recently activated
IE window, and then I press Alt+G to put the cursor in the Google search
window in the Google toolbar. Something that use to take a few steps is
now almost instant.
Larry