Jump to content
AC Tool Forums
  • Sign Up
Perilous

Game crashes when SetActiveWindow attempted

Recommended Posts

I am brand new to using AC Tool. I am using version 5.4.0 and I am using someone else's script they swear works for them. When I start the script with two instances of the game running on the same monitor (with unique title bar names via AutoIT) it immediately crashes the one that SetActiveWindow is referencing. In Test Mode it spams the following errors:

SetActiveWindow mywow2
DELAY: 10
Testing for ALL value of 0 at 417, 363- ALL:255- Failed
Keys: 4
DELAY: 500
Keys: 3
DELAY: 3000
DELAY: 1500

I can paste the entire script if needed. Any help with this would be greatly appreciated.

Share this post


Link to post
Share on other sites

A little more info:

The SetActiveWindow command is the very first line of the script. I added a 30 sec delay on the next line and still get the same array of errors above instantly, so it definitely seems like there is something wonky right off the bat. Below is the entire script:

SetActiveWindow mywow2
Constants
// Insert constants here
XLoc1=1
YLoc1=1
X=1
End
Delay 10

Compute XLoc1={WindowLeft}+97
Compute YLoc1={WindowTop}+173

LoadRGB $XLoc1, $YLoc1

//Procedures
Procedure TargetHealee
Keys 4
While {RGBRed} = 0 AND {RGBGreen} >= 168 AND {RGBGreen} <= 177 AND {RGBBlue} = 0
LoadRGB 143, 80
If {RGBRed} = 0 AND {RGBGreen} >=150 AND {RGBBlue}=0
Else
Keys {F1}
Delay 500
Keys 3
Delay 2000
End
Set x=1
LoadRGB $XLoc1, $YLoc1
End

If {RGBRed} <> 0 AND {RGBGreen} <> 168 AND {RGBGreen} <> 169 AND {RGBGreen} <> 170 AND {RGBGreen} <> 171 AND {RGBGreen} <> 172 AND {RGBGreen} <> 173 AND {RGBGreen} <> 174 AND {RGBGreen} <> 175 AND {RGBGreen} <> 176 AND {RGBGreen} <> 177 AND {RGBBlue} <> 0
CALL HealTarget
End
End

Procedure HealTarget
While {RGBRed} <> 0 AND {RGBGreen} <> 168 AND {RGBGreen} <> 169 AND {RGBGreen} <> 170 AND {RGBGreen} <> 171 AND {RGBGreen} <> 172 AND {RGBGreen} <> 173 AND {RGBGreen} <> 174 AND {RGBGreen} <> 175 AND {RGBGreen} <> 176 AND {RGBGreen} <> 177 AND {RGBBlue} <> 0
Keys 4
Delay 500
Keys 3
Delay 3000
Delay 1500

LoadRGB $XLoc1, $YLoc1
End
If {RGBRed} = 0 AND {RGBGreen} >= 168 AND {RGBGreen} <= 177 AND {RGBBlue} = 0
Call TargetHealee
End
End

//Start The Loop
If {RGBRed} = 0 AND {RGBGreen} >= 168 AND {RGBGreen} <= 177 AND {RGBBlue} = 0
CALL TargetHealee
Else
CALL HealTarget
End

 

Share this post


Link to post
Share on other sites

A lot of code that doesn't need to be there, will have a look and see what I can find

Share this post


Link to post
Share on other sites

Your topic title, and your statement above, is that when using the SetActiveWindow command is causing the game being set active to crash. but, you never once state what game you are playing. But, I assume based on the code you later posted that you are playing WOW. So, i'll go based on that.

If that is what you are stating. then what needs to be done is to test AC Tool with using only code to set the game, and something else, as the active window.

In this spoiler is the code you posted above. I have reformatted it and rearranged the code to be easier to read. And I shortened the two If statements within the two procedures.

Spoiler

 


Constants
	// Insert constants here
	XLoc1=1
	YLoc1=1
	X=1
