Results 1 to 11 of 11
  1. #1
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442

    Simulating mouse movement and clicking....


    I want to use VBA to move my mouse and simulate several mouse clicks at several points on my screen. I used to have a database that did this sort of thing but I've misplaced it. Anyone got some handy dandy code or an example database that allows for the mouse to move out of the application and (i.e. to a web page) and still force mouse clicks.

    I probably should have attempted to recode this rather than spending 3 hours looking for my previous database

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,523
    computers are digital, you dont have to use an analog mouse to move and click,
    you just activate the click item.

    you dont count from 1 to 6 to get the 6, you just call for 6.

  3. #3
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    you have completely missed my question. I do not need the click event, or the mouse down, or the mouse up event. I want to have a timed event to execute in the morning prior to the time anyone is in the office to perform some actions on a website rather than having to do it each day/every other day. Getting it to start is not the problem, getting it to start at the right time is not the problem, simulating the mouse movement/actions is.

  4. #4
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,974
    I'm unclear what exactly you're trying to do.

    If you were in the office, could this be achieved with a procedure involving several steps in sequence?
    E.g open a url, download the latest data and process the data.

    If so, make this sequence of actions into a function and run it from the autoexec macro or a startup form.
    Then use the task scheduler to run your database at a specified time e.g. 04:00

    If that won't work for some reason, please provide more detail about what you are trying to do.
    Last edited by isladogs; 07-28-2018 at 04:30 PM.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  5. #5
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,411
    you probably need the setcursorpos function for what you are asking for

    https://docs.microsoft.com/en-us/win...r-setcursorpos

  6. #6
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,784
    Maybe a product like MouseRecorder, if it can be coupled with Windows Task Scheduler and would run when opened? I've used similar programs (an old version of Windows had such a thing) but it had hotkeys for macro actions (mouse and keyboard). Or what about modifying the files on the web server to modify content rather than doing so by web forms? Sorry if that doesn't help - just trying to provide options.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  7. #7
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    My goal is something akin to a mouse recorder program where i may want to save several different setups to download things from several different websites (datasets that are typically under the same link on the same website each week). Normally I would download a free product and install it but the network I'm on won't allow it so ideally I'd like to build my own. I'm leaving a browser up with the two tabs (currently) I need to download things from, what I need is a way to have this database running overnight and at a specific time (not having trouble with this part) simulate mouse movement and button clicks outside the database window (on the websites, move a mouse to a link, simulate the click, simulate the another click to accept the default name and download the file, click the second tab of the browser window, perform the same basic set of instructions with different coordinates). Most of the code I've seen so far only applies to the database window and moving things around within it, I need the mouse controls to perform across 2 or 3 monitors. Frankly, even a segment of code that sets the mouse at a specific position and performs a click is all I need everything else I've got.

  8. #8
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Is this what you're talking about with setcursorpos?

    https://wellsr.com/vba/2015/excel/vb...e-click-macro/

  9. #9
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,974
    Just a thought. Assuming code like that works in Access, could you use a VBA to click on a button in a web browser control within your Access app.
    That should make coding much easier though it would limit you to one monitor at a time.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  10. #10
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,411
    Is this what you're talking about with setcursorpos?
    I've not used it but looks like it


    also found this

    https://stackoverflow.com/questions/...n-on-a-website

  11. #11
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    https://wellsr.com/vba/2015/excel/vb...e-click-macro/

    The code in the website I linked previously is exactly what I wanted. Also re-linked above.

    I'm not sure how far I'm going to take this database but I'll post the finished product if anyone is interested (will likely be a few weeks though)

    Thanks for the heads up, it helped me find what I needed.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Mouse Move Event - End if Mouse not Hovering
    By Tandem in forum Programming
    Replies: 3
    Last Post: 05-24-2016, 12:38 PM
  2. Replies: 2
    Last Post: 09-15-2015, 03:08 AM
  3. Replies: 9
    Last Post: 08-20-2013, 09:59 AM
  4. Simulating a Multivalue Field
    By EddieN1 in forum Database Design
    Replies: 3
    Last Post: 12-12-2011, 10:57 AM
  5. Replies: 1
    Last Post: 03-29-2009, 08:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums