2013-09-30 25 views
3

任何人都可以幫助我獲得活動列表顯示在OS X上的提醒應用程序?AppleScript獲取提醒中的活動列表?

根據提示的applescript字典,應用程序有一個「默認列表」屬性,它是「當前在提醒應用程序中處於活動狀態的列表」。

但是,該屬性似乎總是​​按順序返回列表側欄中的第一個列表,而不是實際顯示並且處於活動狀態的列表。我發現,如果我重新排列側邊欄中列表的順序,我會始終獲取我創建第一個列表的任何一個,而不管哪個實際上正在查看和處理。

我的應用程序是創建一個Keyboard Maestro觸發器來運行AppleScript來打印我目前正在使用的列表,但它沒有顯示提醒應用程序的功能如其字典中所述。 (我暫時使用了一個解決方法,讓腳本彈出一個選擇器列出所有列表,以便我可以選擇一個我想要打印的列表,但效率不高並且不夠優雅)。

謝謝!

+0

可以請你張貼到目前爲止的代碼,這樣我就不必重寫你已經寫好的一切 – mcgrailm

+0

看來這是一個非常糟糕的應用程序...我不要認爲它正常工作,更不用說用蘋果操作 – mcgrailm

回答

1

是的,你可以,但你將不得不使用壞的GUI腳本。而且方式不好。看看:

--Do some GUI scripting to get the decription of a specific group 
tell application "Reminders" to activate 
tell application "System Events" 
    tell process "Reminders" 
     tell window "Reminders" 
      tell splitter group 1 
       tell group 1 
        set des to get description 
       end tell 
      end tell 
     end tell 
    end tell 
end tell 

--This description is in the format "Viewing MyList, 1 reminder" so get the part to the "," from des. 
set text item delimiters to "," 
set texitems to text items of des 
set firstPart to get text item 1 of texitems 

--Setting the delimiters back 
set text item delimiters to "" 

--Jump to charcter 9 of firstPart then converting to text 
set listname to characters 9 thru end of firstPart as text 

--Now we know the name of the current list, so do whatever you want: 
tell application "Reminders" to get list listname 

這是有效的。但只有當提醒是開放的。如果蘋果改變提醒結構...

+0

yuck ...看起來像這可能是唯一的方式 – mcgrailm

+1

@mcgrailm我也這麼認爲。 – idmean