End

SetActiveWindow mywow2
Delay 10

Compute XLoc1={WindowLeft}+97
Compute YLoc1={WindowTop}+173

LoadRGB $XLoc1, $YLoc1

//Start The Loop
If {RGBRed} = 0 AND {RGBGreen} >= 168 AND {RGBGreen} <= 177 AND {RGBBlue} = 0
	CALL TargetHealee
Else
	CALL HealTarget
End

//Procedures
Procedure TargetHealee
	Keys 4
	While {RGBRed} = 0 AND {RGBGreen} >= 168 AND {RGBGreen} <= 177 AND {RGBBlue} = 0
		LoadRGB 143, 80
		If {RGBRed} = 0 AND {RGBGreen} >=150 AND {RGBBlue}=0
		Else
			Keys {F1}
			Delay 500
			Keys 3
			Delay 2000
		End
		Set x=1
		LoadRGB $XLoc1, $YLoc1
	End

	If {RGBRed} <> 0 AND {RGBGreen} < 168 AND {RGBGreen} > 177 AND {RGBBlue} <> 0
		CALL HealTarget
	End
End

Procedure HealTarget
	While {RGBRed} <> 0 AND {RGBGreen} < 168 AND {RGBGreen} > 177 AND {RGBBlue} <> 0
		Keys 4
		Delay 500
		Keys 3
		Delay 3000
		Delay 1500

		LoadRGB $XLoc1, $YLoc1
	End
	If {RGBRed} = 0 AND {RGBGreen} >= 168 AND {RGBGreen} <= 177 AND {RGBBlue} = 0
		Call TargetHealee
	End
End

 

 

 

 

 

But, what we need to do right now is test the setting WOW as the active window. give the following script a try. But, make sure that the game window to test with has the name mywow2 before hand.

constants
	test = {null}
end

SetActiveWindow Untitled - Notepad
delay 2 sec
Say Notepad is not the Active Window.{RETURN}
delay 2 sec
Say We are now going to make mywow2 the active window.
delay 2 sec

IsWindow mywow2 
	SetActiveWindow mywow2

	delay 10 sec

	SetActiveWindow Untitled - Notepad
	Say {RETURN} {RETURN} {RETURN} Did it work? 
else
	SetActiveWindow AC Tool*
	ShowMessage test = ERROE, OK, Game window mywow2 is not present.
end

 

Now tell us what you get when running this script.

Share this post


Link to post
Share on other sites

After starting the test script I can see it running through the steps at the bottom of the AC Tool screen. Upon executing line 13 where it sets the active windows to mywow2 World of Warcraft client immediately crashes with no error message.

In all respects the exact same behavior it exhibited with the original script. I am at a loss to explain why this keeps occurring with such a simple command.

I feel I should mention that I run the game client, and AC Tool as administrator.

Edited by Perilous

Share this post


Link to post
Share on other sites

Place your cursor over the  icon on the bottom of your screen in the taskbar to see the name of the game/program you are trying to set the active window to activate. It might not be called mywow2.

On another note, when I try to run 2 instances of ace online it does the same thing, so I only play with one account at a time.

Share this post


Link to post
Share on other sites

What would be better then to check the name from the taskbar. Is to use the Window List tool to see if mywow2 the right name.

From AC Tool, click on the Tool on the menu bar, then select Window List.

Check to see if the instance of WOW you are playing is showing up in there. And that it is has the name of mywow2.

 

If the name for the game client window is present. Then the problem may be because of WOW checking to see if AC Tool, or other scripting programs/apps, is running. To test for this we need to run AC Tool from a modified shortcut.

  1. Make a copy your AC Tool shortcut.
  2. Right click on the new shortcut.
  3. On the popup menu select Properties.
  4. On the Shortcut tab left click at the end of the Target box.
  5. Then add a space and then add /title:XXX to the end. replace XXX with new name for AC Tool*.
  6. Click on the Compatibility Tab.
  7. Click on the check box for Run this program as an administrator.
  8. Click on the General tab.
  9. In the box at the top of the tab is a box with the name of the shortcut. Change it to help you remember to use this with WOW or other games.
  10. Click on the OK button.

