Applescript -- OSX Mail -- 如果段落以三位数开头,则使某些单词加粗
创始人
2024-09-10 20:30:08
0

以下是一个使用AppleScript在OSX邮件中将某些单词加粗的示例代码:

tell application "Mail"
    set selectedMessages to selection
    repeat with theMessage in selectedMessages
        set messageContent to content of theMessage
        set paragraphsList to paragraphs of messageContent
        
        repeat with theParagraph in paragraphsList
            set paragraphText to text of theParagraph
            set firstThreeCharacters to text 1 thru 3 of paragraphText
            
            if firstThreeCharacters is a number then
                set boldWords to {}
                set wordsList to words of theParagraph
                
                repeat with theWord in wordsList
                    if theWord is "example" or theWord is "words" then
                        set end of boldWords to "" & theWord & ""
                    else
                        set end of boldWords to theWord
                    end if
                end repeat
                
                set newParagraphText to boldWords as string
                set text of theParagraph to newParagraphText
            end if
        end repeat
    end repeat
end tell

此示例代码会将选定的邮件消息中以三位数开头的段落中的"example"和"words"这两个单词加粗。你可以根据需要修改这两个单词,或添加其他需要加粗的单词。

请注意,此代码只会修改选定的邮件消息中的段落文本。如果你想要在所有邮件中运行此代码,请将set selectedMessages to selection改为set selectedMessages to every message of inbox

相关内容

热门资讯

透视实锤!hhpoker辅助软... 透视实锤!hhpoker辅助软件下载,we-poker有人玩吗,必赢方法(其实存在有挂);大神普及一...
透视线上!hhpoker怎么开... 透视线上!hhpoker怎么开透视,wepoker插件功能辅助器,解说技巧(一向存在有挂);原来确实...
透视好友房!hhpoker透视... 透视好友房!hhpoker透视脚本下载,wepoker辅助器有哪些功能,专业教程(原生存在有挂),亲...
透视了解!wepoker免费永... 透视了解!wepoker免费永久脚本,epoker透视底牌,细节方法(从来存在有挂)关于wepoke...
透视游戏!aapkoer德州辅... 透视游戏!aapkoer德州辅助挂下载,wpk插件,爆料教程(原先存在有挂)1、这是跨平台的aapk...
透视脚本!wpk透视脚本视频,... 透视脚本!wpk透视脚本视频,wepoker私人局可以透视,专业教程(先前是有挂);(需添加指定Q群...
透视模拟器!智星菠萝可以辅助吗... 透视模拟器!智星菠萝可以辅助吗,hhpoker俱乐部是干嘛的,可靠教程(确实真的是有挂);科技详细教...
透视数据!aapoker辅助工... 透视数据!aapoker辅助工具存在吗,wpk德州局怎么透视,扑克教程(真是是真的有挂);1分钟了解...
透视新版!wepoker辅助工... 透视新版!wepoker辅助工具,智星德州插件2024最新版,2025新版总结(素来是有挂);小薇(...
透视有挂!wepoker辅助器... 透视有挂!wepoker辅助器是真的的吗,wepoker辅助器是真的吗,软件教程(从前是有挂);科技...