Make Process w/ Window get Set Focus.
Posted: Tue Sep 29, 2009 10:31 pm
I wanted to ask a question on how to make a window get focus via it system process name.
Theory:
#1 FilePath_Name.s gets set from a read of an INI file
#2 The first segment of the loop starts reading all windows that are open and gives them to Temp.s
#3 Then AutoFocusRead.s gets a result and AutoFocusResult.l is set by how many times FilePath_Name.s is found in AutoFocus Read.s
#4 If AutoFocusResult is 1 or higher, then it breaks the loop and sets temp = HandleOn.s
Please note that I used user library: Droopy Library v1.30.9
#5 Set the Foreground Window to the name of the window HandleOn.s
This is the complete code:
Please could you see if this works.
Big thanks to anyone that does.
Theory:
#1 FilePath_Name.s gets set from a read of an INI file
#2 The first segment of the loop starts reading all windows that are open and gives them to Temp.s
Code: Select all
Temp.s=WindowsEnum()
If Temp=""
Break
EndIf
Code: Select all
AutoFocusRead.s = Temp+" "+HandleToFileName(GetHandle(Temp))
AutoFocusResult.l = CountString(AutoFocusRead.s, FilePath_Name.s)
Code: Select all
If AutoFocusresult = >1 or 1
Temp = HandleOn.s
Break
EndIf
#5 Set the Foreground Window to the name of the window HandleOn.s
Code: Select all
ForegroundWindowSet(HandleOn.s)
Code: Select all
FilePath_Name.s = IniRead("C:\File.ini","FilePath","Name")
Repeat
Temp.s=WindowsEnum()
If Temp=""
Break
EndIf
AutoFocusRead.s = Temp+" "+HandleToFileName(GetHandle(Temp))
AutoFocusResult.l = CountString(AutoFocusRead.s, FilePath_Name.s)
If AutoFocusresult = >1 or 1
Temp = HandleOn.s
Break
EndIf
ForEver
ForegroundWindowSet(HandleOn.s)
Big thanks to anyone that does.