Jump to content

How to focus on a process


nwbyy
 Share

Recommended Posts

Hi

I'm playing beta version of They are billions.
There are only "auto saves" and a "save and quit" functions yet.
So after a misstake it's not possible to step back to a previos saved game.

I created a batch file assigned to F3 key that allows me to copy/paste the saved game to a backup folder.
Another batch assigned to F4 to copy the file back in its original folder.

It works well, but every time I run one of my batch files, the TheyAreBillions process goes minimized and I have to ALT+TAB or clic back on it.
To make it a little smarter, I'd like to  run from the .bat a little .exe once the copy/paste finished, to set the focus back to the game.

So far I have this working taken from the help file examples:

#include <MsgBoxConstants.au3>

If ProcessExists("TheyAreBillions.exe") Then ; Check if the process is running.
     MsgBox($MB_SYSTEMMODAL, "", "Process is running")
EndIf

Of course I don't want a message box, but focusing back to the game.

I tried successfully with the notepad process:

#include <MsgBoxConstants.au3>

If ProcessExists("notepad.exe") Then ; Check if the process is running.
     WinActivate("[CLASS:Notepad]", "")
EndIf

But this does not work:

#include <MsgBoxConstants.au3>

If ProcessExists("TheyAreBillions.exe") Then ; Check if the process is running.
     WinActivate("[CLASS:TheyAreBillions]", "")
EndIf

Can somebody tell me what is wrong with my WinActivate line?
Thanks a lot.

Link to comment
Share on other sites

  • Developers
34 minutes ago, Nine said:

Not sure if this question is legally acceptable in this forum...

Why this cryptic post? 
Just either report it or at least point the OP to the Forum rules.

@nwbyy, This seems to be game related, so after being here for a couple of months, one would think you know our forum rules. 
So, do read them now and ensure you adhere to them.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Jos locked this topic
Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...