Finderのウィンドウ6つ(可変)を画面上で別々に楕円運動させるAppleScriptです。
三角関数の計算にShane StanleyのBridge Plus AppleScript Librariesを利用しています。
AppleScript名:Finder Windowを円運動 v4 |
— Created 2014-11-17 by Takaaki Naganoya — Modified 2018-02-23 by Takaaki Naganoya — 2014-2018 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" use framework "AppKit" — for NSScreen use bPlus : script "BridgePlus" –https://www.macosxautomation.com/applescript/apps/BridgePlus.html property aNum : 300 property aOffset : 0 property maxWin : 6 property winList : {} property randList : {} property winSize : 300 –Initialize load framework set winList to {} set randList to {} repeat maxWin times tell application "Finder" activate set aWin to make new Finder window tell aWin set toolbar visible to false set sidebar width to 0 set statusbar visible to false set position to {100, 100} set bounds to {100, 100, 100 + winSize, 100 + winSize} end tell set the end of winList to aWin set the end of randList to {random number from 0 to 400, random number from 0 to 400, random number from 1 to 360} end tell end repeat –Main repeat with i from 1 to 360 by 6 repeat with ii from 1 to maxWin set aWinObj to contents of item ii of winList set {aRandX, aRandY, aRandDegree} to item ii of randList set aDeg to i + aRandDegree set aSinNum to (current application’s SMSForder’s sinValueOf:aDeg) as real set aCosNum to (current application’s SMSForder’s cosValueOf:aDeg) as real set x to ((aNum * aSinNum) + aNum) * 2 + aOffset set y to (aNum * aCosNum) + aNum + aOffset ignoring application responses tell application "Finder" tell aWinObj set position to {(x as integer) + aRandX, (y as integer) + aRandY} end tell end tell end ignoring end repeat end repeat –Sweep tell application "Finder" repeat with i in winList tell i close end tell end repeat end tell |
More from my site
(Visited 59 times, 1 visits today)
手元に残っているAppleScript本 – AppleScriptの穴 says:
[…] して、画面の隅を直線的に移動させるスクリプトが印象的。当時からこの直線的な動きが気に入らなくて、のちに三角関数で軌道計算して楕円移動させるScriptを書く原動力になりました。 […]