Arez Posted April 8, 2006 Share Posted April 8, 2006 (edited) Here is the code I have so far: If WinExists ("Diablo II") Then WinActivate ("Diablo II") WinWaitActive ("Diablo II") $WinPos = WinGetPos ("Diablo II") Sleep(595) Opt("SendKeyDelay", 0) Sleep(0) Send("{ENTER}") Send("Test Message") Send("{ENTER}") Send("{ENTER}") Send("Testing") Send("{ENTER}") Else MsgBox(64, "Information", "Need to have DII Loaded.") Exit EndIf Func Close() EndFunc How would I transform the MsgBox part to make it so that the program would only perform its functions in a game? Edited April 8, 2006 by Arez Link to comment Share on other sites More sharing options...
herewasplato Posted April 8, 2006 Share Posted April 8, 2006 (edited) You didn't like the answers given in your other thread on this same topic?http://www.autoitscript.com/forum/index.ph...showtopic=24237Edit: What is your current script doing that you do not like? Edited April 8, 2006 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
jackyyll Posted April 8, 2006 Share Posted April 8, 2006 If WinExists ("Diablo II") Then WinActivate ("Diablo II") WinWaitActive ("Diablo II") $WinPos = WinGetPos ("Diablo II") Sleep(595) Opt("SendKeyDelay", 0) Send("{ENTER}") Send("Test Message") Send("{ENTER}") Send("{ENTER}") Send("Testing") Send("{ENTER}") Else MsgBox(64, "Information", "Need to have DII Loaded.") Exit EndIf That should be all you need... But then again, i dont really understand your question that well.. Link to comment Share on other sites More sharing options...
Arez Posted April 9, 2006 Author Share Posted April 9, 2006 The code at the bottom will not execute if Diablo II is not open. But, if it is open anywhere else, such as pre-game lobby, or basically anywhere it will still execute. I was wondering if there was a way to only have all of the code execute in game, and if they were anywhere else but in a game it'd come up with an error message saying "You must be in game to use this program". Just thought maybe there was something to use. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 9, 2006 Moderators Share Posted April 9, 2006 You could always use the "exact title" Opt('WinTitleMatchMode', 3) Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
greenmachine Posted April 11, 2006 Share Posted April 11, 2006 The Diablo II window never changes title, so any of that won't work. What you should do is check certain pixel places for colors that are only there if you're in-game (but have lots in case things are different). Or, you can just run the script when you're in a game, and you won't have to deal with any issues. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 11, 2006 Moderators Share Posted April 11, 2006 The Diablo II window never changes title, so any of that won't work. What you should do is check certain pixel places for colors that are only there if you're in-game (but have lots in case things are different). Or, you can just run the script when you're in a game, and you won't have to deal with any issues.If it's a different window, even though it has the same title, wouldn't it have a different handle? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
greenmachine Posted April 11, 2006 Share Posted April 11, 2006 If it's a different window, even though it has the same title, wouldn't it have a different handle?It keeps the same window with the same title for the entire time. Nothing changes except the graphics inside. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 11, 2006 Moderators Share Posted April 11, 2006 It keeps the same window with the same title for the entire time. Nothing changes except the graphics inside.Ahh, that explains a tad more... Guess I should play games :Nah: Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. 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