Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Macos 有人知道如何创建快捷方式将选定文件附加到iMessage吗?_Macos_Command_Osx Lion_Imessage - Fatal编程技术网

Macos 有人知道如何创建快捷方式将选定文件附加到iMessage吗?

Macos 有人知道如何创建快捷方式将选定文件附加到iMessage吗?,macos,command,osx-lion,imessage,Macos,Command,Osx Lion,Imessage,我希望能够在我的桌面上选择一个项目,并键入一个快捷方式,以便使用Messages应用程序将所选项目附加到新邮件。我试图在Finder.app键入Share>Message下的系统首选项/键盘/键盘快捷键/应用程序快捷键中创建一个,但没有成功。我用automator创建了一个新电子邮件的快捷方式,其中包含选择,但邮件不是其中的一个选项。我还试着为这个搜索Applescript或terminal命令,这样我就可以使用更好的触控工具进行滑动动作。我和一位苹果公司的高级顾问谈过,他说他也不知道怎么做,也

我希望能够在我的桌面上选择一个项目,并键入一个快捷方式,以便使用Messages应用程序将所选项目附加到新邮件。我试图在Finder.app键入Share>Message下的系统首选项/键盘/键盘快捷键/应用程序快捷键中创建一个,但没有成功。我用automator创建了一个新电子邮件的快捷方式,其中包含选择,但邮件不是其中的一个选项。我还试着为这个搜索Applescript或terminal命令,这样我就可以使用更好的触控工具进行滑动动作。我和一位苹果公司的高级顾问谈过,他说他也不知道怎么做,也不知道如何在论坛上发布

如果有人知道如何为这个行动抄近路,请让我知道

更新:我从/System/Library/privateframes/ShareKit.Framework/Versions/A/Plugins/Message s.sharingservice/Contents/MacOS复制了这个

如果有人知道这条线是否可以通过automator转换为.service,请告诉我如何进行/修改

谢谢

/System/Library/PrivateFrameworks/ShareKit.framework/Versions/A/PlugIns/Messages.sharingservice/Contents/MacOS/Messages;出口 NAME Mac:~NAME$/System/Library/privateframes/ShareKit.framework/Versions/A/PlugIns/Messages s s.sharingservice/Contents/MacOS/Messages;出口 -bash:/System/Library/privateframes/ShareKit.framework/Versions/A/PlugIns/Messages s s.sharingservice/Contents/MacOS/Messages

-- 
延迟0.218623 将timeoutSeconds设置为2.000000 将uiScript设置为单击应用程序进程\Finder的滚动区域1的组1的image\Test File\\ 我的doWithTimeout uiScript,timeoutSeconds

-信息 延迟0.263641 将timeoutSeconds设置为2.000000 将uiScript设置为单击应用程序进程\Finder的滚动区域1的组1的菜单项\Share\的菜单项\Message\的菜单1\ 我的doWithTimeout uiScript,timeoutSeconds

在doWithTimeoutuiScript上,timeoutSeconds 将endDate设置为当前日期+timeoutSeconds 重复 尝试 运行脚本告诉应用程序\系统事件\ &uiScript& 结束语 退出重复 关于错误消息 如果当前日期>结束日期,则 错误:无法使用uiScript(&U) 如果结束 结束尝试 结束重复
结束doWithTimeout

我看不出如何让它们运行

您可以设置一个Automator服务,将其输入设置为文件夹和文件

并在运行Applescript操作中使用此代码

这是可行的,但最主要的问题是找到正确的伙伴。我已经设置好了,你可以选择你想要的。还需要做更多的工作,我希望您可以键入一个名称,然后返回匹配名称和句柄的较小列表

on run {input, parameters}

    set buddieList to {}
    set splitter to "======"
    tell application "Messages"
        --set buddieList to {name of buddies, handle of buddies}
        repeat with i from 1 to number of items in buddies
            set this_item to item i of buddies
            copy (name of this_item as string) & splitter & handle of this_item as string to end of buddieList

        end repeat
    end tell


    set inputAlias to item 1 of input as alias

    set text_returned to item 1 of (choose from list buddieList with prompt "TO:" without multiple selections allowed and empty selection allowed)
    set theBuddy to (do shell script "echo  " & quoted form of text_returned & " | awk -F" & splitter & " '{print $2}'")
    tell application "Messages"
        set theBuddy to first buddy whose handle is theBuddy

        send inputAlias to theBuddy

    end tell

end run
**更新

关于你的评论: 我实际上没有在finder共享中使用搜索字段。因此,很高兴看到它的结构与我构建选择器的方式相同-

但它似乎是在搜索你的联系人而不是好友列表

因此,这个新脚本使用了对联系人姓名的搜索,其中包含您输入的任何文本。 就像真正的份额一样。无法保证人员号码或电子邮件将链接到iMessages他们的目的地

还请注意,我在几分钟内就完成了这项工作。所以它并没有看上去那么整洁。但它给了你一些可以玩的东西

on run {input, parameters}

    set buddieList to {}
    set splitter to "======"
    tell application "Messages"
        activate
        display dialog "Name Contains.." default answer "" buttons {"Cancel", "OK"} default button 2
        copy the result as list to {text_returned, button_pressed}

    end tell
    tell application "Contacts"

        set buddies to people whose name contains text_returned

        repeat with a from 1 to number of items in buddies

            set this_name to name of item a of buddies
            set this_email to email of item a of buddies
            set this_phone to phone of item a of buddies
            repeat with e from 1 to number of items in this_email

                set this_email_item to item e of this_email
                if this_email_item is not {} then
                    copy (this_name) & splitter & value of this_email_item as string to end of buddieList
                end if
            end repeat

            repeat with e from 1 to number of items in this_phone

                set this_iphone_item to item e of this_phone
                if this_iphone_item is not {} then
                    copy (this_name) & splitter & value of this_iphone_item as string to end of buddieList
                end if
            end repeat

        end repeat
    end tell

    tell application "Messages" to set text_returned to item 1 of (choose from list buddieList with prompt "TO:" without multiple selections allowed and empty selection allowed)

    set inputAlias to item 1 of input as alias

    set theBuddy to (do shell script "echo  " & quoted form of text_returned & " | awk -F" & splitter & " '{print $2}'")
    tell application "Messages"
        try
            set findBuddy to first buddy whose handle is theBuddy


            send inputAlias to findBuddy
        on error
             display dialog "NO BUDDY Found with " & theBuddy
        end try
    end tell

end run

这意味着要在Automator中运行Applescript操作。作为一种服务。复制并粘贴它,替换所有默认代码


但它只显示了前两个伙伴。有没有办法显示消息弹出窗口来搜索好友?谢谢你的帮助。我尝试了它,它打开了消息,但没有发送选定的文件。有没有办法通过使用shell脚本的Automator服务选择右键单击菜单项Share>Messages?这意味着要在Automator中运行Applescript操作。作为一种服务。复制并粘贴它,替换所有默认代码。我刚刚在这里再次测试了它,它成功了。请参阅我刚刚附上的图片。我按照说明操作,它会在后台打开iMessage。当我把它带到前面时,它的名字包含。。窗口出现。我输入好友的电子邮件地址,联系人应用程序启动,它给我这个错误:“运行AppleScript”操作遇到错误。对不起,我刚刚注意到我发布的脚本中有一个拼写错误。我用了“如果这个iphone项目不是{}那么”而不是“如果这个email项目不是{}那么”。脚本现在已更新。请记住,您需要保存设备并在单击文件并转到“服务”时运行它。