{"id":277577,"date":"2021-01-13T00:15:01","date_gmt":"2021-01-12T16:15:01","guid":{"rendered":"http:\/\/4563.org\/?p=277577"},"modified":"2021-01-13T00:15:01","modified_gmt":"2021-01-12T16:15:01","slug":"macos-app-%e7%aa%97%e5%8f%a3%e6%97%b6%e5%b8%b8%e5%a4%b1%e5%8e%bb%e7%84%a6%e7%82%b9","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=277577","title":{"rendered":"macOS APP \u7a97\u53e3\u65f6\u5e38\u5931\u53bb\u7126\u70b9"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  macOS APP \u7a97\u53e3\u65f6\u5e38\u5931\u53bb\u7126\u70b9               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : bnrwnjyw <\/span>  <span><i><\/i> 1<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u5982\u9898\u3002<\/p>\n<p>\u6ca1\u505a\u4ec0\u4e48\u5462\u5f53\u524d\u7a97\u53e3\u5c31\u5931\u7126\u4e86\uff0c\u6bd4\u5982\u6253\u5b57\u6253\u4e00\u534a\u53d1\u73b0\u6587\u5b57\u4e0d\u4e0a\u5c4f\u4e86\uff0c\u624d\u53d1\u73b0\u5de6\u4e0a\u89d2\u4e09\u4e2a\u5706\u70b9\u7070\u6389\u4e86\uff0c\u4e0d\u5f97\u4e0d\u9f20\u6807\u70b9\u4e00\u70b9\u91cd\u65b0\u805a\u7126\uff0c\u975e\u5e38\u607c\u706b\u3002\u5728\u591a\u4e2a app \u4e0a\u90fd\u590d\u73b0\u4e86\u8fd9\u4e2a\u95ee\u9898\uff0c\u611f\u89c9\u662f\u540e\u53f0\u67d0\u4e2a app \u6ca1\u9053\u7406\u7684\u62a2\u5360\u4e86\u201c\u4e3b\u52a8\u6743\u201d\u3002<\/p>\n<p>\u6709\u4ec0\u4e48\u529e\u6cd5\u77e5\u9053\u7126\u70b9\u8dd1\u54ea\u53bb\u4e86\u5417\uff1f\u4f8b\u5982\u5199\u4e2a applescript \u76d1\u542c\u7a97\u53e3\u7126\u70b9\u53d8\u5316\uff1f\u6ca1\u5199\u8fc7\u4e0d\u77e5\u9053\u53ef\u4e0d\u53ef\u884c\u3002<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>3<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4922556\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : starrystarry <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             #!\/usr\/bin\/python<br \/>try:<br \/> from AppKit import NSWorkspace<br \/>except ImportError:<br \/> print &#8220;Can&#8217;t import AppKit &#8212; maybe you&#8217;re running python from brew?&#8221;<br \/> print &#8220;Try running with Apple&#8217;s \/usr\/bin\/python instead.&#8221;<br \/> exit(1)<\/p>\n<p>from datetime import datetime<br \/>from time import sleep<\/p>\n<p>last_active_name = None<br \/>while True:<br \/> active_app = NSWorkspace.sharedWorkspace().activeApplication()<br \/> if active_app[&#8216;NSApplicationName&#8217;] != last_active_name:<br \/> last_active_name = active_app[&#8216;NSApplicationName&#8217;]<br \/> print &#8216;%s: %s [%s]&#8217; % (<br \/> datetime.now().strftime(&#8216;%Y-%m-%d %H:%M:%S&#8217;),<br \/> active_app[&#8216;NSApplicationName&#8217;],<br \/> active_app[&#8216;NSApplicationPath&#8217;]<br \/> )<br \/> sleep(1)                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4922557\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : starrystarry <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             https:\/\/pastebin.pl\/view\/c222ca40                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4922558\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : bnrwnjyw <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @starrystarry \u7edd\u4e86\uff0c\u611f\u8c22\uff0c\u4e00\u4f1a\u5c31\u8bd5\u8bd5                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>macOS APP \u7a97\u53e3\u65f6\u5e38\u5931\u53bb\u7126&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/277577"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=277577"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/277577\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=277577"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=277577"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=277577"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}