• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Click and Drag using UI scripting?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Click and Drag using UI scripting?


  • Subject: Re: Click and Drag using UI scripting?
  • From: Marconi <email@hidden>
  • Date: Tue, 16 Sep 2003 19:23:28 -0700

At 3:18 PM -0400 9/16/03, Brett Kirksey wrote:
>Marconi wrote:
>
>> Is there a way, perhaps using UI scripting, to click and drag from
>> one point to another?
>
>The dictionary for System Events 1.2 contains:
>
> click: cause the target process to behave as if the UI
> element were clicked
>
> click reference -- the object for the command

Then I guess that UI scripting won't do it, if I have to specify the object to be clicked. Just as a real mouse click determines which object has been clicked after the event takes place, I need my AppleScripted routine to do the same.

Years ago it was possible to generate system events and put them into the GetNextEvent queue. There were even utilities to record mouse clicks and drags and generate the code to play it back.

>
> [at list] -- when sent to a "process" object,
> the { x, y } location at which to click, in global coordinates
>
>As far as dragging, I'm not sure. Maybe the 'move' command would work?
>
>> Would a Click-Drag have to be directed to a particular app which
>> supports click/drag or can a generic click/drag be done which will
>> direct the click and release to whatever apps happen to be under the
>> cursor at click and release time?
>
>If you use this code, you can direct the action to whatever is the frontmost application:

Ah, but what if I want the drag to end at some other application? Dragging from an editor window to the desktop, for example?

>
> tell application "System Events"
>
> set theProcess to every process whose frontmost is true
>
> tell process theProcess
> -- whatever you want
> end tell
>
> end tell

Isn't there a way to simply specify click(x,y), dragto(x+50,y-35) and then mouseup? Let the OS sort out which app, window and object gets the click after it takes place -- just like real mouse clicks.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Click and Drag using UI scripting?
      • From: Walter Ian Kaye <email@hidden>
  • Prev by Date: The potrezbie system of weights and measurements (OT)
  • Next by Date: Re: Hex > Text
  • Previous by thread: Re: Click and Drag using UI scripting?
  • Next by thread: Re: Click and Drag using UI scripting?
  • Index(es):
    • Date
    • Thread