• 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
Code for a circle
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Code for a circle


  • Subject: Code for a circle
  • From: Paul Skinner <email@hidden>
  • Date: Thu, 13 Mar 2003 13:49:28 -0500

Can anyone explain the formula I should use to generate values for the position of a window such that the values all fall close to lying on a 30 pixel diameter circle ?

What I'm trying to do is make a window politely draw attention to itself. I currently use this bit...

tell application "Finder"
activate
try
set frontWindow to window 1
set {x, y} to position of frontWindow
repeat with v from 30 to 10 by -10
set r to (v / 10)
repeat with i from 1 to v by r
set position of frontWindow to {x + i, y}
end repeat
set x to x + v
repeat with i from 1 to v by r
set position of frontWindow to {x, y + i}
end repeat
set y to y + v
repeat with i from 1 to v by r
set position of frontWindow to {x - i, y}
end repeat
set x to x - v
repeat with i from 1 to v by r
set position of frontWindow to {x, y - i}
end repeat
set y to y - v
end repeat
end try
end tell

This moves the front finder window in three progressively smaller squares. The result isn't too bad, but I'd like to move it in circles rather than a square. It just seems that would be more Mac OS X-like in behavior.

Paul Skinner
_______________________________________________
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: Code for a circle
      • From: Bill Briggs <email@hidden>
    • Re: Code for a circle
      • From: Deivy Petrescu <email@hidden>
    • Re: Code for a circle
      • From: Helmut Fuchs <email@hidden>
    • Re: Code for a circle
      • From: Doug McNutt <email@hidden>
  • Prev by Date: Re: Can I script Safari?
  • Next by Date: Re: Can I script Safari?
  • Previous by thread: Re: How-to get file size (data fork)
  • Next by thread: Re: Code for a circle
  • Index(es):
    • Date
    • Thread