Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
Sign in to follow this  
Oort

Automatically find and activate client window

Recommended Posts

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 :P

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...