Jump to content

Is it possible?


Recommended Posts

is it possible to sends simulated keystrokes and mouse clicks to the inactive window? how to perform such action??any1 can give me some clue??

Use commands like ControlClick() and ControlCommand(), to access windows that are not active.

:whistle:

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
Link to comment
Share on other sites

  • Moderators

game...........exe file :)

is it possible??

just slimply pressing "R" should be fine......then i can do orther thing :whistle:

As PsaltyDS said, look at the Control* functions in the Help File.

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

help me :) Im stuck :whistle:

after going through the help file....

finally my code come out........it working fine.....

but got 1 problem......i cant send keystrok F1~F12

i go through help file again...but cant find any cle how to deal wit it

can some1 guide me??

===========================================================

AutoItSetOption("WinTitleMatchMode", 4)

$handle = WinGetHandle("classname=Sword3 Class", "")

If @error Then

MsgBox(4096, "Error", "Could not find the correct window")

Else

ControlSend($handle, "", "", ("m"))

EndIf

=============================================================

Edited by ynglee
Link to comment
Share on other sites

i already settle the F1~F12 problem :whistle:

help me see tis script:

#include <GuiConstants.au3>

Opt("GUIOnEventMode", 1)

AutoItSetOption("WinTitleMatchMode", 4)

$handle = WinGetHandle("EMEI", "")

GuiCreate("MyGUI", 128, 212,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Checkbox_1 = GuiCtrlCreateCheckbox("Healing", 10, 10, 110, 60)

GUICtrlSetOnEvent($Checkbox_1, "Healing")

$Checkbox_2 = GuiCtrlCreateCheckbox("Double Ring", 10, 80, 110, 60)

GUICtrlSetOnEvent($Checkbox_2, "DoubleRing")

$Button_3 = GuiCtrlCreateButton("Exit", 20, 160, 80, 40)

GUICtrlSetOnEvent($Button_3, "Exit1")

GuiSetState(@SW_SHOW)

While 1

Sleep(100)

WEnd

func Healing()

While 1

ControlSend($handle, "", "", "c")

sleep(1000)

WEnd

EndFunc

Func DoubleRing()

while 1

ControlSend($handle, "", "", "x")

sleep(300)

ControlSend($handle, "", "", "z")

sleep (400)

WEnd

EndFunc

Func Exit1()

Exit

EndFunc

i want to perform such action:

when i check checkbox1,itcarry out Action1

when icheck checkbos2,it carry out Action2

when check both out,both olso run

what command i need to perform such action?(inned them perform continuely until i press exit

i try use [while1....action1.....wend]tomake a loop...but like tat it cant carry out action2 cos cannot jumpout the loop1

im a newbie n not familiar wit the autoit,any help will be appriciated......

Link to comment
Share on other sites

i already settle the F1~F12 problem :)

help me see tis script:

i want to perform such action:

when i check checkbox1,itcarry out Action1

when icheck checkbos2,it carry out Action2

when check both out,both olso run

what command i need to perform such action?(inned them perform continuely until i press exit

i try use [while1....action1.....wend]tomake a loop...but like tat it cant carry out action2 cos cannot jumpout the loop1

im a newbie n not familiar wit the autoit,any help will be appriciated......

If I understand what you're trying to do (by no means certain), I don't think you want to try and trigger events off a checkbox. Perhaps your loop could simply continuously check their state? The other problem here is there is no exit from you loop in the functions Healing() and DoubleRing(), but the loops are not needed if you continually check the status of the checkboxes. Both functions will be repeated as long as checked, and will stop when unchecked.

Maybe this:

#include <GuiConstants.au3>

Opt("GUIOnEventMode", 1)
AutoItSetOption("WinTitleMatchMode", 4)

$handle = WinGetHandle("EMEI", "")

GuiCreate("MyGUI", 128, 212,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$Checkbox_1 = GuiCtrlCreateCheckbox("Healing", 10, 10, 110, 60)
$Checkbox_2 = GuiCtrlCreateCheckbox("Double Ring", 10, 80, 110, 60)
$Button_3 = GuiCtrlCreateButton("Exit", 20, 160, 80, 40)
GUICtrlSetOnEvent($Button_3, "Exit1")
GuiSetState(@SW_SHOW)

While 1
     If GuiCtrlGetState($Checkbox_1) = $GUI_CHECKED Then Healing()
     If GuiCtrlGetState($Checkbox_2) = $GUI_CHECKED Then DoubleRing()
     Sleep(100)
WEnd

func Healing()
     ControlSend($handle, "", "", "c")
     sleep(1000)
EndFunc

Func DoubleRing()
     ControlSend($handle, "", "", "x")
     sleep(300)
     ControlSend($handle, "", "", "z")
     sleep (400)
EndFunc

Func Exit1()
     Exit
EndFunc

:whistle:

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
Link to comment
Share on other sites

PsaltyDS :whistle: can u check ur script again??didn't work for me :)

i guess is this part went wrong

While 1

If GuiCtrlGetState($Checkbox_1) = $GUI_CHECKED Then Healing()

Sleep(100)

If GuiCtrlGetState($Checkbox_2) = $GUI_CHECKED Then DoubleRing()

Sleep(100)

WEnd

cos when i check the box it do nothing

then i try to change

If GuiCtrlGetState($Checkbox_1) = $GUI_CHECKED Then ControlSend($handle, "", "", "c")

sleep(1000)

didnt work as well......i look in help file aready, the information about the syntax is so limited

Link to comment
Share on other sites

  • Moderators

Are you sure this game even lets you send "simulated" key strokes?

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

  • Moderators

yup :whistle:

Then change these 2 lines:
If GuiCtrlGetState($Checkbox_1) = $GUI_CHECKED Then Healing()
     If GuiCtrlGetState($Checkbox_2) = $GUI_CHECKED Then DoubleRing()oÝ÷ Ù:ºÚ"µÍY][
ÕRPÝXY
    ÌÍÐÚXÚÐÞÌJK ÌÍÑÕRWÐÒPÒÑQ
H[X[[Ê
BY][
ÕRPÝXY
    ÌÍÐÚXÚÐÞÌK  ÌÍÑÕRWÐÒPÒÑQ
H[ÝXT[Ê
And see if that works.

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

  • Moderators

finaly :) work fine :whistle:

thanks a lot :)

Your welcome, I don't use GUICtrlGetState() often (Never have in fact), maybe if you use GUICtrlRead($CheckBox_1) instead of just $CheckBox_1 it might have worked? I don't know to be honest... I always use BitAnd() personsally.

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

Your welcome, I don't use GUICtrlGetState() often (Never have in fact), maybe if you use GUICtrlRead($CheckBox_1) instead of just $CheckBox_1 it might have worked? I don't know to be honest... I always use BitAnd() personsally.

Ouch. Completely missed that! Thanks for the educational correction, SmOke_N!

:P

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...