Jump to content

Simple Mouse Click Help


Trevor
 Share

Recommended Posts

Total AutoIt noob here ... I'm not looking for a fully automated script just yet. My intention is to write a script that will allow my mouse button to click initially and then repeat at a given interval until the mouse button is released. This way I can hold the mouse button down and the script will do the timing for me until I release the click. Any help is appreciated, even just pointing me in the right direction.

Link to comment
Share on other sites

Just a quick question, why do you require such a script? What's its usage?

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Repetitive tasks that require multiple mouse-clicks. As much as I am working with my PC I'd like a way to not have to click...click...click any more. Just one click set to an interval if I hold the click, or just one click if I click.

Simplifying this small task would be a huge help in daily tasks.

Link to comment
Share on other sites

Still looking for a simple way to simplify a delayed mouse click ... I didn't think it would be this difficult.

If you search in the help file, i trust youll find something, then, when you have doubts, come back and state them.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

Detecting the first mouse click is trickier than it sounds. The easiest approach is to make a loop, and use the _IsPressed function to see if the mouse button is pressed. Once that's done, then take a look at MouseClick and AdlibRegister. Here's something to get you started. The main loop requires a bit of thinking. If you can figure out what the loop is actually doing and when the variables will be set/unset then you can probably understand most of all programming logic.

#include <Misc.au3>

Local $fClicking = False ; This variable will store whether we are doing the auto-clicking
Local $fPressed = False ; Another variable, will store whether the mouse button was pressed last iteration of the loop
While 1
    If $fClicking Then
        If _IsPressed("01") Then
            $fPressed = True
        Elseif $fPressed Then
            $fPressed = False
            $fClicking = False
            AdlibUnRegister("ClickFunction")
        EndIf
    Else
        If _IsPressed("01") Then
            $fPressed = True
        ElseIf $fPressed Then ; The mouse was pressed, but is now released
            $fClicking = True
            $fPressed = False
            AdlibRegister("ClickFunction", 1000)
        EndIf
    EndIf

    Sleep(10) ; If you don't sleep in a tight loop like this, your cpu will be very high
WEnd

Func ClickFunction()
    MouseClick("left")
EndFunc   ;==>ClickFunction
Link to comment
Share on other sites

Detecting the first mouse click is trickier than it sounds. The easiest approach is to make a loop, and use the _IsPressed function to see if the mouse button is pressed. Once that's done, then take a look at MouseClick and AdlibRegister. Here's something to get you started. The main loop requires a bit of thinking. If you can figure out what the loop is actually doing and when the variables will be set/unset then you can probably understand most of all programming logic.

#include <Misc.au3>

Local $fClicking = False ; This variable will store whether we are doing the auto-clicking
Local $fPressed = False ; Another variable, will store whether the mouse button was pressed last iteration of the loop
While 1
    If $fClicking Then
        If _IsPressed("01") Then
            $fPressed = True
        Elseif $fPressed Then
            $fPressed = False
            $fClicking = False
            AdlibUnRegister("ClickFunction")
        EndIf
    Else
        If _IsPressed("01") Then
            $fPressed = True
        ElseIf $fPressed Then ; The mouse was pressed, but is now released
            $fClicking = True
            $fPressed = False
            AdlibRegister("ClickFunction", 1000)
        EndIf
    EndIf

    Sleep(10) ; If you don't sleep in a tight loop like this, your cpu will be very high
WEnd

Func ClickFunction()
    MouseClick("left")
EndFunc ;==>ClickFunction

I appreciate the heads up on this, I have been reading through the help file to no avail. This is all new to me and every time I write something it just takes off on its own until I end the script.

I didn't expect anyone to do all of the work, just give a little help and point me in the right direction.

This helped a lot!

Thanks a million!

Link to comment
Share on other sites

I appreciate the heads up on this, I have been reading through the help file to no avail. This is all new to me and every time I write something it just takes off on its own until I end the script.

I didn't expect anyone to do all of the work, just give a little help and point me in the right direction.

This helped a lot!

Thanks a million!

I did the easy bit: writing it. It's up to you to understand it (which is not as easy as it sounds).

And also my pseudo code usually ends up as AutoIt code anyway. Unsure if that's a good or a bad thing yet.

Link to comment
Share on other sites

And also my pseudo code usually ends up as AutoIt code anyway. Unsure if that's a good or a bad thing yet.

Is it pseudo code anymore? hmm ... there's pause for thought.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

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