Tuesday, March 23, 2010

AppleScript로 Finder띄워 Folder 자동으로 여는 방법

다음과 같이 한다.
property monitor_width : 1680 --set to your display resolution width
property monitor_height : 1050 --set to your display resolution height

set p1 to "/Volumes/DOWNLOADING/_NEW/" --set folder for finder window 1, spaces are okay in folder path
set a to POSIX file p1
set p2 to "/Volumes/Drobo/TV/" --set folder for finder window 2, spaces are okay in folder path
set b to POSIX file p2

tell application "Finder"
activate
tell application "Finder" --remove this tell statement if you don't want all other open finder windows to close automatically
repeat while window 1 exists
close window 1
end repeat
end tell

set this_window to make new Finder window
set the target of this_window to the a
set the bounds of this_window to {100, 50, (monitor_width div 2), (monitor_height div 1)} --edit these setting to change the size of finder window 1
set the current view of this_window to column view --change if you don't want column view

set this_window to make new Finder window
set the target of this_window to the b
set the bounds of this_window to {850, 50, (monitor_width div 1.03), (monitor_height div 1)} --edit these setting to change the size of finder window 2
set the current view of this_window to column view --change if you don't want column view
end tell

여기서는 screen의 resolution을 predefined 값으로 입력했는데, 시스템에서 얻어내는 방법은 여기에 있다.
레퍼런스 :
Quickly and Neatly Open Two Pre-Specified Finder Windows Via Applescript

No comments:

Post a Comment