Sign in to follow this  
Followers 0
xivilization

D3D Window Help :S

9 posts in this topic

Hi, I think AutoIt3 is a great program with great potential. But, would there be a way, for it to work in D3D Windows, like, games. Here's an exemple, I got the title of the room down with AutoIt Window Info (GrandChase v08.06.13.0). I did a script using AutoIt, beginning with, WinWaitActive ("GrandChase v08.06.13.0"). Then followed by a couple of simple commands such has

--------------------------------------------------

WinWaitActive ("GrandChase v08.06.13.0")

Send("{ENTER}")

;This would enter the games chat system

Sleep(1000)

Send("This text is sent from a AutoIt3 script")

;This would type the text into the system

Sleep(1000)

Send("{ENTER}")

;This would submit my entry

Exit

--------------------------------------------------

But neither of these command would execute. Does anyone know a solution for this. And this works fine, in normal applications, created by microsoft, or whatever.

Share this post


Link to post
Share on other sites



There could be a few different reasons why this might not work. The best thing to do is see if you're getting any error codes from the script. If you set AutoIt to "Edit" instead of "Run" when you were installing it, then you'll be using the SciTE4AutoIt3 app and it has a window at the bottom that pops up if your script ever crashes, giving you the error code. I'm guessing that it's not a problem of your scripting crashing though.

The next thing is, if the game is ever updated, lets say v08.06.13.10, then the script will sit there and wait. I would use the line

'WinWaitActive ("GrandChase")'

instead of

'WinWaitActive ("GrandChase v08.06.13.0")'

because you do not need the whole title typed in. That away you don't have to update the script every time the game is updated.

Also, just because the game is "Active" doesn't mean it's loaded and ready for input. I would put a Sleep command after your first line. Also, make sure that when the game opens, pressing ENTER will take you into the chat and that you do not have to click on something else first.

Lastly, if you still have problems, you can bind and key that you don't use in the game with a function that will type in the message when pressed. You code might look something like this:

No Hotkey:

WinWaitActive ("GrandChase")

Sleep(10000);This will give the app time to make sure it is up and ready to run.
Send("{ENTER}");This would enter the games chat system
Sleep(1000)
Send("This text is sent from a AutoIt3 script");This would type the text into the system
Sleep(1000)
Send("{ENTER}");This would submit my entry
Exit

With "\" As Your Hotkey

WinWaitActive ("GrandChase")

HotKeySet("\","TypeText");This will tell the script to run the function "TypeText".

While 1
    Sleep(1);This will keep the script up and running so that it will wait for you to press the hotkey.
WEnd

Func TypeText()
    Send("{ENTER}");This would enter the games chat system
    Sleep(1000)
    Send("This text is sent from a AutoIt3 script");This would type the text into the system
    Sleep(1000)
    Send("{ENTER}");This would submit my entry
    Exit;This will cause the script to exit. Remove this line will allow you to reuse this function over and over again by running it only once.
Func

Hope that helped you out a bit.

~Flint~

Share this post


Link to post
Share on other sites

Nope.. Im pretty sure its the class of the window thats nullifying the commands.. :S.. D3D window. I think it stands for Direct3D window. So, anyone knows a fix for that? Sorry to bother ;)

Share this post


Link to post
Share on other sites

Nope.. Im pretty sure its the class of the window thats nullifying the commands.. :S.. D3D window. I think it stands for Direct3D window. So, anyone knows a fix for that? Sorry to bother ;)

Can you post a screenshot of what this application looks like? I think seeing what you're working with would help me to understand what is going on.

~Flint Brenick~

Share this post


Link to post
Share on other sites

It seems like it should be working fine. A few things. First of all, is the script actually crashing or is it just not working like you want it to? If the script is crashing, are you running it from SciTE4AutoIt3 and if so, what is the error code? If the script isn't crashing then what is it doing/not doing?

....While writing this I think I might know what one of the problems are. Trying adding the line:

WinActive("GrandChase")

To the beginning of the script. The WinWaitActive command will pause the script but it will not tell the window to become active. If I remember correctly, you must use the command WinActive to make the window active and then WinWaitActive so that the script will not continue if the window is not ready yet. You may want to try this code instead:

HotKeySet("-","ExitScript");This will exit the script.
HotKeySet("=","TypeText");This will tell the script to run the function "TypeText".

ToolTip("Press '-' To Exit" & Chr(13) & "Press '=' To Send Message",0,0);This will make a tooltip appear in the top left corner of the screen and tell you which keys do what.

WinActive("GrandChase");This will tell the window to activate.
WinWaitActive ("GrandChase");This will force AutoIt to wait until the game has actually became active.
Send("{ENTER}");This woill enter the game's chat system.

While 1
    Sleep(1);This will keep the script up and running so that it will wait for you to press the hotkey.
WEnd

Func ExitScript();This will let you exit the script with a push of a button.
    Exit
EndFunc

Func TypeText()
    WinActive("GrandChase");Resend these commands incase the game has been minimized since you last presses '='.
    WinWaitActive ("GrandChase")
    Send("This text is sent from an AutoIt3 script.");This will type the text into the chat system.
    Send("{ENTER}");This will submit the entry.
    Exit;This will cause the script to exit. Remove this line will allow you to reuse this function over and over again by running it only once.
EndFunc

If this does not work, then let me know actually what about it isn't working. You can also look into using the "ControlSend" command instead of the "Send" command if you're still having problems.

~Flint Brenick~

Share this post


Link to post
Share on other sites

it's not crashing. The autoscript is actually running. I see it on the tray. But, nothing is happening. And after all the ''sleeps'' & ''Send''. The due time, it will close. Do you have teamviewer? It would make everything easier. ;)

Share this post


Link to post
Share on other sites

What do you mean by teamview?

Try this script:

HotKeySet("-","ExitScript");This will exit the script.
HotKeySet("=","TypeText");This will tell the script to run the function "TypeText".

ToolTip("Press '-' To Exit" & Chr(13) & "Press '=' To Send Message",0,0);This will make a tooltip appear in the top left corner of the screen and tell you which keys do what.

WinActive("GrandChase");This will tell the window to activate.
Sleep(3000)
Send("{ENTER}");This woill enter the game's chat system.

While 1
    Sleep(1);This will keep the script up and running so that it will wait for you to press the hotkey.
WEnd

Func ExitScript();This will let you exit the script with a push of a button.
    Exit
EndFunc

Func TypeText()
    WinActive("GrandChase");Resend these commands incase the game has been minimized since you last presses '='.
    Sleep(800)
    Send("This text is sent from an AutoIt3 script.");This will type the text into the chat system.
    Send("{ENTER}");This will submit the entry.
    Exit;This will cause the script to exit. Remove this line will allow you to reuse this function over and over again by running it only once.
EndFunc

Share this post


Link to post
Share on other sites

Umm.. It's like windows remote assistance. Just much easier and accesible.

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