-
Feb 14th, 2013, 01:55 AM
#1
Thread Starter
New Member
Gaining focus of a window without the complete name
I've been searching online and experimenting but can't get this to work.
I'm using the Windows Scripting Host (just running .vbs files on the machine)
What I need to do is gain focus on a particular window. For instance, "1293729 - Details - Windows Internet Explorer" where the number at the beginning changes. If the number was at the end then I know AppActivate can do it on it's own, but if I try to AppActivate " - Details - Windows Internet Explorer" then I get nothing.
Is there a method I could use to focus on that window? As a side note, there will only be one window at any time that matches that format.
I'm thinking maybe along the lines of looping through all window titles (if that's possible) until you find one that matches, and then pass it to AppActivate, but I'm new to the Windows API and I'm not sure where I should look.
Thanks
-
Feb 17th, 2013, 04:02 AM
#2
Re: Gaining focus of a window without the complete name
Clicking this led to the following sites:
Activate Any Window With API
Activate an App by a Partial Window Title
BTW, if your post has more to do with the Windows API than VB Script, then you may want to ask a moderator to transfer your thread to the API forum.
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)
-
Feb 17th, 2013, 12:23 PM
#3
Re: Gaining focus of a window without the complete name
Have you tried the AppActivate method of the WshShell object instead?
Code:
CreateObject("WScript.Shell").AppActivate " - Details - Windows Internet Explorer"
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|