Eradicator Posted August 23, 2008 Share Posted August 23, 2008 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 Link to comment Share on other sites More sharing options...
dbzfanatic Posted August 23, 2008 Share Posted August 23, 2008 While 1 If WinExists("Untitled - Notepad") Then ;do something here Else Sleep(1000) Endif WEnd Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Link to comment Share on other sites More sharing options...
Eradicator Posted August 23, 2008 Author Share Posted August 23, 2008 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 Link to comment Share on other sites More sharing options...
dbzfanatic Posted August 23, 2008 Share Posted August 23, 2008 If you only want it to fire once add ExitLoop to the code you add when it finds the window. Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Link to comment Share on other sites More sharing options...
Eradicator Posted August 23, 2008 Author Share Posted August 23, 2008 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 Link to comment Share on other sites More sharing options...
dbzfanatic Posted August 23, 2008 Share Posted August 23, 2008 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.? Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Link to comment Share on other sites More sharing options...
Eradicator Posted August 23, 2008 Author Share Posted August 23, 2008 (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 August 23, 2008 by Eradicator Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now