固定君X2ソースコード公開

久々のブログの更新で御座います。

今回は「固定君X2ソースコード公開」と題しまして、ソースコードを公開致します。
ソースコードといいましても、大したものではなくAppleScriptのソースです(笑)
ソースコードには生々しい、ゴミのようなコメントアウトがありますが、お気になさらずに(笑)

処理の内容は、ドロップレットにてドロップされたアイコンの座標を記憶する。
固定君X2のダブルクリックで、記憶していた座標を呼び出し、同じ名前のアイコンの座標をセットするだけのものです。

AppleScriptが新しいOSで使えるのかどうか、そもそもエディタがあるのか分かりませんが、少しでもお役に立てればと思います。

皆さんの環境で無事に動作する事をお祈りします。


property iconList : {}
property locList : {}

on open (theItemsDropped)
	set iconList to {}
	set locList to {}
	
	tell application "Finder"
		set obj to selection

		repeat with i from 1 to (number of obj)
			set iconList to iconList & {item i of obj as alias}
			set locList to locList & {desktop position of item i of obj}
		end repeat
		
		display dialog "記憶しました。" buttons {"OK"} default button 1
	end tell
	
end open

#復元
tell application "Finder"
	if iconList = {} then
		display dialog "記憶してません。" buttons {"OK"} default button 1
	else
		repeat with i from 1 to (number of iconList)
			#display dialog (iconList as text) & "|" & (locList as text)
			try
				set desktop position of item i of iconList to item i of locList
			end try
		end repeat
	end if
end tell

カテゴリー: Mac

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

CAPTCHA