2012-08-04 8 views
11

क्या कोई मुझे दिखा सकता है कि संदेश ऐप के माध्यम से iMessage के उपयोगकर्ता को सीधे संदेश कैसे भेजा जाए?एप्पलस्क्रिप्ट के साथ एक इमेजेज टेक्स्ट कैसे भेजें, केवल प्रदान की गई सेवा में?

tell application "Messages" 
    if service type of service of buddy whose name is ("Name here" is "iMessage") then set x to 1 
    if service type of service of buddy whose name is ("Name here" is "iMessage") then set x to 2 
    if service type of service of buddy whose name is ("Name here" is "iMessage") then set x to 3 

    send "Message" to buddy "mail of name" of service x 
end tell 

मैं केवल iMessage के माध्यम से किसी खाते में कोई संदेश भेजने के लिए, गूगल टॉक, AIM, Bonjour के माध्यम से नहीं की जरूरत है। धन्यवाद!

उत्तर

32

इसके बजाय कड़ी मेहनत से कोड करने के लिए iMessage सेवा होने के लिए, आप इसे स्वचालित रूप से पा सकते हैं:

  1. सहेजें निम्न स्क्रिप्ट के रूप में sendMessage.applescript (नोट: पाठ विकल्प का चयन करने के लिए सुनिश्चित कर लें)।
  2. इसे चलाकर निष्पादित करें: osascript sendMessage.applescript 1235551234 "Hello there!"
  3. यह फोन नंबर 123-555-1234 में iMessage भेजेगा जिसमें टेक्स्ट "हैलो!" है।

sendMessage।applescript:

on run {targetBuddyPhone, targetMessage} 
    tell application "Messages" 
     set targetService to 1st service whose service type = iMessage 
     set targetBuddy to buddy targetBuddyPhone of targetService 
     send targetMessage to targetBuddy 
    end tell 
end run 
+3

नोट: आप iMessage ** खुद ** नहीं कर सकते! – fabian789

+0

@ fabian789 संकेत के लिए धन्यवाद। क्या आप इस सीमा के आसपास एक रास्ता जानते हैं? चूंकि आप स्वयं को iMessage भेज सकते हैं (मैन्युअल रूप से Message.app से), क्या स्क्रिप्ट के माध्यम से ऐसा करने का कोई तरीका नहीं है? – Chris

+1

@ क्रिसिस नहीं, मुझे नहीं लगता कि यह संभव है – fabian789

2

उदाहरण:

get services 
get name of services 
get buddies 
get name of buddies 

आपका पंक्ति:

send "Test-Message" to buddy "buddy" of service "service" 

अगर "साथी" और "सेवा" वैध है काम करने के लिए लगता है।

मैं अपने एप्पल आईडी पंजीकृत के साथ मेरी iMessage है, इसलिए जब मैं निष्पादित "सेवाओं के नाम पर मिलता है" मैं इस सेवा के लिए की तरह

"E:[email protected]"

जो मैं "सेवा" के लिए उपयोग कर सकते हैं एक स्ट्रिंग मिलता है। बडी सिर्फ आपके दोस्त का नाम है, शुद्ध पाठ के रूप में भी। "मित्रों का नाम प्राप्त करें" देखें।

उम्मीद है कि यह काम करता है!

7

जहां तक ​​मैं इसे समझता हूं आप ऐप्पलस्क्रिप्ट के माध्यम से एक नई बातचीत शुरू नहीं कर सकते हैं। इस प्रकार बडी और सेवा एक साथ फिट होनी चाहिए और एक सतत बातचीत होनी चाहिए।

आप साथी के नाम है, तो आप निम्नलिखित

tell application "Messages" 
    get name of service of buddy "Buddy Name" 
end tell 

इस सेवा का नाम है कि साथी के लिए फिट बैठता है वापस आ जाएगी कर सकता है। बेशक आप सेवा आईडी का भी उपयोग कर सकते हैं। लेकिन मुझे नाम का उपयोग करना पसंद है।

अंत में आप मैं एक ही सवाल था और कुछ खोज के बाद मैं इस सवाल का जवाब मिल गया

tell application "Messages" 
    send "Text of Message" to buddy "+43 555 XXXXXXX" of service "E:[email protected]" 
end tell 
+1

एक नई बातचीत शुरू करने के लिए में संभव हो सकता है, का पालन करें इस - http://stackoverflow.com/questions/39027839/कैसे-से-शुरू-नई-वार्तालाप-इन-इमेजेज-उपयोग-सेबस्क्रिप्ट। मेरे लिए काम किया – mac

+0

@ एमएसी यह अब और काम नहीं कर रहा है .. – andi

3
tell application "Messages" 
    set myid to get id of first service 
    set theBuddy to buddy "[email protected]" of service id myid 
    send "Washer Done!" to theBuddy 
end tell 

के साथ एक संदेश भेजने के लिए सक्षम हो जाएगा। IMessage होने के लिए "पहली सेवा" के लिए आपको iMessage प्राथमिकता खातों में जाना होगा और iMessage खाते को फिर से ऑर्डर करना होगा। उसके बाद यह एक आकर्षण की तरह काम करता है।

यदि कोई मौजूदा नहीं है तो यह वार्तालाप शुरू भी करेगा।

आशा है कि मदद करता है!

6

यह स्क्रिप्ट संदेश भेज देंगे हर 10 ~ 30 सेकंड

tell application "Messages" 

    set targetBuddy to "+12025551234" 
    set targetService to id of 1st service whose service type = iMessage 

    repeat 

     set textMessage to "Hi there!" 

     set theBuddy to buddy targetBuddy of service id targetService 
     send textMessage to theBuddy 

     delay (random number from 10 to 30) 

    end repeat 

end tell 
+0

क्या आप https://stackoverflow.com/questions/39027839/how-to-start-new-conversation-in-imessage-using-applescript पर एक नज़र डाल सकते हैं – andi

0

ठीक है, मैं तो बस एक स्वचालक कार्रवाई जो पूरा नाम उपयोगकर्ता की में लॉग इन पकड़ लेता है में निम्नलिखित बनाया है, संपर्कों, सेवा का नाम से मिलान करने वाला आईफोन नंबर पाता है, और आखिरकार यह आने वाले पाठ (पिछली क्रिया से) भेजता है ... स्वयं iMessage पर। बहुत उपयोगी नहीं, कम से कम मेरे लिए इस समय, लेकिन मैं इसे साबित कर दिया एक तरह से :)

set input to "Testing 123" **//This line is just for testing** 
tell application "System Events" 
    set MyName to get full name of current user 
end tell 
    tell application "Contacts" 
     set myPhone to value of phone 1 of (person 1 whose name = MyName) 
     whose label = "iPhone" 
    end tell 
tell application "Messages" 
    set MyService to get name of service of buddy MyName 
    send input to buddy myPhone of service MyService 
end tell 
संबंधित मुद्दे