首页 \ 问答 \ 获取草稿的收件人(AppleScript,Mail.app)(Get the recipient of a draft (AppleScript, Mail.app))

获取草稿的收件人(AppleScript,Mail.app)(Get the recipient of a draft (AppleScript, Mail.app))

我希望通过AppleScript使用草稿文件夹Mail.app获取草稿的收件人(“到”字段等)。 似乎无法找到正确的语法。

谢谢。


I want to get the recipients ("to" fields, etc) of a draft on my draft's folder of Mail.app, by using AppleScript. Can't seem to find the correct syntax to that.

Thanks.


原文:https://stackoverflow.com/questions/8193785
更新时间:2023-01-20 09:01

最满意答案

我的意思是使用内置的过滤函数似乎更符合逻辑,但是如果你绝对坚持使用公式/代码,那么:

只需使用这个简单的程序

Private Sub sort_wares(From As String, toColumn As Integer)

    Dim ws As Worksheet: Set ws = Sheets("Sheet1")
    Dim tbl As ListObject: Set tbl = ws.ListObjects("Table1")
    Dim index As Integer
    index = 2

    For Each Rng In tbl.ListColumns(2).DataBodyRange
        If Trim(LCase(Rng)) = Trim(LCase(From)) Then

            ws.Cells(index, toColumn + 1) = Rng
            ws.Cells(index, toColumn) = Rng.Offset(0, -1)

            index = index + 1
        End If

    Next Rng
End Sub

您可以轻松调用该程序,例如,如果我们从以下数据中查找津巴布韦的所有商品并将其打印到第5列(E),我们将执行以下操作

Call sort_wares("Zimbabwe", 5)

在这里输入图像描述


I mean it seems far more logical to utilize the inbuilt filter function, but if you absolutely insist on using formulas / code then:

Just use this simple procedure

Private Sub sort_wares(From As String, toColumn As Integer)

    Dim ws As Worksheet: Set ws = Sheets("Sheet1")
    Dim tbl As ListObject: Set tbl = ws.ListObjects("Table1")
    Dim index As Integer
    index = 2

    For Each Rng In tbl.ListColumns(2).DataBodyRange
        If Trim(LCase(Rng)) = Trim(LCase(From)) Then

            ws.Cells(index, toColumn + 1) = Rng
            ws.Cells(index, toColumn) = Rng.Offset(0, -1)

            index = index + 1
        End If

    Next Rng
End Sub

You can easily invoke the procedure, so for example if we from the following data wanted to look up all the wares from Zimbabwe and print them to the 5th Column (E) we would do the following

Call sort_wares("Zimbabwe", 5)

enter image description here

相关问答

更多
  • 我更喜欢在几乎所有情况下使用INDEX / MATCH ,因为它更灵活,并且根据查找表的大小,可能更有效。 唯一可以证明使用VLOOKUP是非常直接的表,其中列索引号是动态的,尽管在这种情况下, INDEX / MATCH同样可行。 我将在下面给出一些具体的例子来说明这两种方法之间的细节差异。 INDEX / MATCH可以向左 (或任何你想要的) 查找 这可能是INDEX / MATCH最明显的优势,也是VLOOKUP最大的挫折之一。 VLOOKUP只能向右查找, INDEX / MATCH可以从任何范围 ...
  • 为了避免我能想到的所有错误,您需要将其更改为不那么好看的方式: Sub changeToIndex() Dim xText As Boolean Dim xBrac As Long Dim VLSep As New Collection Dim i As Long, t As String With Selection.Cells(1, 1) 'just for now 'it assumes that there is NEVER a text string which ...
  • 这是你在找什么? 就像你说的那样,这是一个INDEX MATCH,你可以在每个状态下水平复制和复制。 它检查代码,检查顶部的状态,如果它们匹配,则会带入数量(否则为空)。 =IF(INDEX($D$17:$D$28, MATCH($A2, $A$17:$A$28, 0)) = D$1, INDEX($E$17:$E$28, MATCH($A2, $A$17:$A$28, 0)), "") 编辑:我看到下面列出的问题Code&State不一定是唯一的。 我们将通过连接代码,ID和状态来强制一个唯一的ID(我 ...
  • 如果我理解你很好,你想为所有东部比赛添加积分,所以在你的图片中,你想得到9? SUMIFS似乎是您最好的选择。 =SUMIFS(A11:A33,A2:A24,"East",D11:D33,"Points") 有几点需要注意: 范围的“高度”必须相同: 总和是23行高; 第一个标准范围是23行高; 第二个标准范围是23行高。 If I understand you well, you want to add the points up for all the East matches, so in your ...
  • 我在@ Jeeped的评论的同时写完了我的答案,另一个答案出现了。 还是值得分享的,因为它展示了如何在公式中推出几个专栏 =IFERROR(INDEX(Sheet1!$D$2:$I$10,AGGREGATE(15,6,ROW(Sheet1!$D$2:$D$10)/(Sheet1!$D$2:$D$10=$D$2),ROW()-ROW($3:$3))-ROW($1:$1),COLUMN()-COLUMN($C:$C)),"") 第一张纸上的数据看起来像这样 第二张是这样的 I finished writing ...
  • 我的意思是使用内置的过滤函数似乎更符合逻辑,但是如果你绝对坚持使用公式/代码,那么: 只需使用这个简单的程序 Private Sub sort_wares(From As String, toColumn As Integer) Dim ws As Worksheet: Set ws = Sheets("Sheet1") Dim tbl As ListObject: Set tbl = ws.ListObjects("Table1") Dim index As Integer ...
  • 在VBA中,如果Variant包含vbError值,则IsErrror函数返回true。 即使该变量是变体,但没有找到匹配时发生错误,该值也不会分配给Result变量。 您将不得不使用On Error Goto ...方法捕获该错误。 这不是什么大不了的事。 你的代码可能看起来像这样。 Result = "" On Error Resume Next Result = WorksheetFunction.Index(Sheet2.Range("A:A"), _ WorksheetFunct ...
  • 尝试这个: =VLOOKUP(D2,$A$2:$B$6,2,FALSE) 然后拖动公式。 在我的例子中,我使用以下公式(其中包括一个额外的行) =VLOOKUP(D2,$A$2:$B$7,2,FALSE) VLOOKUP接受以下参数: VLOOKUP(Value to Lookup, Range to Search, Column To Return, Range Lookup) 您通常希望将Range Lookup设置为FALSE ,否则它会返回“近似匹配”,根据我的经验,它很少是正确的 Range_ ...
  • 假设我们有以下数据: 我们想在表中从A1到H14中查找单词hello ,并从列J中检索相关值 选择一些单元格,比如K1 ,然后输入: 你好 然后在另一个单元格中输入数组公式 : =INDEX(J1:J14,MIN(IF($A$1:$H$14=K1,ROW($A$1:$H$14)-ROW($A$1)+1))) 必须使用Ctrl + Shift + Enter输入 数组公式 ,而不仅仅是Enter键。 Say we have data like: We want to lookup the word hell ...
  • 所以你想得到供应商/日期/数量。 我猜你问题解决问题的最初想法是让事情过于复杂。 我个人会使用tab2上的Supplier / Date表作为起点,并在该选项卡中添加一个带有公式的列以获取数量。 这个公式将引用tab1 ,只需在日期上查看vlookup并检索数量就可以正常工作: 所以在tab2列C(特别是单元格C2)上: =VLOOKUP(A2 ; tab1!A:B ; 2 ; FALSE) 或者如果您需要逗号作为分隔符: =VLOOKUP(A2 , tab1!A:B , 2 , FALSE) So y ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)