Jump to content

How can i ever solve this : (


Recommended Posts

While _IsPressed("01",$u32dll)
        MouseUp("left")
        sleep (500)
        MouseDown("left")

    WEnd

How can i fix this?

the Mousedown must be only active like a 0.001ms like it is now

but user cant stop the while... : (

i cant fix this : (

someelse got idea?

So user can trigger wile with LeftMouseDown and MUST also can stop it when user does LeftMouseUp.

Thx

Zanax

Link to comment
Share on other sites

next time post a working code... :\

That happend because The script is registering the _ispressed many times and do the functions many times until reached the amount of the _ispressed that the script register :S(clear?)(sorry my bad english)

If i tell you go to the kitchen once and when you come back i tell you again, and you go again, and you come back and again, theres no problem.. but if i tellyou go to the kitchen, and you dont have time to reach the kitchen and i tell you again and again and again and again, you have to go to the kitchen and go back five times despite that you are doing the first order(very bad english) i hope you understand.

If your clicks are on your GUI you can solve using Guigetcursorinfo()

Link to comment
Share on other sites

The problem with your script is the While is looking for the _IsPressed to not equal the left mouse button down. Yet, the last line in your loop presses the left mouse button down, so when it gets back to the top of the loop, it sees the button is pressed down. It will never exit the loop the way it's written.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

i know its an inf loop.

the problem is that its triggerd by the key that also has to do something : (

I cant imanage an idea for it : (

hope some else did...

@Tvern its a radio-button when its checked it must be run that while script. is that what u mean? yes > how can i fix it : D?

Edited by ZanaxNL
Link to comment
Share on other sites

@Tvern its a radio-button when its checked it must be run that while script. is that what u mean? yes > how can i fix it : D?

I don't understand a word of that. :huh2:

Here's an option that lets you use LMB as the trigger and allow the loop to exit though. (I used the from JRowe)

#include <Misc.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>

Global $iMouseDown
Global $hKey_Proc = DllCallbackRegister("_Mouse_Proc", "int", "int;ptr;ptr")
Global $hM_Module = DllCall("kernel32.dll", "hwnd", "GetModuleHandle", "ptr", 0)
Global $hM_Hook = DllCall("user32.dll", "hwnd", "SetWindowsHookEx", "int", $WH_MOUSE_LL, "ptr", DllCallbackGetPtr($hKey_Proc), "hwnd", $hM_Module[0], "dword", 0)

While Not _IsPressed("02") ;RMB to exit.
    While $iMouseDown ;When the user presses LMB $iMouseDown is 1 and the loop runs.
        ToolTip("In Loop")
        MouseDown("left") ;When the script presses LMB $iMouseDown is 2 and the loop runs.
        MouseUp("left") ;When the script releases LMB $iMouseDown is 1 and the loop still runs.
        sleep (500) ;If at any point the user released LMB $iMouseDown will become 0 and the loop exits.
    WEnd
    ToolTip("Out of loop")
    Sleep(10)
WEnd

DllCall("user32.dll", "int", "UnhookWindowsHookEx", "hwnd", $hM_Hook[0])
$hM_Hook = 0
DllCallbackFree($hKey_Proc)
$hKey_Proc = 0

Func _Mouse_Proc($nCode, $wParam, $lParam)
    Select
        Case $wParam = $WM_LBUTTONDOWN
            $iMouseDown += 1
        Case $wParam = $WM_LBUTTONUP
            $iMouseDown -= 1
    EndSelect
EndFunc
Link to comment
Share on other sites

Wow thx.

that is just what i needed.

Last thing than this is fixed : )

and i can move on.

This loop wont work combined with rightmousebutton.

When RightMouse is Down then he dont respond on the leftmousebutton for that loop : (

(Sorry my english is bad : ( )

Howto : )

Thxxx

Zanax

EDIT: lol. sorry stupid fault, just remove while NOT RMB

Edited by ZanaxNL
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...