Sign in to follow this  
Followers 0
TK_Incorperate

Script to work only inside of a program?

20 posts in this topic

Ok..... me and a friend are making a game, and we are in the testing phase of it, finding bugs, ect.... and i need to test alot of stuff but at the same time i have many things on my computer i need to do....

Is there any way to attach a script directly to a program (namely the program is called Shadow Realm) and let it run in there, but still be aply to type/browse freely without it taking effect on the rest of your computer? i've searched the help file throu and throu and havent found anything, but if this was possible it would be a GREAT help, if it's not then as a suggestion could you put it in the next version of AI?

Thanks in advance, any answer will satisfy me as long as i get an answer and it's truthfull hehe ;)

-TK

Share this post


Link to post
Share on other sites



Ok..... me and a friend are making a game, and we are in the testing phase of it, finding bugs, ect.... and i need to test alot of stuff but at the same time i have many things on my computer i need to do....

Is there any way to attach a script directly to a program (namely the program is called Shadow Realm) and let it run in there, but still be aply to type/browse freely without it taking effect on the rest of your computer? i've searched the help file throu and throu and havent found anything, but if this was possible it would be a GREAT help, if it's not then as a suggestion could you put it in the next version of AI?

Thanks in advance, any answer will satisfy me as long as i get an answer and it's truthfull hehe ;)

-TK

I am not sure this is what you meaning, but maybe you can create a child window in the game:

GUICreate ("title",(width),(height),(left),(top),$WS_CHILD,WinGetHandle("title of your game","Text in your game"))

This creates a GUI embedded in your game...

It will not have caption etc.

If you want that replace $WS_CHILD with $WS_CHILD+$WS_CAPTION+$WS_SYSMENU

Use AutoIt Window Info to search the title of your game and the text in your game.

If it hasnt a title/text, place this at the top of your script:

Opt("WinTitleMatchMode",4).

Now place this in the title:

classname=Here the classname, find it with AutoIt Window Info

Almostly all windows have classname.

Hope it helps u.


Sorry for my English, I'm Dutch... =DMedia UDFINet Adv UDF

Share this post


Link to post
Share on other sites

im not sure what you mean by that stuff you posted lol... but i'll make what i meant more understandable....

What i need is to attach my script ONLY! to the game, so i can have my script testing the game for me, while i can freely do stuff OUTSIDE of the game, (typing, clicking, browsing, ect.) without the clicks and movements that are going on inside of the game.... is this possible?

Share this post


Link to post
Share on other sites

anybody know? if so PLEASE help me... if not then at least tell me it isnt possible so ill quit lookin for sumtin dat dont exist, lol but please tell me if it's possible... it's important that i find something that can do this

Share this post


Link to post
Share on other sites

i think what you are looking for is minimized click. i think the UDF is control_click. try searching the forum for it.

Share this post


Link to post
Share on other sites

i think what you are looking for is minimized click. i think the UDF is control_click. try searching the forum for it.

minimized click? lol i know how to have my game minimized but still have auto-it work in it, the problem is... once i click away from the game, like if i click ANYWHERE on the screen, it automaticaly detaches from the game.... i want this to attach itself to Shadow Realm (my game) and KEEP itself attached while i do other stuff (in firefox, notepad, messangers, ect.) but i DONT want the effects (like pressing z, e, q, ect.) to take place in firefox, notepad, ect....

as far as minimized click, no clue wut dat is lol....

Share this post


Link to post
Share on other sites

as far as minimized click, no clue wut dat is lol....

A 'minimised click' is a click in a window that's minimised or otherwise not visible on the screen.

AutoIt is capable of automating standard windows in the background via the use of ControlClick(), ControlSend() etc. If your game consists of a standard Windows GUI (text fields, buttons, menus etc.) then it should be quite easy to automate as needed. Try using AutoIt Window Info on your game window to see if any information can be read. Place your mouse cursor over the different clickable/editable elements of the game screen to see what comes up. If nothing useful comes up then you're out of luck.

It's harder to 'automate' games because generally games are designed to be played by a human! ;) You will probably need to do your testing by hand.

