Oort Posted February 20, 2015 Share Posted February 20, 2015 I just can't seem to figure this one out. Just want the script to find the game client window, activate it and bring it to the front when it is ran. Basically the same thing as dragging that 'x' to the window you want the script to run in, only having it done automatically. Doing it manually like that is problematic if I forget to target the right window when running the script as the scripted mouse movements will create havoc. The name of the client window I want to target is 'Clicker Heroes | Adventure Games | Play Free Games Online at Armor Games - Mozilla Firefox' While I've managed to pull the window name by having the window active, I can't seem to make it find that window and target it and put focus on it from a script. Seems all the examples Ive found to do this involve commands no longer being used by Scar 3.41 Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted February 20, 2015 Share Posted February 20, 2015 This worked with SCAR 3.40. Didn't try it with 3.41. program New; var WindowList: THwndArray; begin WindowList := FindWindowsEx(GetDesktopWindow(), 'Clicker Heroes | Adventure Games', '', False, False, True); if (Length(WindowList) > 0) then begin ActivateWindow(WindowList[0]); SetLength(WindowList, 0); end; end. Quote Link to comment Share on other sites More sharing options...
Oort Posted February 20, 2015 Author Share Posted February 20, 2015 Nah, gettin nothin with that. When run WindowList doesn't seem to find anything. I was trying out similar scripts with the same result. The only way it works is if I have the Clicker Hero window already up and focused on, then it will find it. Which defeats the purpose of needing to find it and bring it up Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted February 20, 2015 Share Posted February 20, 2015 Interesting. I had the Clicker Hero window minimized to the task bar and it still pulled it up. Quote Link to comment Share on other sites More sharing options...
Oort Posted February 20, 2015 Author Share Posted February 20, 2015 It seems to be that it is defeated if I am not on the Clicker Hero tab. You are right, it did work once I put focus on the firefox tab that clicker hero was in, but if I had another tab open to another page and had focus there it won't find it. So this is at least some success. Am getting a result that I understand a little more now. Thanks for your help Bixby! Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted February 20, 2015 Share Posted February 20, 2015 You can tell it to search child windows as well. FindWindowsEx(GetDesktopWindow(), 'Clicker Heroes | Adventure Games', '', True, False, True); Quote Link to comment Share on other sites More sharing options...
Oort Posted February 21, 2015 Author Share Posted February 21, 2015 If the tab selected in firefox is the clicker hero tab then it works fine, even if the firefox window itself is behind something else or minimized. But if I have multiple tabs open it wont look at the other tabs. So in effect it would have to pull firefox to front and focus and then swap to the clicker game tab. I think doing that might be a bit more involving. This is giving me a headache, I think I'll just settle with it expecting the correct tab is chosen and halting the script if not. Thanks! Quote Link to comment Share on other sites More sharing options...