*What ever you do, do not use AC Tool or some form of it in the new name.

 

You now have a new shortcut to run AC Tool with a different name. Now, double click on the new shortcut and give the test script a try and lets see what happens.

 

Share this post


Link to post
Share on other sites

I have tried this while running just one client and with two clients and in both cases only mywow2 crashes during SetActiveWindow event.

The Window List Tool confirms that the client is called mywow2. I substituted mywow2 with its pID (in this case 8156) in your test script and got the same result.

I don't think there is any doubt as to when exactly in the script the client crashes, though why it is happening is still a mystery.

As stated in the OP I am running version 5.4.0 of AC Tool but I didn't mention that I am on Windows 10 x64. Could there be a incompatibility there?

Altering the shortcut for AC Tool (called it Tester) did not seem to affect the outcome. I believe you're probably right in that WoW is detecting AC Tool and shutting itself down here.

Edited by Perilous

Share this post


Link to post
Share on other sites

Let's give this a try. Download the beta version of Divide attached below. And also download the script file also attached.

 

Extract the archive to where you want. Goto to the win32 or win64 directory.

On the menu, goto File | Close All.

On the menu goto File | Open (add to project}

Navigate to the directory that you place the script file in and load it.

Now click on the Run button on the Toolbar. and lets see what happens.

And let's see what happens with Divide doing the same.

Divide.7z SetActiveTest.psc

Share this post


Link to post
Share on other sites

That seems to work using Divide! WoW comes to the foreground for a couple of seconds and doesn't crash, then I get the popup message saying that mywow2 is the active window.

Share this post


Link to post
Share on other sites

The reason I had you try Divide, is because it is using the same code to bring the game window to the front and make it the active window. And if Divide is making WOW the active window, then that confirms that WOW more than likely looking for AC Tool. Since, the script you posted above is for AC Tool. you can try changing the name of the AC Tool executable file and use a modified shortcut to change the title and see if that works.

If not, then for your system, using Divide is the only way to use scripts with WOW.

With that being the case, scripts for AC Tool would have to be converted from the AC Tool proprietary language to the Pascal like language of Divide. Most of the same commands, special variables, etc., are in Divide. I can help with the conversion for some scripts.

So, check to see if the renaming of the actool.exe file to something else, and using the modified shortcut to change it's title. and post here to see if that works. In the mean time I'll convert the script you posted above and attach it to this post when I have finished. In the event that you decide to use Divide.

Share this post


Link to post
Share on other sites

After making all of the modifications to the AC Tool executable and shortcut the WoW client still closes upon execution of the script. I wonder if it recognizes it via its CRC.

A shame there isn't an option to compile the script into an .exe

That might fool it by doing the same tasks but with an entirely different filesize and CRC.

Share this post


Link to post
Share on other sites

I just noticed a problem with the original code.  The Delay 10 you have after the SetActiveWindow is to short of a time. I don't think it would do much. but, it would be good to try the correct delay amount.

It is Delay 10 which means it delays for 10 miliseconds. change it to Delay 2 sec

 

I am working on converting the original code now.

Share this post


Link to post
Share on other sites

I'll make a note of that for the converted code if I need to make future changes, but I've still been using the test code you provided and that has it as a 2 sec delay.

Share this post


Link to post
Share on other sites

Okay, here is the converted version of the script. There is nothing wrong with the syntax. And it should work as is. I don't play WoW so I can not test it on my end.

but, if there is any problems with it doing what it is supposed to do. Let me know with a full description of what is happening.

 

For those just coming to this thread. The below script is for Divide and you can download it from the Downloads area.

WoW_Heal.psc

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.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and to our Privacy Policy.