suxxor 0 Report post Posted August 2, 2008 I'm wondering why code won't work. nothing appears to happen when I press control (11). here is a code snippet #include <Misc.au3> While 1 If _IsPressed("11") Then Teef() EndIf WEnd Func Teef() $ItemSearch = PixelSearch(250, 150, 550, 450, 0xA08D6D, 8) If Not @error Then MouseMove($ItemSearch[0], $ItemSearch[1], 0) EndIf EndFunc thanks! Share this post Link to post Share on other sites
Achilles 1 Report post Posted August 2, 2008 I'm wondering why code won't work. nothing appears to happen when I press control (11). here is a code snippet #include <Misc.au3> While 1 If _IsPressed("11") Then Teef() EndIf WEnd Func Teef() $ItemSearch = PixelSearch(250, 150, 550, 450, 0xA08D6D, 8) If Not @error Then MouseMove($ItemSearch[0], $ItemSearch[1], 0) EndIf EndFunc thanks!It actually does work... your Teef() function must not be working right. I just added a console write in the teef function and it does get called when you press Ctrl. Also, add a sleep in your main loop, just like Sleep(10) or something. My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Share this post Link to post Share on other sites
suxxor 0 Report post Posted August 2, 2008 Okay, you're right it does work. I've found an issue though. Sometimes when I press it down and release the key too quickly, it the loop continues until i hit CTRL again. What should I change to make it behave better, that is, only be active while the key is being pressed down? Share this post Link to post Share on other sites
Dampe 0 Report post Posted August 2, 2008 Okay, you're right it does work. I've found an issue though. Sometimes when I press it down and release the key too quickly, it the loop continues until i hit CTRL again. What should I change to make it behave better, that is, only be active while the key is being pressed down? Try this #include <Misc.au3> While 1 If _IsPressed("11") Then Teef() Else _Pause() EndIf WEnd Func Teef() ConsoleWrite ("sup") EndFunc Func _Pause() Sleep (10) EndFunc Share this post Link to post Share on other sites
AdmiralAlkex 116 Report post Posted August 2, 2008 Okay, you're right it does work. I've found an issue though. Sometimes when I press it down and release the key too quickly, it the loop continues until i hit CTRL again. What should I change to make it behave better, that is, only be active while the key is being pressed down?It could help with a faster loop #include <Misc.au3> $dll = DllOpen("user32.dll") While 1 If _IsPressed("11", $dll) Then $ItemSearch = PixelSearch(250, 150, 550, 450, 0xA08D6D, 8) If Not @error Then MouseMove($ItemSearch[0], $ItemSearch[1], 0) EndIf WEnd DllClose($dll) But you may also want to try HotKeySet() and/or GUISetAccelerators() .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Share this post Link to post Share on other sites
Achilles 1 Report post Posted August 2, 2008 Look at this script I made... You can easily modify it to do what you need... My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Share this post Link to post Share on other sites