Sign in to follow this  
Followers 0
FeeD

Simple Script

17 posts in this topic

Need a script which sends keypress "x" to Window (WOrld of Warcraft) "y" when i press "z"

Best regards,

FeeD

Share this post


Link to post
Share on other sites



i think you'll find everything you need know in the help file, if you get stuck then ask here.


Who needs puzzles when we have AutoIt!!

Share this post


Link to post
Share on other sites

Helpfile : AutoIt --> Function Reference --> Keyboard Control --> ...

As always... logic and the ability to read goes a long way.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

hum, I am a total noob @ autoIt cant somebody just write a lil script down? ^^ its 2 mins work for you, it would be 3 hours for me

Edited by FeeD

Share this post


Link to post
Share on other sites

What functions were in that category I pointed to ? Let's check their descriptions :

  • Sets a hotkey that calls a user function.
  • Sends simulated keystrokes to the active window.
I'll skip the four remaining since they aren't really functions.

So, what sounds like the function you're looking for you think ?

When you find out function which is the right one, just go straight for the example at the bottom.

Modify it and you're good to go. No need to fully understand the language for that I would think,

which I doubt is your intentions anyways.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

well yea, if I liked to send it just to the active window it would be no problem, but if i want to send it to a programm in the background... it is (for me) =\

/edit

While 1
ControlSend ("World of Warcraft", "", "", "{SPACE}")
Sleep(Int(Random(11000,13000)))
WEnd

; Function to exit script
Func EndScript()
Exit
EndFunc

something like this without a loop just reacting to a keypress

Edited by FeeD

Share this post


Link to post
Share on other sites

Here is how you do it... :)

CODE
Run("hh.exe C:\Program Files\AutoIt3\Autoit3.chm")

Share this post


Link to post
Share on other sites

Look under Related for Send.

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

ok, very nice I come step to step to what I need ^^

ControlSend ("World of Warcraft", "", "", "{SPACE}")

Now I just like to know how I can tell the script when to use it (on keypress)

ty for everything btw helge =) btw do anyone know how to tell autoit what window to use if there are two with the same name?

Edited by FeeD

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

ok, very nice I come step to step to what I need ^^

ControlSend ("World of Warcraft", "", "", "{SPACE}")

Now I just like to know how I can tell the script when to use it (on keypress)

ty for everything btw helge =) btw do anyone know how to tell autoit what window to use if there are two with the same name?

1. That's a better question. Put that in a function (between Func/EndFunc).

2. Look up HotKeySet() and use it to attach that function to the keypress you want.

3. Add a loop to keep the script running while waiting for the keypress (While/WEnd, and Sleep).

:)

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

HotKeySet("{F1}", "SendSpace")

Func SendSpace()
ControlSend ("World of Warcraft", "", "", "{SPACE}")
EndFunc

This way?

/loop is missing I know

Edited by FeeD

Share this post


Link to post
Share on other sites

This way?

Yep. I like to add another one just to make it easy to exit (ctrl-x in this case):

HotKeySet("{F1}", "SendSpace")
HotKeySet("{^x}", "_Quit") ; Ctrl-x to quit

While 1
    Sleep(20)
WEnd

Func SendSpace()
    ControlSend("World of Warcraft", "", "", "{SPACE}")
EndFunc   ;==>SendSpace

Func _Quit()
    Exit
EndFunc   ;==>_Quit

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Wow, thank you very much....

can u tell me how I can explain AutoIT which window to use? I have two windows open with the same name (cant change the names =\) but I only want to send those commands to one of them...

Share this post


Link to post
Share on other sites

Wow, thank you very much....

can u tell me how I can explain AutoIT which window to use? I have two windows open with the same name (cant change the names =\) but I only want to send those commands to one of them...

You're already doing that with the first parameter of ControlSend(): "World of Warcraft" is supposed to be the title.

The second parameter is some optional text to look for inside the window, to differentiate between multiple windows with the same title. But in games, text is usually graphically rendered and not readable.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

damn, so there is no way, is autoit choosing the first open window or something like this? ^^

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

How to tell which one is which ? When does your script start ? Before, in between or

after the processes are started ? Does your script start one, both or none of the processes ?

Some details would be nice.

Telling you would like to work with "that" but not "the other" isn't very useful information.

Edited by Helge

Share this post


Link to post
Share on other sites

well I already managed it, thank you anyway <3

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