suxxor Posted August 2, 2008 Share 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! Link to comment Share on other sites More sharing options...
Achilles Posted August 2, 2008 Share 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] Link to comment Share on other sites More sharing options...
suxxor Posted August 2, 2008 Author Share 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? Link to comment Share on other sites More sharing options...
Dampe Posted August 2, 2008 Share 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 Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted August 2, 2008 Share 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 Link to comment Share on other sites More sharing options...
Achilles Posted August 2, 2008 Share 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] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now