2012-12-15 17 views
5

Bir posta eklentisi oluşturmak zorunda ve giden Mail'in "Gönder" düğmesini yanındaki "Düğmesi" add içinde, "Posta" uygulaması

enter image description here

AppleScript'i Yürütme mümkün ve şimdi ben çıkışını göndermek istediğiniz Değil Ayrıca benim Düğme mail ben de

activate application "Mail" 
tell application "System Events" 
    tell application process "Mail" 
     log "foo" 
     tell menu bar 1 
      tell menu bar item "Message" 
       tell menu "Message" 
        click menu item "Send" 
       end tell 
      end tell 
     end tell 
    end tell 
end tell 

Bu komut dosyası AppleScript editörü çalışan ancak mY butonuna tıklayın gELEN ÇALIŞMA DEĞİLDİR gibi o AppleScript'i yazıp

Ben de

NSURL* url = [NSURL fileURLWithPath:path]; 
NSDictionary* errors = [NSDictionary dictionary];  
NSAppleScript* appleScript = [[NSAppleScript alloc] initWithContentsOfURL:url error:&errors]; 
[appleScript executeAndReturnError:&errors]; 

gibi Xcode AppleScript'i yürütmek Ve sonra ben alınırken hata var senaryoyu yürütmek adres: -

NSAppleScriptErrorAppName = "System Events"; 
NSAppleScriptErrorBriefMessage = "Can't get menu bar 1 of application process \"Mail\". Invalid index."; 
NSAppleScriptErrorMessage = "System Events got an error: Can't get menu bar 1 of application process \"Mail\". Invalid index."; 
NSAppleScriptErrorNumber = "-1719"; 
NSAppleScriptErrorRange = "NSRange: {0, 0}"; 

Yani ben denedim tüm şey Ama başarı elde değil.

Yani bu Problem dışarı herhangi bir öneri ya da yardım için

Teşekkür bana yardım edin.

cevap

4

Bu menü öğesinde klavye kısayolu var, dolayısıyla bunu da kullanabilirsiniz. Bunu denedin mi?

activate application "Mail" 
tell application "System Events" 
    tell application process "Mail" 
     keystroke "d" using {command down, shift down} 
    end tell 
end tell 
İlgili konular