<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>熱鍵 &#8211; Gary&#039;s &#8230;Lasamia</title>
	<atom:link href="https://garynil.tw/tag/%e7%86%b1%e9%8d%b5/feed/" rel="self" type="application/rss+xml" />
	<link>https://garynil.tw</link>
	<description>🍎 📱 🖥 🔨 😄</description>
	<lastBuildDate>Tue, 06 Dec 2016 05:12:45 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.3</generator>

<image>
	<url>https://i0.wp.com/garynil.tw/wp-content/uploads/2017/01/cropped-Gary_v3.0.jpg?fit=32%2C32&#038;ssl=1</url>
	<title>熱鍵 &#8211; Gary&#039;s &#8230;Lasamia</title>
	<link>https://garynil.tw</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">147732124</site>	<item>
		<title>在OS X 用熱鍵快速將特定app顯示於最上層</title>
		<link>https://garynil.tw/2015/11/50/%e5%9c%a8os-x-%e7%94%a8%e7%86%b1%e9%8d%b5%e5%bf%ab%e9%80%9f%e5%b0%87%e7%89%b9%e5%ae%9aapp%e9%a1%af%e7%a4%ba%e6%96%bc%e6%9c%80%e4%b8%8a%e5%b1%a4/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=%25e5%259c%25a8os-x-%25e7%2594%25a8%25e7%2586%25b1%25e9%258d%25b5%25e5%25bf%25ab%25e9%2580%259f%25e5%25b0%2587%25e7%2589%25b9%25e5%25ae%259aapp%25e9%25a1%25af%25e7%25a4%25ba%25e6%2596%25bc%25e6%259c%2580%25e4%25b8%258a%25e5%25b1%25a4</link>
					<comments>https://garynil.tw/2015/11/50/%e5%9c%a8os-x-%e7%94%a8%e7%86%b1%e9%8d%b5%e5%bf%ab%e9%80%9f%e5%b0%87%e7%89%b9%e5%ae%9aapp%e9%a1%af%e7%a4%ba%e6%96%bc%e6%9c%80%e4%b8%8a%e5%b1%a4/#comments</comments>
		
		<dc:creator><![CDATA[Gary]]></dc:creator>
		<pubDate>Mon, 16 Nov 2015 08:43:30 +0000</pubDate>
				<category><![CDATA[Dev]]></category>
		<category><![CDATA[OSX]]></category>
		<category><![CDATA[App]]></category>
		<category><![CDATA[ShortCut]]></category>
		<category><![CDATA[熱鍵]]></category>
		<category><![CDATA[視窗]]></category>
		<guid isPermaLink="false">https://garynil1635.wordpress.com/?p=50</guid>

					<description><![CDATA[<p>因為平常在工作時的需要開很多軟體或視窗，螢幕也有點寬廣(汗)，常常要找已經開啟卻被其他軟體視窗覆蓋的東西時會花一點時間。 而如果有使用iTerm的人應該會知道，iTerm有內建個很方便的快捷鍵 Alt+Space，可以將iTerm隱藏或被覆蓋的視窗顯示在最頂層，這時你就可以快速的找到他。 於是我就在想，OS X不知道有沒有內建這個功能？ 沒有。 只好自己寫一個啦～ &#160; 一開始先往內建的快速鍵方面尋找，但他只能加入app的快捷鍵，而且也不太好用。我主要是想說如果能加入執行個一段 applescript快速利用script將需要的視窗叫到最上層的話應該就簡單很多，結果內建系統 什 麼 都 不 行 。 所以就找了一下支援可以設定全域快速鍵，觸發後可以執行applescript的軟體，結果還蠻多套的，而我接下來選擇Keyboard Maestro來介紹： Keyboard Maestro...</p>
<p>這篇文章 <a rel="nofollow" href="https://garynil.tw/2015/11/50/%e5%9c%a8os-x-%e7%94%a8%e7%86%b1%e9%8d%b5%e5%bf%ab%e9%80%9f%e5%b0%87%e7%89%b9%e5%ae%9aapp%e9%a1%af%e7%a4%ba%e6%96%bc%e6%9c%80%e4%b8%8a%e5%b1%a4/">在OS X 用熱鍵快速將特定app顯示於最上層</a> 最早出現於 <a rel="nofollow" href="https://garynil.tw">Gary&#039;s ...Lasamia</a>。</p>
]]></description>
										<content:encoded><![CDATA[<p>因為平常在工作時的需要開很多軟體或視窗，螢幕也有點寬廣(汗)，常常要找已經開啟卻被其他軟體視窗覆蓋的東西時會花一點時間。</p>
<p>而如果有使用iTerm的人應該會知道，iTerm有內建個很方便的快捷鍵 Alt+Space，可以將iTerm隱藏或被覆蓋的視窗顯示在最頂層，這時你就可以快速的找到他。<br />
<a href="https://i0.wp.com/farm6.staticflickr.com/5647/23057188735_932716aea2_k.jpg?ssl=1"><img data-recalc-dims="1" decoding="async" class="aligncenter" src="https://i0.wp.com/farm6.staticflickr.com/5647/23057188735_932716aea2_k.jpg?w=700&#038;ssl=1" alt="" /></a></p>
<p>於是我就在想，OS X不知道有沒有內建這個功能？ 沒有。<br />
只好自己寫一個啦～</p>
<p><span id="more-50"></span></p>
<p>&nbsp;</p>
<p>一開始先往內建的快速鍵方面尋找，但他只能加入app的快捷鍵，而且也不太好用。我主要是想說如果能加入執行個一段 applescript快速利用script將需要的視窗叫到最上層的話應該就簡單很多，結果內建系統 <strong>什 麼 都 不 行</strong> 。<br />
<a href="https://i0.wp.com/farm6.staticflickr.com/5790/22664928199_28e7834499_b.jpg?ssl=1"><img data-recalc-dims="1" decoding="async" class="aligncenter" src="https://i0.wp.com/farm6.staticflickr.com/5790/22664928199_28e7834499_b.jpg?w=700&#038;ssl=1" alt="" /></a></p>
<p>所以就找了一下支援可以設定全域快速鍵，觸發後可以執行applescript的軟體，結果還蠻多套的，而我接下來選擇<a href="http://www.keyboardmaestro.com/main/" target="_blank">Keyboard Maestro</a>來介紹：</p>
<p>Keyboard Maestro真的蠻強大的，支援了很多功能，而我最需要的執行applescript還可以在他裡面撰寫與編輯，雖然他compile顯示的怪怪的就是了，還是建議大家先在內建的applescript程式寫好在丟過去。<br />
<a href="https://i0.wp.com/farm6.staticflickr.com/5785/22638795988_ff3003a655_k.jpg?ssl=1"><img data-recalc-dims="1" fetchpriority="high" decoding="async" class="aligncenter" src="https://i0.wp.com/farm6.staticflickr.com/5785/22638795988_ff3003a655_k.jpg?resize=700%2C532&#038;ssl=1" alt="" width="700" height="532" /></a></p>
<p>主要介面稍微研究一下大概就能瞭解，你所需要的是設定一組trigger -&gt; Hot key並將action設定成Execute applescript，並在下面貼入你寫好的程式便可以用熱鍵執行，超簡單的！</p>
<p><a href="https://i0.wp.com/farm6.staticflickr.com/5630/22664928509_190f42599d_h.jpg?ssl=1"><img data-recalc-dims="1" decoding="async" class="aligncenter" src="https://i0.wp.com/farm6.staticflickr.com/5630/22664928509_190f42599d_h.jpg?resize=700%2C627&#038;ssl=1" alt="" width="700" height="627" /></a></p>
<p>接下來我介紹一下我寫的快速呼叫app的applescript，語法在網路上尋找就有教學了，這部分不多介紹(我也是google才學會的XD)：</p>
<p>在過程中主要遇到了三個問題</p>
<p>1.<strong>app bundle name呼叫</strong>沒反應</p>
<p>這個問題我是在Airmail上面遇到的，主要是因為我是使用beta版，這時候你要進去 /Applications/程式名稱.app/Contents/MacOS/ 去查看那個應用程式的binary名稱才準確，一開始我以為使用活動監視器看到的名稱就可以了，但這樣有機率是錯誤的。</p>
<p><a href="https://i0.wp.com/farm1.staticflickr.com/574/23031140036_3681531f9a_k.jpg?ssl=1"><img data-recalc-dims="1" decoding="async" class="aligncenter" src="https://i0.wp.com/farm1.staticflickr.com/574/23031140036_3681531f9a_k.jpg?resize=700%2C480&#038;ssl=1" alt="" width="700" height="480" /></a></p>
<p>2.app縮小後，用 <strong>tell</strong> <strong>application &#8220;程式名稱&#8221; to activate</strong><b> 會沒反應。</b></p>
<p>主要原因是你要先將application reopen (minimize的反狀態，如果你不是在minimize時呼叫不影響)之後在activate就能正常了</p>
<p>3.<strong>count of Finder windows<i> </i></strong>的數目不正確</p>
<p>這邊要注意的是這個數目是指視窗而非頁籤數量，另外在minimize狀態時這個數量會為0，所以你要先讓程式reopen在去抓這個數值。</p>
<p>接下來就簡單介紹一下主程式，我的流程主要是：<br />
<a href="https://i0.wp.com/farm6.staticflickr.com/5706/23031140016_cc215a055e_h.jpg?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" class="aligncenter" src="https://i0.wp.com/farm6.staticflickr.com/5706/23031140016_cc215a055e_h.jpg?resize=700%2C598&#038;ssl=1" width="700" height="598" /></a></p>
<p>1.得到當前active app的list，並檢查我的程式(這裡以Finder為例)有沒有在內</p><pre class="urvanov-syntax-highlighter-plain-tag">set activeApp to name of first application process whose frontmost is true</pre><p>如果在內，就將其visible設置到最前</p><pre class="urvanov-syntax-highlighter-plain-tag">if &quot;Finder&quot; is in activeApp then 
set visible of process &quot;Finder&quot; to false</pre><p>如果不在內，就先將其reopen(最大化)並activate(切換到他)，保險起建在檢查一下他有沒有任何視窗開啟，沒有的話(代表上次關掉所有視窗了)任意的開啟一個新的頁面，大致上這樣就能讓你在工作時超方便的快速切換到該app，而我綁定的按鍵是alt+數字(方便我記憶)。</p><pre class="urvanov-syntax-highlighter-plain-tag">tell application &quot;Finder&quot; to reopen
tell application &quot;Finder&quot; to activate</pre><p>完整的code附在<a href="https://github.com/GaryniL/Quick-Show-App" target="_blank">Github</a>上～</p>
<p>這篇文章 <a rel="nofollow" href="https://garynil.tw/2015/11/50/%e5%9c%a8os-x-%e7%94%a8%e7%86%b1%e9%8d%b5%e5%bf%ab%e9%80%9f%e5%b0%87%e7%89%b9%e5%ae%9aapp%e9%a1%af%e7%a4%ba%e6%96%bc%e6%9c%80%e4%b8%8a%e5%b1%a4/">在OS X 用熱鍵快速將特定app顯示於最上層</a> 最早出現於 <a rel="nofollow" href="https://garynil.tw">Gary&#039;s ...Lasamia</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://garynil.tw/2015/11/50/%e5%9c%a8os-x-%e7%94%a8%e7%86%b1%e9%8d%b5%e5%bf%ab%e9%80%9f%e5%b0%87%e7%89%b9%e5%ae%9aapp%e9%a1%af%e7%a4%ba%e6%96%bc%e6%9c%80%e4%b8%8a%e5%b1%a4/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">50</post-id>	</item>
	</channel>
</rss>
