Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/http/4.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
值列表中的Applescript和空邮件签名/输入_Applescript - Fatal编程技术网

值列表中的Applescript和空邮件签名/输入

值列表中的Applescript和空邮件签名/输入,applescript,Applescript,我的applescript有两个问题。脚本应该通过电子邮件发送一个删除的文件作为附件,并从列表中询问邮件的对象。 消息的内容必须为空 1如何设置空电子邮件签名,因为我的邮件内容应为空。我收到邮件中的错误代码无法解决签名错误 2我希望用户可以修改值列表{00111111111-number1,0011111111-number2…}并添加更多的数字。最好的方法是什么 非常感谢您的建议 property theSubject : "subject" property theNumber : "" p

我的applescript有两个问题。脚本应该通过电子邮件发送一个删除的文件作为附件,并从列表中询问邮件的对象。 消息的内容必须为空

1如何设置空电子邮件签名,因为我的邮件内容应为空。我收到邮件中的错误代码无法解决签名错误

2我希望用户可以修改值列表{00111111111-number1,0011111111-number2…}并添加更多的数字。最好的方法是什么

非常感谢您的建议

property theSubject : "subject"
property theNumber : ""
property theContent : ""
property theSignature : "none"
property onRun : ""

on run
    tell application "Finder"
        set sel to (get selection)
    end tell
    set onRun to 1
    new_mail(sel)
end run

on open droppedFiles
    new_mail(droppedFiles)
end open

on new_mail(theFiles)
set chosen to choose from list {"0011111111111-number1", "0011111111111-number2"} with prompt "Thanks to select"
if chosen is false then return "" -- in case of 'Cancel' return empty string
set theNumber to text 1 thru 13 of (item 1 of chosen) -- as chosen returns a list by default it must be flattened

tell application "Mail"
    set newMessage to make new outgoing message with properties {visible:true, subject:theNumber}
    tell newMessage
        make new to recipient with properties {address:faxboxEmail}
        if onRun < 1 then
            make new attachment with properties {file name:theFiles as alias} at after last paragraph
        end if
        set the content to theContent
        set message signature of newMessage to signature theSignature
    end tell
    activate
    if onRun < 1 then
        send
    end if
end tell
end new_mail

我在签名和附件方面也遇到了一些问题。如果删除该行,请创建新附件。。。签名行正在运行。此外,如果您将签名行移到附件行之前,并在附件行之前中断,则签名将正常。臭虫

然后,根据我的测试,如果您根本不需要签名,只需删除行集消息签名。。。默认情况下,不会设置签名。 我的最后一点意见是通过直接在makenewoutingmessage的属性列表中添加内容来减少脚本

tell application "Mail"
set newMessage to make new outgoing message with properties {visible:true, subject:TheNumber, content:TheContent}
tell newMessage
    make new to recipient with properties {address:faxboxmail}
    if onRun > 1 then
        make new attachment with properties {file name:theFile as alias} at after last paragraph
    end if
end tell
activate
end tell

我试过了,它创建的邮件没有内容也没有签名,正如预期的mail 8.2所示。要在列表中添加新项目,这可能对您有帮助吗

set BaseList to {"0011111111111-number1", "0011111111111-number2"}

set CList to BaseList & {"Add new item"}
set chosen to choose from list CList with prompt "Thanks to select"
if chosen is false then return "" -- in case of 'Cancel' return empty string
if "Add new item" is in chosen then
set OKNew to false
repeat until OKNew
    set NewItem to display dialog "Enter new value :" default answer ""
    set OKNew to (button returned of NewItem is "OK") and (text returned of NewItem is not "")
    set theNumber to text returned of NewItem
set BaseList to baseList & {theNumber}  -- to add the new item in the BaseList
end repeat
else
set theNumber to text 1 thru 13 of (item 1 of chosen) -- as chosen returns a list by default it must be flattened
end if

感谢您的回答,如果您删除了签名行,您是对的。即使签名设置为电子邮件帐户,它也可以工作。在我之前的测试中,我可能犯了一个错误,因为它不起作用,即使没有签名行,也添加了签名。无论如何,非常感谢!你对我的第二个问题有什么想法吗?如何使用户能够在列表编号中添加自己的编号?谢谢。将数字添加到列表中:您已达到Applescript用户界面的限制。我建议您在列表中添加一个valueAdd新项。然后,用户可以单击“确定”或“取消”,如果他选择“添加新项目”,则您将显示一个新对话框,要求输入新项目。谢谢。但是,是否可以保存新项目以备下次使用?我只是在上面的脚本中添加了一行,以添加在基线列表第11行中输入的新项目,然后再重复结束