2011-03-30 5 views
2

테마 프로로 새 터미널 창을 여는 스크립트를 만들고 싶습니다. 그 스크립트는 어떻게 생겼을까요? 방금 창을 새로 만들었지 만 테마를 지정하고 싶습니다.Applescript : 테마 프로가 포함 된 새 터미널 창

바로 가기를 사용하고 싶기 때문에 자동화 서비스를 만들었습니다.

테마에 대한 속성이 필요하거나 정보를 다시 작성해야합니다. 잘 작동


그래서 :

설정 모드 항목에서 1 ~ 6

설정 테마에 임의의 숫자로 설정 I를 {"Basic", "Grass", "Novel", "Ocean", "Pro", "Red Sands"}에 모드

의 I 그러나 나는 방법을 얻을 수 있습니다 현재 테마? 그리고 스크립트는 완료된 후에 모든 vars를 풀거나 어떻게 든 그것을 저장합니까? 하지만, 이것에 의해 당신이 무슨 뜻인지,

tell application "Terminal" to set current settings of (do script) to settings set "Pro" 

가 확실하지 :

답변

2

이 수행해야

나는 주제에 대한 propertie이 필요하거나 위해 어떻게 든, 그것에서 정보를 정기적으로 얻을 것 그것을 재건한다.

2

나는이 응용 프로그램을 작성하여 현재 윈도우의 테마를 쉽게 설정할 수 있도록했습니다. 그것은 특정 주제, 축복받은 세트 중에서 무작위로 설정하거나, 사용 가능한 모든 것을 무작위로 설정할 수있게 해줍니다.

필자는 내 .bashrc에서 별칭 설정을 사용하여 쉽게 명령 줄에서이 설정을 호출합니다. 머리글에 예제가 있습니다.

-- StyleTerm.scpt 
-- Sets theme of current terminal window/tab 

----------------------- 
-- Arguments 
----------------------- 
-- If a theme name is provided on the command line then set to that 
-- Example 
-- osascript StyleTerm.scpt Grass 
-- 
-- If multiple theme names are provided on command line then choose randomly among those 
-- This allows for random behavior from within blessed set 
-- Example 
-- osascript StyleTerm.scpt Grass Basic Ocean "Red Sands" 
-- 
-- If no command line args are provided then choose randomly among all themes 
-- Example 
-- osascript StyleTerm.scpt 
----------------------- 

----------------------- 
-- This is best utilized via aliases set up in shell config file 
-- Examples from my .bashrc 
-- # Theme specific aliases 
-- alias grass='osascript ~/sbin/StyleTerm.scpt Grass' 
-- alias basic='osascript ~/sbin/StyleTerm.scpt Basic' 
-- # Random from blessed themes 
-- alias btheme='osascript ~/sbin/StyleTerm.scpt Grass Basic Ocean "Red Sands"' 
-- # Random themes 
-- alias rtheme='osascript ~/sbin/StyleTerm.scpt' 
----------------------- 

on run argv 
    tell application "Terminal" 
     if (count argv) is 0 then 
      -- Use random theme from all possible themes 
      set newTheme to some settings set 
      set current settings of selected tab of front window to newTheme 
     else 
      -- Use random theme from arguments 
      set newThemeName to some item argv 
      set current settings of selected tab of front window to first settings set whose name is newThemeName 
     end if 
    end tell 
end run 
+0

위의 내용은 Github의 요지입니다. 위의 실행 문제가 있었지만 요점은 완벽하게 작동했습니다. 고마워요! https://gist.github.com/khansensf/1714326 – aerickson