0
AppDelegate.applescriptXcode:我將如何爲此cocoscript應用程序製作切換按鈕?
-- iTunes Switcher
--
-- Created by admini on 11/13/12.
-- Copyright (c) 2012 Bdaniels. No rights reserved.
--
script AppDelegate
property parent : class "NSObject"
on ButtonHandlerActivationOn_(sender)
tell application "iTunes" to quit
do shell script "/usr/bin/defaults write com.apple.iTunes StoreActivationMode -integer 1"
delay 1
do shell script "open -a itunes"
end ButtonHandlerActivationOn
on ButtonHandlerActivationOff_(sender)
tell application "iTunes" to quit
do shell script "/usr/bin/defaults write com.apple.iTunes StoreActivationMode -integer 0"
delay 1
do shell script "open -a itunes"
end ButtonHandlerActivationOff
on applicationWillFinishLaunching_(aNotification)
-- Insert code here to initialize your application before any files are opened
end applicationWillFinishLaunching_
on applicationShouldTerminate_(sender)
-- Insert code here to do any housekeeping before your application quits
return current application's NSTerminateNow
end applicationShouldTerminate_
end script
這裏的UI http://imgur.com/8xO9K4c
我想提出一個綠燈,如果狀態變成一個屏幕截圖。 任何幫助,這將是偉大的!這裏還有兩個按鈕,但我省略了它們,因爲我的帖子中有「代碼太多」,並且stackoverflow不允許我發佈它。
在此先感謝!