{"id":788,"date":"2004-02-26T16:24:41","date_gmt":"2004-02-26T21:24:41","guid":{"rendered":"\/?p=788"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-30T04:00:00","slug":"enter_search_string_and_s","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2004\/02\/26\/enter_search_string_and_s\/","title":{"rendered":"Enter Search String and Send Now"},"content":{"rendered":"<p>\n<a href=\"http:\/\/daringfireball.net\/2004\/02\/send_now_defense\">John Gruber<\/a> had the bright idea of using a menu script to override Mailsmith&rsquo;s Send Now command. Send Now has the same keyboard shortcut as Enter Search String in BBEdit, so if he has text selected in the message window, he probably meant to enter the search string rather than send the message. In this circumstance, Gruber&rsquo;s script asks for confirmation that you want to send the message. Below is a modification of his script. My version sets the search string to the selected text and then doesn&rsquo;t send the message. In other words, the script guesses the appropriate action and then does it.\n<\/p>\n\n<pre>\non enterSearchString()\n    tell application \"System Events\"\n        tell application process \"Mailsmith\"\n            click menu item \"Enter Search String\" of menu \"Search\" of menu bar 1\n        end tell\n    end tell\nend\n\non menuselect()\n    tell application \"Mailsmith\"\n        tell message window 1\n            if (selection as text) is not \"\" then\n                my enterSearchString()\n                return true\n            else\n                return false\n            end if\n        end tell\n    end tell\nend menuselect\n<\/pre>\n\n<p>\nOne problem is that if the message isn&rsquo;t sendable (i.e. if no recipients have been entered), then the menu item will be disabled and the menu script  can&rsquo;t be used.\n<\/p>","protected":false},"excerpt":{"rendered":"<p>John Gruber had the bright idea of using a menu script to override Mailsmith&rsquo;s Send Now command. Send Now has the same keyboard shortcut as Enter Search String in BBEdit, so if he has text selected in the message window, he probably meant to enter the search string rather than send the message. In this [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[2],"tags":[],"class_list":["post-788","post","type-post","status-publish","format-standard","hentry","category-technology"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/788","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=788"}],"version-history":[{"count":0,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/788\/revisions"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=788"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=788"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=788"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}