Automator - How do I: Mouse Click, Move Windows, and more

Hello,
I am attempting to create my own Automator programs and for a while I had some that worked nicely. I have recently been tweaking my iMac so that it can "think" on its own (by automator of course) and do things for me. However, I've run across a block with Mavericks (I believe it's due to Mavericks).
1. How can I get Automator to register a mouse click? "Watch me do" does not seem to want to work for me at all. I also would prefer if it would just be a registered mouse click, but not actually use the mouse (I know this is possible) so that if I'm doing something and it runs, it won't disturb my mouse and I can keep working.
2. How can I register a keyboard stroke? Same as above
3. How can I have automator move windows? I have two monitors and there are times when I may want it to move a window from one mintor to another
The following is a list of all the things I'm attempting to accomplish at the moment (with other things when I think of them) with automator (either through applications, folder actions, or ical actions):
1. Register a mouse click at a given area or on a given element in a safari page
2. Register a keyboard stroke in a given program (be able to focus on a program and then do the keystroke)
3. Move windows from one location to another
4. Full-screen and Un-full-screen iTunes at certain times of day
5. Download all purchased items on iTunes that aren't on the computer (sometimes iTunes doesn't download stuff if it was downloaded on my MacBook Pro first)
6. Automatically voice read reminders (that I've set in Reminders) each day at a given time (I can use loop to repeat it to make sure I hear it all)
I'll think of more of course, but the mouse click, keyboard stroke, and moving windows is the big thing I'm trying to figure out how to do. Can anyone help?
Also, I am not a computer tech. I am tinkering with this because it's fun and helpful, but an answer of "just use applescript" or "just use java" will likely just give me a headache. I know that it's going to be one of those codes, but I'm hoping someone has a "base" code that can be copied and pasted that's just a standard click that I can adjust for where I need to click and what process I need to click on.
If there is an Action Pack that includes a "Register Mouse Click" and/or "Register Keyboard Stroke", then that would work great, but the only action packs for automator I've seen that work with Mavericks is for photoshop.

You're asking for a lot in one post.  It would be better to break your requests down a bit. 
For example, to deal with mouse clicks, you can use the Automator Action Run Shell Script with this python script:
import sys
import time
from Quartz.CoreGraphics import *
def mouseEvent(type, posx, posy):
        theEvent = CGEventCreateMouseEvent(None, type, (posx,posy), kCGMouseButtonLeft)
        CGEventPost(kCGHIDEventTap, theEvent)
def mousemove(posx,posy):
        mouseEvent(kCGEventMouseMoved, posx,posy);
def mouseclick(posx,posy):
        mouseEvent(kCGEventLeftMouseDown, posx,posy);
        mouseEvent(kCGEventLeftMouseUp, posx,posy);
ourEvent = CGEventCreate(None);
# Save current mouse position
currentpos=CGEventGetLocation(ourEvent);
# Click the "Apple"
mouseclick(25, 5);  
# 1 second delay       
time.sleep(1);        
# Restore mouse position
mousemove(int(currentpos.x),int(currentpos.y))
It will look like this in Automator:
To drag something (i.e. a window, a file icon) from position 40,60 to 60,300:
import time
from Quartz.CoreGraphics import *
def mouseEvent(type, posx, posy):
           theEvent = CGEventCreateMouseEvent(None, type, (posx,posy), kCGMouseButtonLeft)
           CGEventPost(kCGHIDEventTap, theEvent)
def mousemove(posx,posy):
           mouseEvent(kCGEventMouseMoved, posx,posy);
def mouseclickdn(posx,posy):
           mouseEvent(kCGEventLeftMouseDown, posx,posy);
def mouseclickup(posx,posy):
           mouseEvent(kCGEventLeftMouseUp, posx,posy);
def mousedrag(posx,posy):
           mouseEvent(kCGEventLeftMouseDragged, posx,posy);
ourEvent = CGEventCreate(None);
# Save current mouse position
currentpos=CGEventGetLocation(ourEvent);
# move mouse to upper left of screen
mouseclickdn(40, 60);
# drag icon to new location
mousedrag(60, 300);
# release mouse
mouseclickup(60, 300);
# necessary delay
time.sleep(1);
# return mouse to start positon
mouseclickdn(int(currentpos.x),int(currentpos.y));
For keystokes in AppleScript (which can be added to Automator with the Run Applescript Action) see: http://dougscripts.com/itunes/itinfo/keycodes.php

Similar Messages

  • HT3986 How do I right click on Windows installed using Bootcamp?

    How do I right click on Windows installed using Bootcamp?

    It should work the same way it does in OSX, but for it to work correctly, you need to install the Boot Camp drivers in Windows. You can do this by using the Boot Camp Assistant in OSX, then creating the "Windows support software (drivers)" package. Follow the instructions there, then use the resulting thumbdrive to install the drivers and apps into Windows. Then you should be able to two-finger-click the touchpad or right-click your mighty mouse or other two-button-enabled mouse.
    http://support.apple.com/kb/HT4407 for more info on this.
    Caveat: I've done this, and I've found that the two-finger-click in Windows is iffy. That is, it frequently triggers a left-click function instead of right-click. :-/

  • Running bootcamp and right mouse click on windows

    Hi all, I was just looking to setup WinXP on my machine and wanted to know how my macbook pro laptop mouse would deal with the right mouse click on windows? If I dont have an external mouse plugged into the laptop is there no right mouse click available?
    Thanks!

    Download a program called AppleMouse at http://www.softpedia.com/get/Desktop-Enhancements/Other-Desktop-Enhancements/App le-Mouse-Utility.shtml. Unzip it the copy-and-paste "applemou.exe" to this directory through Windows Explorer: C:\Documents and Settings\YOUR USER NAME\Start Menu\Programs\Startup. Once copied, restart your computer back into Windows and login. You'll be able to right-click by holding down the control (ctrl) button and clicking.
    MacBook Pro 17" 2.16GHz, 120GB, 2GB, Matte, 120GB USB Western Digital HDD   Mac OS X (10.4.6)   Windows XP Dual-Boot, Toasting Over 189.6 degrees Fahrenheit in CoreDuoTemp

  • How to simulate mouse click

    Hello,
    is it possible to simulate and control a mouse click in windows with labview 7.1. I am able to control the mouse coordinates but not right and left mouse click. Is there a available VI that can do that?
    Lukas

    I have answered this in the other thread where you asked this. Please don't post the same questions to multiple threads.
    After looking at the VI there, it uses the PostMessage function to post a mouse down message to a specific window. You can try using MouseEvent or SendInput to simulate a general mouse click (One of them is no longer supported, I can't remember which. You can find the details in the MSDN).
    Try to take over the world!

  • How can I exit a collection window and return to parent folder?

    I would "love" to have a place where I could ask the simple questions like this that come up and seem so simple to those who know, they don't mention the details I need like how to close a working collection window and move back to the parent folder of that collection.
    I've been stuck for two days (it happened before) in a window (library module) with a collection of 8 photos.  I cannot find any way to close that window or go back to the library collection of hundreds of photos from which it was chosen.  It's very frustrating to be stuck in this window, perhaps forever?
    How do I close these windows.  Isn't there a "back" button?
    I started in Photoshop 3, then 5, then 7, then stopped renewing due to difficulty learning PS until the Adobe CC became available with the many tutorials.  It was great learning how to make a collection, but the tutorials didn't mention how to get back to the main folder where the collection was chosen.  So again, I"m stuck at an even lower level of functioning than with photoshop alone.
    I had to copy a photo and open it separatly in Photoshop just to be able to work on it.  Yesterday I could "edit in Photoshop cc" with right click.  Today, it won't even do that.
    I suspect now two things are working to prevent me from working properly on my photos but have no clue how to fix this.

    In the library module, left-hand panel, there are different sections or tabs. Collections is one of those tabs near the bottom out that panel. If you scroll up in that panel you should see other sections, one of which is "Folders". If that isn't showing, then right-click on the Collections section heading and make sure there are checkmarks in the sections that you want to have displayed. To return to the folder you need to go to the folders section and find the folder in your list.
    Another way to return to a folder is to click in the area in this illustration:
    Doing so will present a list of folders that you have recently been inside of. You can click on one of those folders and return directly to it.

  • Premiere CS4 - How can you import QuickTime (.mov) videos and which settings for the sequence?

    Premiere CS4
    How can you import QuickTime (.mov) videos and which settings for the sequence?
    Please reply in plain English or if possible in German
    Greetings from Vienna, Peter

    I have not installed Quicktime.
    I got a few scenes (.mov) from a Canon Eos 70d.
    I want to create a short film (in Premiere CS4) with these scenes, mixed with photos and MP3 music.

  • Tabs for Point & Click, Scroll & Zoom, and More Gestures do not show.

    Hi all
    Had to reformat my drive and install a fresh copy of lion but I can not see the  tabs for Point & Click, Scroll & Zoom, and More Gestures in my preferences all I get is
    Anyone have any ideas ?

    Never mind. I found the answer. There is a selection in the Trackpad titled "When using gestures to scroll or navigate, move content in the direction of finger movement" that is what controls the setting.
    I actually found the answer after I posted the question. I tried all kinds of combinations in the new ask a question psuedo-search feature of the support site and nothing showed up. After you post, the site offers questions similiar to the one just posted. It was one of those that solved the problem. I guess I didn't get enough keywords correct for the right answer to show up. I just wish Apple would let you do a standard search instead of trying to be helpful. So far, I've not found any answers I was looking for with the new search tool. All answers have been found on different sites using Google. Grrrr. </rant>

  • Mouse clicks on windows without focus

    Is there a way to recognize when a user is clicking on a defocused JFrame, to bring it to the front, as opposed to clicking to set a text cursor position within the JFrame? For example, if I click on a terminal emulator I've developed, the text cursor within the emulation window goes to the click, even if the emulator is only being clicked to give it focus. (I've also noticed a similar phenomenon with JBuilder, by the way.)
    By comparison, look at any native Windoze or Macintosh application; very few (if any) behave that way.

    This must be very hard for LabView to do.  I just need to use LabView to run another application. Then have labview emulate a mouse click on that application. I have found out the windows message using Spy++ for the mouse click.  Now in LabView I need to move the mouse to a certain position on that application.  How could LabView know where to move the mouse cursor.  I found some move cursor vi on this forum, then the coordinate of the position on the application (the active window) is not known.  Do I need to map out the position in advance using Spy++?  That seems not reasonable as later on the position may change. 
    LabView is indeed good for Hardware automation and data acquisition, but when it comes to performing some software automation tasks (i.e., runing a couple of other applications automatically), it doesn't seem to be powerful at all, unless the other applications are ActiveX capable, or you have their code to build Dlls.  Most of time, one only need to automate the process of running a couple of other programs, then have data presented.

  • How to show mouse clicks when recording screen with quicktime?

    How can i show the mouse click when i record the screen using quicktime player?

    Why? What program feature do you intend to offer, by knowing what a user clicks on (besides the application itself).Hi, well what I have to do is to start the application minimized in the system tray. Then the application must be listening for crtl+shift+left click in any part of the desktop or an opened application, when that happens, I have to show a window asking if the user want to take a screenshot starting in the x,y point he clicked, once done, I have to take an screenshot...so on.
    How can I do that? Can anybody give me a hint? Thanks in advance.

  • How to detect mouse clicks on desktop?

    Hi All,
    I need to detect mouse clicks on the desktop and find out mouse position on the screen. How to listen to mouse events if I don't have any swing components like containers, panels, windows, etc? All things like "addMouseListener" are supposed to be with such components. But my program is running in the background and it doesn't have any graphical interfaces. So, I need to detect if a mouse button is pressed at any position on the screen.
    Thanks for any help!

    Why? What program feature do you intend to offer, by knowing what a user clicks on (besides the application itself).Hi, well what I have to do is to start the application minimized in the system tray. Then the application must be listening for crtl+shift+left click in any part of the desktop or an opened application, when that happens, I have to show a window asking if the user want to take a screenshot starting in the x,y point he clicked, once done, I have to take an screenshot...so on.
    How can I do that? Can anybody give me a hint? Thanks in advance.

  • Mouse randomly moves around and clicks

    Ok, so ive had this problem for a few months now and it has led me to the point where my mac was in storage and i havent touched it in a month or two. What happens is no matter what i am doing my mouse will move around the screen clicking randomly and basically doing whatever it wants. i have looked into the problem and other people have similiar issues but not the same. i can be across the room from my mac with the screen on, and the mouse will still move around and click and open countless folders even though no one at all is even near the computer. today when i took the mac out to see if there was a software update available (which there was) the mouse was not moving around or jumping at all througout the entire update. After the update it is now yet again jumpin around and clicking wherever it wants. Also its not just once in a while it is 24/7 it has made my mac unable to be used because you cant really control the mouse for more than a second at a time. my whole screen is now full of untitled folders.... any help would be appreciated...

    Hi - I am having exactly the same problem.  I am going to do what Barry said.  Apple support says to do the following:
    Resetting PRAM and NVRAM
    Shut down the computer.
    Locate the following keys on the keyboard: Command, Option, P, and R. You will need to hold these keys down simultaneously in step 4.
    Turn on the computer.
    Press and hold the Command-Option-P-R keys. You must press this key combination before the gray screen appears.
    Hold the keys down until the computer restarts and you hear the startup sound for the second time.
    Release the keys.
    Your computer's PRAM and the NVRAM are reset to the default values. The clock settings may be reset to a default date on some models.
    Gene

  • How to handle mouse click event on up-arrow of JSpinner?

    Hi Everybody,
    I have a JSpinner component holding a date field in it (dd/mm/yyyy). I have handeled keyboard up and down arrow key events for the component and that's working as expected. Now I want to make it work for mouse clicks on the up (UP_ARROW_SUBCOMPONENT) and down arrow (DOWN_ARROW_SUBCOMPONENT) buttons of the component.
    Could somebody guide me how to do it? My investigatoin hints me to use JSpinnerMouseEventData but I am not exactly getting how to get it done.
    Thanks in advance!

    if you just want to add a mouseListener to the spinner's buttons, try this
    (only coded it for the up/next button)
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    class Testing
      public void buildGUI()
        JSpinner spinner = new JSpinner(new SpinnerNumberModel(50, 0, 100, 5));
        spinner.setUI(new javax.swing.plaf.basic.BasicSpinnerUI(){
          protected Component createNextButton()
            Component c = super.createNextButton();
            c.addMouseListener(new MouseAdapter(){
              public void mousePressed(MouseEvent me){
                System.out.println("mousie, going up");
            return c;
        JFrame f = new JFrame();
        f.getContentPane().add(spinner);
        f.pack();
        f.setLocationRelativeTo(null);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setVisible(true);
      public static void main(String[] args)
        SwingUtilities.invokeLater(new Runnable(){
          public void run(){
            new Testing().buildGUI();
    }

  • How to detect mouse click event?

    Hello,
    I would like to have a vi to detect left, right and no mouse click. I mean that in the vi attached, Button2 should be 0 (no click), 1 (left c.) or 2 (right c.) depending on the event occured in i-1. cycle. My vi is the modyfied version of the one found here:
    http://www.ni.com/example/27663/en/
    Sometimes it works fine, but another time nothing happens when I click.
    I think the main problem is with the execution times at the for loop and event structure.
    Could you help me how to deal with the problem?
    Thanks you!
    Attachments:
    mouse1.vi ‏12 KB

    Hi VampireEmpire,
    Your For loop iterates twice. If an event occures during first iteration everything is fine - Button 2 refreshes during second iteration. But what happens when an event occures during second iteration? Does Button 2 have a possibility to refresh? 
    1. Do you see the problem now?
    2. And if you do - do you really need For loop? I would suggest you trying removing it and connecting shift register to the while loop.
    Bluesheep

  • How to disable mouse click ??

    hi ,
    i have a form in which i have a block abc in this there are 5 items say a,b,c,d,e
    suppose my cursor is in item field 'a' there i have entered some value then i go to item field b and entered some value and then i go to field c without any enter or tab but with the help of mouse only. there i want to put a trigger on block level ( on-mouse-click) that whenever anyone tries to move from the current field to another field with the help of mouse then the cursor should be moved to previous item automatically that is item 'b'. in breif i want to disable mouse click from moving one field to another.
    on-mouse-click i can store system.current_item i.e 'a' but not able to store previous field i.e 'b'.
    please help....
    thanks
    Edited by: Hi FRNzzz!! on Feb 23, 2010 7:10 PM

    Hello,
    Try to set the mouse navigation limit form-level property to item when you want to disable the mouse.
    Francois

  • How I detect mouse wheel movement?

    I never use this for now, and I want to intercept mouse wheel movement (up or down) for to change animation panels (divs) or to make another actions.
    Is not for a scroll of a large stage or div, it's only for to know when the user use the mouse wheel.
    Example: http://www.protest.eu/nl/dames/
    Thank you.

    Are you looking for this ? it may be done easily with Edge Commons
    http://www.edgedocks.com/content/2013/12/using-parallax-scrolling-animate-single-line-code

Maybe you are looking for

  • After Effects wont start; OSX Lion 10.7.5 with Creative Cloud

    When I try to start Adobe After Effect CC 2014 it crashes and I get this message out of all my CC programs this is the only one that doesnt work, can anyone tell me what I can to fix this issue?

  • Error while installing oracle9i database

    The java run time environment was not found at C:\docume~1\blah blah\jre \bin\jrew.exe. hence oracle universal installer cannot be run. I have already installed the Jre and jdk versions 1.5 ..can u plz let me know what r the further steps i need to d

  • No records generated

    Hi gurus Below is the script for rolling forecast I am on SP6,EPM 10 NW , though I was using another system with SP16 I had the same issue why  am i seeing no records both in DM and UJKT "norecords generated" there is data in Actuals for the immediat

  • Unable to start Essbase Studio Server

    Hi All, Am getting an error message when I start Essbase studio. The installation and configuration went without any errors. I have downloaded the jdbc driver for mysql, renamed it and placed it in the correct location. Yet when I start the studio se

  • Safari hides nav bar as though full screen

    Lately (the last month) Safari hides the nav bar across the top as though in full screen mode; to exit this I need to hit esc twice. That then minimizes window and the nav bar shows. I can't find a way to show the nav bar in full mode (not in full sc