Jump to content

Blockinput While Mouse Button Is Being Pressed


Recommended Posts

I was bug testing a script to see if I could make it fail. Normally, the script will work as expected.

$INIin = IniRead("bin\unplus.ini", @UserName, "speed", "")
 If WinExists("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.") Then
  WinActivate("Microsoft Internet Explorer", "[239] Sorry, your session has timed out.")
 ElseIf $INIin == "normal" Then
  $mschk1 = PixelSearch(1, 133, 1400, 133, 0x9CC6E7);266 is pixel I'm looking for
;MsgBox(0, "","X =" & $mschk1[0] & "  Y = " & $mschk1[1])
  $xm = $mschk1[0]+453
  $xm1 = $mschk1[0]+391
  $xn = ($XM + 97)
  ControlSend("Unicenter ServicePlus Service Desk", "", "Internet Explorer_Server1", "!e", 0)
  Sleep(5)
  ControlSend("Unicenter ServicePlus Service Desk", "", "Internet Explorer_Server1", "i", 0)
  WinWait( "Unicenter ServicePlus Service Desk", "Opening", 1)
  Sleep(200)
  WinWait( "Unicenter ServicePlus Service Desk - Incident Search", "Done", 3)
  $x = 1
  while 7 
   WinActivate("Unicenter ServicePlus Service Desk - Incident Search", "Done")
   $colorwin = PixelSearch($xm1, 402, $xm1 + 10, 414, 14079694)
   if @error = 1 then 
    sleep(2)
   Else
    ExitLoop
   EndIf 
  WEnd
  BlockInput(1)
  $mschk = MouseGetPos()  
  MouseClick("left", $xm , 263, 1, 0)
  sleep(5)
  mousemove($mschk[0], $mschk[1], 0) 
  _F3_chk1()
  $g = 1
  While 2 
  $g = $g + 1   
  $search1 = IniRead("bin\unplus.ini", @UserName, "searchincident", "")
  $info = string(ClipGet())
  if $search1 = $info then 
   ExitLoop
  Elseif $g = 10 then
   ExitLoop 
  Else
   _F3_chk1()
  EndIf 
  wend
  BlockInput(0)
  sleep(100)
  send("!s")

What I did was hold down the mouse button while this script ran. I had a failure of the script, in that the mouse curser went to the far left of the screen and stayed there. From what I can tell, the mouseclick I call for isn't occuring. Any idea for a work around? Oh, and I have to use send, for controlsend isn't as stable with this application that I'm dealing with. (no idea why on that one)

Edited by vollyman
Link to comment
Share on other sites

What I did was hold down the mouse button while this script ran. I had a failure of the script, in that the mouse curser went to the far left of the screen and stayed there. From what I can tell, the mouseclick I call for isn't occuring. Any idea for a work around? Oh, and I have to use send, for controlsend isn't as stable with this application that I'm dealing with. (no idea why on that one)

MouseClick is effectively (not actually) a combination of these functions:

MouseMove -> MouseDown -> MouseUp

Since the button was already down, the "MouseDown" doesn't actually change anything.

Changing this

MouseClick("left", $xm , 263, 1, 0)
to
MouseUp("left")
MouseClick("left", $xm , 263, 1, 0)
should work.

I didn't run your script, but I duplicated the problem in code.

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

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...