1

Skype を起動し、オンラインのユーザーに電話をかけ、会議の開始後に自動的に着信を追加する AppleScript を作成しようとしています。私はこの実装の最後の部分で立ち往生しています (以下のコードでスターが付いています)。繰り返しループにあるコード。

通話を保留にせずに、着信通話を既存の電話会議に追加する方法を実装するのを手伝ってくれませんか?

前もって感謝します!

私のシステムは Mac OS X Lion (10.7.5) です

PS。これまで、他の方の作品にたくさん助けてもらいました。こんなにできたのに。

tell application "System Events"
    set powerCheck to ((application processes whose (name is equal to "Skype")) count)
    if powerCheck = 0 then
        my launch_skype()
    else if powerCheck = 1 then
        return
    end if
end tell

## FUNCTIONS ##
on dismiss_skype_api_security()
    tell application "System Events" to tell process "Skype"
        set window_name to "Skype API Security"
        set ok_text to "OK"
        set radio_text to "Allow this application to use Skype"
        tell application "System Events" to tell process "Skype"
            if window window_name exists then
                click radio button radio_text of radio group 1 of window window_name
                delay 2
                click button ok_text of window window_name
            end if
        end tell
        delay 1
    end tell
end dismiss_skype_api_security

on launch_skype()
    tell application "Skype"
        set statusList to {"RINGING", "ROUTING", "UNPLACED"}
        delay 2
        try
            set status to "COMMAND_PENDING"
            repeat until status is not equal to "COMMAND_PENDING"
                set status to send command "GET USERSTATUS" script name "auto call"
                if status is equal to "COMMAND_PENDING" then
                    my dismiss_skype_api_security()
                end if
            end repeat

            #### CALL ONLINE CONTACTS + AUTO ACCEPT ####
            activate
            delay 1
            set OnlineContacts to my get_online_contacts()
            delay 1
            send command "CALL " & OnlineContacts script name "auto call"
            delay 2

            -- Set first call ID as master
            set firstCall to send command "SEARCH ACTIVECALLS" script name "auto call"
            set firstCallID to last word of firstCall -- What if the last guy leaves the call ?!?!?
            set firstStatus to send command "GET CALL " & firstCallID & " STATUS" script name "auto call"
            if statusList contains the last word of firstStatus then -- First Call
                set MasterCallID to firstCallID
            end if


          **set callID to ""
            repeat until callID is "CALLS"
                delay 3
                set status to send command "GET CALL " & firstCallID & " STATUS" script name "auto call"
                if the last word of status is "RINGING" then --Someone is calling to join the call
                    set calls to send command "SEARCH ACTIVECALLS" script name "auto call"
                    set callID to last word of calls
                    --send command "ALTER CALL " & callID & " JOIN_CONFERENCE " & mainCallID script name --"auto call"
                end if
            end repeat**

        on error number -2753
            quit
        end try
    end tell
end launch_skype

### GET ONLINE CONTACTS ###
on get_online_contacts()
    global OnlineFriends
    set OnlineFriends to {}
    tell application "Skype"
        set SkypeStatus to send command "GET CONNSTATUS" script name "auto call"
        if SkypeStatus is "CONNSTATUS ONLINE" then
            set AppleScript's text item delimiters to " "
            set Friends to send command "SEARCH FRIENDS" script name "auto call"
            set Friends to my ReplaceString(Friends, " ", ",")
            set Friends to my ReplaceString(Friends, ",,", ",")
            set FriendsList to my SplitList(Friends, ",")
            set NumFriends to number of items in FriendsList
            repeat with i in FriendsList
                if (i begins with "DISABLEDxmpp:") or (i begins with "USERS") or (i begins with "ugur") or (i is "echo123") or (i begins with "esr") or (i begins with "ayt") or (i begins with "Zaf") then
                else
                    set FriendStatus to send command "GET USER " & i & " ONLINESTATUS" script name "auto call"
                    if text item 4 of FriendStatus is "ONLINE" then
                        set aUser to i
                        set aUser to my JoinList(aUser, " ")
                        set end of OnlineFriends to aUser
                    end if
                end if
            end repeat
            if (count OnlineFriends) > 0 then
                set OnlineFriends to my JoinList(OnlineFriends, ", ")
            else
                set beginning of OnlineFriends to "No Skype Friends online at this time."
            end if
        else
            set beginning of OnlineFriends to "Skype is offline."
        end if
    end tell
    return OnlineFriends
end get_online_contacts

on JoinList(l, del)
    set RetVal to ""
    set OldDel to AppleScript's text item delimiters
    set AppleScript's text item delimiters to del
    set RetVal to l as string
    set AppleScript's text item delimiters to OldDel
    return RetVal
end JoinList

on SplitList(t, del)
    set RetVal to {}
    set OldDel to AppleScript's text item delimiters
    set AppleScript's text item delimiters to del
    set RetVal to every text item of t
    set AppleScript's text item delimiters to OldDel
    return RetVal
end SplitList

on ReplaceString(theText, oldString, newString)
    set OldDel to AppleScript's text item delimiters
    set AppleScript's text item delimiters to oldString
    set tempList to every text item of theText
    set AppleScript's text item delimiters to newString
    set theText to the tempList as string
    set AppleScript's text item delimiters to OldDel
    return theText
end ReplaceString
4

0 に答える 0