Sign in to follow this  
Followers 0
Eradicator

Window created

7 posts in this topic

Greetings,

I need a piece of code to fire whenever a window with the title, for example, "Untitled - Notepad" is created (IE. you just double clicked Notepad.exe and it opened.) How can I accomplish this? Thanks in advance!

Regards,

Eradicator

Share this post


Link to post
Share on other sites



That won't accomplish what I need. This code block can only fire when the window is originally created, that code would fire every second as long as the window is open. Thanks for trying though.

Regards,

Eradicator

Share this post


Link to post
Share on other sites

If you only want it to fire once add ExitLoop to the code you add when it finds the window.

Not sure whether that would work either, I probably should have thought to include the whole thing in my first post. My program is a utility for a multiplayer game. The program is not dependent on the game being run, however. The program just checks when you use a hotkey whether you are in the game window and proceeds from there. The program needs to fire a piece of code whenever the user connects to a new server, which means that the player will exit the game and then the game will re-open. I think if I use exit-loop in the while loop it will only fire when you open the game the very first time. What do you think I should do? Thanks in advance!

Regards,

Eradicator

Share this post


Link to post
Share on other sites

Hmm, that's a bit of a tough question. You could try something like

While 1
If WinExists("Untitled - Notepad") And $check = 1 Then
;do something here
$check = 0
Else
Sleep(1000)
Endif
WEnd

Then use HotKeySet to call a function to set $check to 1 when you're about to connect to a different server since you should know when you are. Also quick question, is this for F.E.A.R.?

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Hmm, that's a bit of a tough question. You could try something like

While 1
If WinExists("Untitled - Notepad") And $check = 1 Then
;do something here
$check = 0
Else
Sleep(1000)
Endif
WEnd

Then use HotKeySet to call a function to set $check to 1 when you're about to connect to a different server since you should know when you are. Also quick question, is this for F.E.A.R.?

No, it isn't. This is being used for San Andreas: Multiplayer. There is a server where its important to use specific commands on other players quickly, and I found it inefficient to be typing it myself. I thought of a way to get your code to work, all I need to do is this in a while loop.

If WinExists("GTA:SA:MP") And $check = 1 Then
;Do code.
        $check = 0
    Else
        $check = 1
    Endif

Regards,

Eradicator

Edited by Eradicator

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0