Share this post


Link to post
Share on other sites

well i just want it to send certain keys inside of the game.... not completely play it, but it's not just a regular window...... it's a fullscreen program, lol so im guessing that means this isnt possible with autoit?

Share this post


Link to post
Share on other sites

try controlsend

More specifically, try using ControlSend() without specifying a control ID since your game window is likely not to have one:

ControlSend("Game window title", "", "", "Keys to send")

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

ok so limmy get this strait, if i wanna send S, sleep for 2 seconds, then send Z, it'd look like this?

ControlSend("Shadow Realm", "S")
      Sleep(2000)
   ControlSend("Shadow Realm", "Z")

right???

Edited by TK_Incorperate

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Almost right:

ControlSend("Shadow Realm", "", "", "s")
Sleep(2000)
ControlSend("Shadow Realm", "", "", "z")

Note the lowercase S and Z because otherwise it'll send Shift+key.

Edited by LxP

Share this post


Link to post
Share on other sites

do i hafta have all those blank ,"" things??

Share this post


Link to post
Share on other sites

Yes -- ControlSend() expects four parameters. If you try it with just two then AutoIt will throw an error at you. You could have found this out for yourself by trying it, you know... ;)

Share this post


Link to post
Share on other sites

Yes -- ControlSend() expects four parameters. If you try it with just two then AutoIt will throw an error at you. You could have found this out for yourself by trying it, you know... ;)

LOL, but who wants to go through trial and error when you can be handed the solution?

---"Educate the Mind, Make Savage the Body" -Mao Tse Tung

Share this post


Link to post
Share on other sites

LOL, but who wants to go through trial and error when you can be handed the solution?

...

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

@ w0uter & LxP:

I've seen both of you suggest using a blank ControlID with ControlSend when the target window has no controls.

I've had only limited success with this method. (See my last post in the following topic)

Could you please check out this topic and let me know what your thoughts are?

http://www.autoitscript.com/forum/index.php?showtopic=16867

Thanks, guys!


[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites

Hi Skruge,

How embarrassing -- I've suggested this usage of ControlSend() a couple times now and after actually testing it with the following code:

Opt("WinWaitDelay", 0)
Opt("WinTitleMatchMode", 2)

Local Const $NP = "metapad"
Local Const $CALC = "Calculator"

Run("metapad")
Run("Calc")

WinWait($NP)
WinWait($CALC)

WinActivate($CALC)
WinWaitActive($CALC)

Local $Return = ControlSend($NP, "", "", "Testing...")
MsgBox(0x40 , "ControlSend()", "Return value is " & $Return)

I find that it doesn't work as expected. Perhaps no one has actually tested this but instead heard that it works from someone else -- it's interesting how false ideas can propagate like this. Now to find the original poster of this suggestion... ;)

Incidentally the value returned by ControlSend() indicates success, which suggests that it is in fact designed to work this way... I would expect it to choose the control with focus by default.

Share this post


Link to post
Share on other sites

Hi Skruge,

How embarrassing -- I've suggested this usage of ControlSend() a couple times now and after actually testing it with the following code:

Opt("WinWaitDelay", 0)
Opt("WinTitleMatchMode", 2)

Local Const $NP = "metapad"
Local Const $CALC = "Calculator"

Run("metapad")
Run("Calc")

WinWait($NP)
WinWait($CALC)

WinActivate($CALC)
WinWaitActive($CALC)

Local $Return = ControlSend($NP, "", "", "Testing...")
MsgBox(0x40 , "ControlSend()", "Return value is " & $Return)

I find that it doesn't work as expected. Perhaps no one has actually tested this but instead heard that it works from someone else -- it's interesting how false ideas can propagate like this. Now to find the original poster of this suggestion... ;)

Incidentally the value returned by ControlSend() indicates success, which suggests that it is in fact designed to work this way... I would expect it to choose the control with focus by default.

yeah i was going to post that yesterday after skruge's posts in another thread i tested on my own, i couldn't get it to send even to notepad without a control id. after i added just the control id to the line that wasn't working, it went fine for me....

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

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