property pw : "" property command : {{true, "touch "}, {false, "rm "}} property check_text : {{true, "入"}, {false, "切"}} property ScreenSharing_launchd : {{"10.5", "/Library/Preferences/com.apple.ScreenSharing.launchd"}, {"10.6", "/etc/ScreenSharing.launchd"}} property RemoteManagement_launchd : {{"10.5", "/Library/Preferences/com.apple.RemoteManagement.launchd"}, {"10.6", "/etc/RemoteManagement.launchd"}} global process_list global service_list global screen_sharing global remote_managemanet on run set process_list to {} set service_list to {} set screen_sharing to my file_exists(my look_up(ScreenSharing_launchd, my os_version())) set remote_managemanet to my file_exists(my look_up(RemoteManagement_launchd, my os_version())) if pw is "" then my save_password() end if my ng_services(false) my quit_ng_apps() my hide() activate application "StationTV LE" end run on idle if station_tv_state() then return 5 else my ng_services(true) my back_ng_apps() quit end if end idle on reopen my save_password() end reopen on save_password() display dialog "管理者パスワードを入力してください。" default answer "" with hidden answer set pw to result's text returned end save_password on ng_services(bool) if screen_sharing then my service_on_off(my look_up(ScreenSharing_launchd, my os_version()), bool) if bool is false then set service_list to service_list & "画面共有" end if if remote_managemanet then my service_on_off(my look_up(RemoteManagement_launchd, my os_version()), bool) if bool is false then set service_list to service_list & "リモートマネージメント" end if my message(my look_up(check_text, bool), my join(service_list, "\n")) end ng_services on quit_ng_apps() repeat with process_name in every_process() if process_name is in ng_apps() then set process_list to process_list & process_name quit application process_name end if end repeat my message("終了", my join(process_list, "\n")) end quit_ng_apps on back_ng_apps() repeat with process_name in process_list launch application process_name end repeat my message("起動", my join(process_list, "\n")) end back_ng_apps on every_process() tell application "System Events" processes's name end tell end every_process on ng_apps() "QuickTime Player\ngyazo\nScreenBoard\nFlickScreen\nLittleSnapper\nDikk!\nScreenFlowHelper\nScreenFlow\nThe Screen Crawlers\nRulers\nEvernoteHelper\nEvernote\nScrnShots Desktop\nJing\nSimpleCap\nTimed Screenshot\nSnapz Pro X\nSnapNDrag\nSnapClip\nShowTime\nScribbleScreen\nScreenium\nScreenCaptureGUI 2\nScreen Mimic\nRemoteCapture\nPNGoo\nPDFoo\nMultiSnap\nLilypad\nKinoDesk\niShowU\nInstantShot!\nImageFlow\nGrabberRaster\nGrab\nFlySketch\nfgrab\nDesktopToMovie\nCopernicus\nClick\nanno2\nScreenshot Plus.wdgt\nCapture.wdgt\ndesktoptransporterd\nDesktop Transporter\nTeamViewer\nLogMeInGUI\nLogMeIn\nLMILaunchAgentFi\nLMIGUIAgent\nTiffany\nOSXvnc-server\nAppleVNCServer\n" end ng_apps on os_version() do shell script "sw_vers -productVersion|cut -c 1-4" end os_version on service_on_off(launchd_path, bool) my look_up(command, bool) & launchd_path do shell script result password pw with administrator privileges end service_on_off on file_exists(unix_path) tell application "Finder" exists my POSIX file (unix_path) end tell end file_exists on station_tv_state() tell application "System Events" "StationTV LE" is in processes's name end tell end station_tv_state on message(title, msg) try if msg is not "" then do shell script "/bin/echo -n " & quoted form of msg & " | /usr/local/bin/growlnotify " & quoted form of title end if on error --activate --display alert title message msg giving up after 4 end try end message on join(sourceList, delimiter) set oldDelimiters to AppleScript's text item delimiters set AppleScript's text item delimiters to {delimiter} set theText to sourceList as text set AppleScript's text item delimiters to oldDelimiters theText end join on hide() tell application "System Events" keystroke "h" using command down end tell end hide on look_up(src_list, a_key) if a_key = "" then return "" repeat with sub_list in src_list if a_key is in sub_list's item 1 then return sub_list's item 2 -- thru -1 end repeat "" end look_up