Jump to content

Recommended Posts

Posted

Hello

 

I have a small code, and i want to freeze the mouse movement, I need a very simple solution,, I've tried Mouse Trap,, but didn't success,   i'm new to this..

  • Moderators
Posted

@Dr_TDM welcome to the forum. As you are new, you may have missed the fact that we can't help much without being able to see your "small code". Otherwise, you're asking us to first guess at what you're trying to accomplish and then troubleshoot for you. Please help us help you by posting your code ;) 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Posted

Does the _Mousetrap example script work for you?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

thanks JLogan3o13 for the reply,, i have no problem posting the code,, but i remember i once read in one of the threads, that  the member should not say why the script is for or post it,, otherwise it will be deleted,,  anyways..

 

i need the mouse to be clicking every one minute,, but in te same spot that i leave the mouse when i start the function,,,

 

i have managed to make a step foward with help from trojan55  

but either the (mouseclick) works or the (mousemove),,, but couldn't do both...

 

so here is the code

Global $Paused
HotKeySet("{PGDN}","_Start")
HotKeySet ("{PGUP}", "TogglePause")
HotKeySet ("{Delete}", "_Freeze")

Func _Freeze()
   $pos = MouseGetPos()
    While 1
    MouseMove($pos[0],$pos[1])
    WEnd
 EndFunc

Func _Start()

      For $a = 1 to 1000 step 1
   MouseClick ("Left")
   Sleep (60000)
   Next


EndFunc


While 1
    Sleep(10000)
WEnd

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc
 

 

 

Posted

also i've tried combining the two functions to start with one hotkey but it is the same,,, only one function starts

 

Func _Freeze()
   $pos = MouseGetPos()
    While 1
    MouseMove($pos[0],$pos[1])
    WEnd
   For $a = 1 to 1000 step 1
   MouseClick ("Left")
   Sleep (3000)
   Next


 EndFunc

Posted
4 minutes ago, Dr_TDM said:

but i remember i once read in one of the threads, that  the member should not say why the script is for or post it,, otherwise it will be deleted

If this means we are talking about game autoamtion here then you can be sure that not only your code will be removed but the thread will be blocked as well.
So it would greatly help if you could tell us which program you try to automate :)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

water thank you,,, but the idea of the Mousetrap is good,, but i couldn't do it,,,

 

i don't know what is the #include for,

Posted

Dog ate your help file? The explanation what the statement is for is just a click away :)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

  • Moderators
Posted

@Dr_TDM I agree with water, since you opened the door please explain exactly what you're trying to accomplish with 

Quote

i need the mouse to be clicking every one minute,, but in te same spot that i leave the mouse when i start the function,,,

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Posted

@JLogan3o13 @water

It's not a game issue,, i have a problem with windows,, it keeps removing the selection from my current window, so it becomes inactive and then the keyboard strokes don't do anything...

I need the code to keep clicking the mouse so the window that i'm working on keeps active,, most of my work is on excel and i mostly use the keyboard. 

 

I tried to fix it but could't,, and the service guy adviced to install a new windows,, but i cannot because i have a lot of programes that will take days to re-install and configure..

So this code is a simple solution for me...

Posted

When working with Excel you shouldn't automate the GUI but use the Excel UDF that comes with AutoIt. So your scripts will become much more reliable.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

Suggestion:

Instead of trying to make it so the mouse can't move, instead have the program start with a snapshot of the mouse's current location when the program starts, and then always click there even if the mouse has moved.

Local $sleep = 60*1000 ; 1 minute, adjust as necessary
Local $orig_pos = MouseGetPos()
While True
    Sleep($sleep)
    Local $new_pos = MouseGetPos()
    MouseClick("Left", $orig_pos[0], $orig_pos[1], 1, 0)
    MouseMove($new_pos[0], $new_pos[1], 0)
    ConsoleWrite("Clicked" & @LF)
WEnd

 

How's my riding? Dial 1-800-Wait-There

Trying to use a computer with McAfee installed is like trying to read a book at a rock concert.

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
  • Recently Browsing   0 members

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