<?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>eFi.blog &#187; AppleScript</title>
	<atom:link href="http://fns.csokolade.hu/category/mac/applescript/feed/" rel="self" type="application/rss+xml" />
	<link>http://fns.csokolade.hu</link>
	<description>szánSájn, tibiCsoki, wörldPísz!</description>
	<lastBuildDate>Fri, 03 Feb 2012 14:53:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Yet another meteo script update</title>
		<link>http://fns.csokolade.hu/2011/12/15/yet-another-meteo-script-update/</link>
		<comments>http://fns.csokolade.hu/2011/12/15/yet-another-meteo-script-update/#comments</comments>
		<pubDate>Thu, 15 Dec 2011 15:22:11 +0000</pubDate>
		<dc:creator>eFi</dc:creator>
				<category><![CDATA[AppleScript]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Misc]]></category>

		<guid isPermaLink="false">http://fns.csokolade.hu/?p=2132</guid>
		<description><![CDATA[A korábbi időjárásscript aktualizált verziója, régi és friss Growl-ra, fixált curl hívással: (* Meteo by Gabor PENOFF (http://fns.csokolade.hu) &#160; release 20111215_161716 &#160; Requirements: - before run you need to Enable Access for Assistive Devices in SysPrefs/Universal Access - install Growl to get non-modal notification dialogs &#160; Usage: - just run the script &#160; That's all. [...]]]></description>
			<content:encoded><![CDATA[<p>A <a href="http://fns.csokolade.hu/2010/05/16/meteo-script-update/">korábbi</a> időjárásscript aktualizált verziója, régi és friss Growl-ra, fixált curl hívással:</p>

<div class="wp_syntax"><div class="code"><pre class="applescript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">(*
	Meteo
	by Gabor PENOFF (http://fns.csokolade.hu)
&nbsp;
	release 20111215_161716
&nbsp;
	Requirements:
	- before run you need to Enable Access for Assistive Devices in SysPrefs/Universal Access
	- install Growl to get non-modal notification dialogs
&nbsp;
	Usage:
	- just run the script
&nbsp;
	That's all.
*)</span>
&nbsp;
<span style="color: #ff0033; font-weight: bold;">set</span> myScriptID <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;Meteo&quot;</span> <span style="color: #808080; font-style: italic;">-- ID for Growl display</span>
&nbsp;
<span style="color: #808080; font-style: italic;">-- set date variables:</span>
<span style="color: #ff0033; font-weight: bold;">set</span> myYear <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #ff0033; font-weight: bold;">get</span> <span style="color: #0066ff;">text</span> <span style="color: #000000;">1</span> <span style="color: #ff0033;">thru</span> <span style="color: #000000;">4</span> <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #000000;">&#40;</span>year <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #000000;">&#40;</span>current date<span style="color: #000000;">&#41;</span> <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">string</span><span style="color: #000000;">&#41;</span>
<span style="color: #ff0033; font-weight: bold;">set</span> myMonth <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">month</span> <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #000000;">&#40;</span>current date<span style="color: #000000;">&#41;</span> <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">number</span>
<span style="color: #ff0033; font-weight: bold;">if</span> myMonth <span style="color: #000000;">&lt;</span> <span style="color: #000000;">10</span> <span style="color: #ff0033; font-weight: bold;">then</span> <span style="color: #ff0033; font-weight: bold;">set</span> myMonth <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;0&quot;</span> <span style="color: #000000;">&amp;</span> myMonth <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">string</span>
<span style="color: #ff0033; font-weight: bold;">set</span> myDay <span style="color: #ff0033; font-weight: bold;">to</span> day <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #000000;">&#40;</span>current date<span style="color: #000000;">&#41;</span>
<span style="color: #ff0033; font-weight: bold;">if</span> myDay <span style="color: #000000;">&lt;</span> <span style="color: #000000;">10</span> <span style="color: #ff0033; font-weight: bold;">then</span> <span style="color: #ff0033; font-weight: bold;">set</span> myDay <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;0&quot;</span> <span style="color: #000000;">&amp;</span> myDay <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">string</span>
<span style="color: #ff0033; font-weight: bold;">set</span> myHour <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">hours</span> <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #000000;">&#40;</span>current date<span style="color: #000000;">&#41;</span>
<span style="color: #ff0033; font-weight: bold;">if</span> myHour <span style="color: #000000;">&lt;</span> <span style="color: #000000;">10</span> <span style="color: #ff0033; font-weight: bold;">then</span> <span style="color: #ff0033; font-weight: bold;">set</span> myHour <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;0&quot;</span> <span style="color: #000000;">&amp;</span> myHour <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">string</span>
<span style="color: #ff0033; font-weight: bold;">set</span> myMinute <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;00&quot;</span>
&nbsp;
<span style="color: #ff0033; font-weight: bold;">set</span> tmpDir <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;delme-meteo&quot;</span>
<span style="color: #ff0033; font-weight: bold;">set</span> myFilePrefix <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;delme-met-&quot;</span>
<span style="color: #ff0033; font-weight: bold;">set</span> tIdokepStart <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;http://www.idokep.hu/arch_kep.php?kep=&quot;</span>
&nbsp;
<span style="color: #ff0033; font-weight: bold;">set</span> myURLs <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#123;</span>¬
	<span style="color: #009900;">&quot;http://terkep.idokep.hu/kep.php?kep=mix|jpg&quot;</span>, ¬
	<span style="color: #009900;">&quot;http://terkep.idokep.hu/kep.php?kep=hoterkep2&amp;regio=hu1680|jpg&quot;</span>, ¬
	<span style="color: #009900;">&quot;http://terkep.idokep.hu/kep.php?kep=felhokep2&amp;regio=hu1680|jpg&quot;</span>, ¬
	<span style="color: #009900;">&quot;http://terkep.idokep.hu/kep.php?kep=szelterkep2_anim|gif&quot;</span>, ¬
	<span style="color: #009900;">&quot;http://terkep.idokep.hu/kep.php?kep=szelterkep2&amp;regio=hu1680|jpg&quot;</span>, ¬
	<span style="color: #009900;">&quot;http://terkep.idokep.hu/kep.php?kep=legnyomasterkep|jpg&quot;</span>, ¬
	<span style="color: #009900;">&quot;http://feny.idokep.hu/kep.php?kep=csap24|jpg&quot;</span>, ¬
	<span style="color: #009900;">&quot;http://feny.idokep.hu/kep.php?kep=csap1|jpg&quot;</span>, ¬
	<span style="color: #009900;">&quot;http://feny.idokep.hu/kep.php?kep=aqua|jpg&quot;</span>, ¬
	<span style="color: #009900;">&quot;http://terkep.idokep.hu/kep.php?kep=rh|jpg&quot;</span>, ¬
	<span style="color: #009900;">&quot;http://terkep.idokep.hu/kep.php?kep=uv|jpg&quot;</span>, ¬
	<span style="color: #009900;">&quot;http://terkep.idokep.hu/kep.php?kep=pollen0|jpg&quot;</span>, ¬
	<span style="color: #009900;">&quot;http://terkep.idokep.hu/kep.php?kep=radar&amp;regio=eu|jpg&quot;</span><span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #ff0033; font-weight: bold;">set</span> rootDir <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#40;</span><span style="color: #0066ff;">path to</span> home <span style="color: #0066ff;">folder</span> <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">string</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot;Pictures&quot;</span>
<span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;Finder&quot;</span> <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #ff0033; font-weight: bold;">set</span> fullDir <span style="color: #ff0033; font-weight: bold;">to</span> rootDir <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot;:&quot;</span> <span style="color: #000000;">&amp;</span> tmpDir <span style="color: #808080; font-style: italic;">-- save fullDir</span>
&nbsp;
<span style="color: #ff0033; font-weight: bold;">set</span> myNotification <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;Downloading METEO images to &quot;</span> <span style="color: #000000;">&amp;</span> <span style="color: #000000;">&#40;</span><span style="color: #0066ff;">POSIX path</span> <span style="color: #ff0033; font-weight: bold;">of</span> fullDir<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot;...&quot;</span>
<span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">me</span> <span style="color: #ff0033; font-weight: bold;">to</span> notifyWithGrowl<span style="color: #000000;">&#40;</span>myScriptID, myNotification<span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #ff0033; font-weight: bold;">try</span>
	<span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;Finder&quot;</span> <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">delete</span> fullDir
<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">try</span>
&nbsp;
<span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;Finder&quot;</span> <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">make</span> <span style="color: #0066ff;">new</span> <span style="color: #0066ff;">folder</span> at <span style="color: #0066ff;">alias</span> rootDir <span style="color: #ff0033; font-weight: bold;">with</span> <span style="color: #0066ff;">properties</span> <span style="color: #000000;">&#123;</span><span style="color: #0066ff;">name</span>:tmpDir<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">-- download files:</span>
<span style="color: #808080; font-style: italic;">--tell application &quot;URL Access Scripting.app&quot;</span>
<span style="color: #ff0033; font-weight: bold;">set</span> i <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">1</span>
<span style="color: #ff0033; font-weight: bold;">repeat</span> <span style="color: #ff0033; font-weight: bold;">with</span> myURL <span style="color: #ff0033; font-weight: bold;">in</span> myURLs
	<span style="color: #ff0033; font-weight: bold;">set</span> thisURL <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#40;</span><span style="color: #0066ff;">text</span> <span style="color: #000000;">1</span> <span style="color: #ff0033;">thru</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #0066ff;">offset of</span> <span style="color: #009900;">&quot;|&quot;</span> <span style="color: #ff0033; font-weight: bold;">in</span> myURL<span style="color: #000000;">&#41;</span> <span style="color: #000000;">-</span> <span style="color: #000000;">1</span><span style="color: #000000;">&#41;</span> <span style="color: #ff0033; font-weight: bold;">of</span> myURL<span style="color: #000000;">&#41;</span>
	<span style="color: #ff0033; font-weight: bold;">set</span> thisExt <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#40;</span><span style="color: #0066ff;">text</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #0066ff;">offset of</span> <span style="color: #009900;">&quot;|&quot;</span> <span style="color: #ff0033; font-weight: bold;">in</span> myURL<span style="color: #000000;">&#41;</span> <span style="color: #000000;">+</span> <span style="color: #000000;">1</span><span style="color: #000000;">&#41;</span> <span style="color: #ff0033;">thru</span> <span style="color: #000000;">&#40;</span>length <span style="color: #ff0033; font-weight: bold;">of</span> myURL<span style="color: #000000;">&#41;</span> <span style="color: #ff0033; font-weight: bold;">of</span> myURL<span style="color: #000000;">&#41;</span>
	<span style="color: #ff0033; font-weight: bold;">set</span> <span style="color: #ff0033;">the</span> myFile <span style="color: #ff0033; font-weight: bold;">to</span> fullDir <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot;:&quot;</span> <span style="color: #000000;">&amp;</span> myFilePrefix <span style="color: #000000;">&amp;</span> i <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot;.&quot;</span> <span style="color: #000000;">&amp;</span> thisExt
	<span style="color: #808080; font-style: italic;">--set myFile to ((path to temporary items) as string) &amp; &quot;url_access_file.xml&quot;</span>
	<span style="color: #808080; font-style: italic;">--«event aevtdwnl» thisURL given «class fdst»:file myFile, «class rplc»:«constant erplyes »</span>
	<span style="color: #0066ff;">do shell script</span> <span style="color: #009900;">&quot;curl -L <span style="color: #000000; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #000000;">&amp;</span> thisURL <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot;<span style="color: #000000; font-weight: bold;">\&quot;</span> -o <span style="color: #000000; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #000000;">&amp;</span> <span style="color: #000000;">&#40;</span><span style="color: #0066ff;">POSIX path</span> <span style="color: #ff0033; font-weight: bold;">of</span> myFile<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot;<span style="color: #000000; font-weight: bold;">\&quot;</span>&quot;</span>
	<span style="color: #ff0033; font-weight: bold;">set</span> i <span style="color: #ff0033; font-weight: bold;">to</span> i <span style="color: #000000;">+</span> <span style="color: #000000;">1</span>
<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">repeat</span>
<span style="color: #808080; font-style: italic;">--end tell</span>
&nbsp;
<span style="color: #808080; font-style: italic;">-- display images using full-featured QuickLook window:</span>
<span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;Finder&quot;</span>
	<span style="color: #0066ff;">activate</span>
	<span style="color: #0066ff;">open</span> <span style="color: #0066ff;">folder</span> fullDir
	<span style="color: #ff0033; font-weight: bold;">set</span> current view <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #ff0033;">front</span> Finder <span style="color: #0066ff;">window</span> <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">list</span> view
<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span>
&nbsp;
<span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;System Events&quot;</span>
	key code <span style="color: #000000;">0</span> using <span style="color: #000000;">&#123;</span>command down<span style="color: #000000;">&#125;</span> <span style="color: #808080; font-style: italic;">-- cmd+a</span>
	key code <span style="color: #000000;">49</span> using <span style="color: #000000;">&#123;</span>option down<span style="color: #000000;">&#125;</span> <span style="color: #808080; font-style: italic;">-- cmd+opt+y; y is 16 for US, 6 for Hungarians :)</span>
<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span>
&nbsp;
<span style="color: #808080; font-style: italic;">-- that would be the callback after QuickLook:</span>
<span style="color: #808080; font-style: italic;">--tell application &quot;Finder&quot;</span>
<span style="color: #808080; font-style: italic;">--	activate</span>
<span style="color: #808080; font-style: italic;">--	set current view of front Finder window to v</span>
<span style="color: #808080; font-style: italic;">--	close front Finder window</span>
<span style="color: #808080; font-style: italic;">--end tell</span>
&nbsp;
<span style="color: #808080; font-style: italic;">-- display images using a very limited (dumb) QuickLook window:</span>
<span style="color: #808080; font-style: italic;">--do shell script &quot;qlmanage -p  &quot; &amp; (POSIX path of fullDir) &amp; &quot;/* &gt;&amp; /dev/null&quot;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">-- GrowlCheck:</span>
<span style="color: #ff0033; font-weight: bold;">on</span> growlInstalled<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
	<span style="color: #ff0033; font-weight: bold;">try</span>
		<span style="color: #0066ff;">do shell script</span> <span style="color: #009900;">&quot;ls /Library/PreferencePanes/Growl.prefPane/&quot;</span>
		<span style="color: #ff0033; font-weight: bold;">return</span> <span style="color: #0066ff;">true</span>
	<span style="color: #ff0033; font-weight: bold;">on</span> <span style="color: #ff0033; font-weight: bold;">error</span>
		<span style="color: #ff0033; font-weight: bold;">try</span>
			<span style="color: #0066ff;">do shell script</span> <span style="color: #009900;">&quot;ls -d /Applications/Growl.app&quot;</span>
			<span style="color: #ff0033; font-weight: bold;">return</span> <span style="color: #0066ff;">true</span>
		<span style="color: #ff0033; font-weight: bold;">on</span> <span style="color: #ff0033; font-weight: bold;">error</span>
			<span style="color: #ff0033; font-weight: bold;">return</span> <span style="color: #0066ff;">false</span>
		<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">try</span>
	<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">try</span>
<span style="color: #ff0033; font-weight: bold;">end</span> growlInstalled
&nbsp;
<span style="color: #808080; font-style: italic;">-- Growl notifier:</span>
<span style="color: #ff0033; font-weight: bold;">on</span> notifyWithGrowl<span style="color: #000000;">&#40;</span>myApp, myText<span style="color: #000000;">&#41;</span>
	<span style="color: #ff0033; font-weight: bold;">set</span> myIconApp <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;SYSTEM:Users:fns:Documents:Scripts:meteo&quot;</span>
	<span style="color: #ff0033; font-weight: bold;">set</span> notificationID <span style="color: #ff0033; font-weight: bold;">to</span> myApp <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot;.default&quot;</span>
&nbsp;
	<span style="color: #ff0033; font-weight: bold;">if</span> growlInstalled<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #ff0033; font-weight: bold;">then</span>
		<span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;Growl&quot;</span>
			<span style="color: #808080; font-style: italic;">-- list of notification types</span>
			<span style="color: #ff0033; font-weight: bold;">set</span> <span style="color: #ff0033;">the</span> ANL <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#123;</span>notificationID<span style="color: #000000;">&#125;</span>
			<span style="color: #808080; font-style: italic;">-- list of enabled notifications</span>
			<span style="color: #ff0033; font-weight: bold;">set</span> <span style="color: #ff0033;">the</span> DNL <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#123;</span>notificationID<span style="color: #000000;">&#125;</span>
&nbsp;
			<span style="color: #808080; font-style: italic;">-- register script</span>
			register <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">application</span> myApp all notifications ANL default notifications DNL icon <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">application</span> myIconApp
			<span style="color: #808080; font-style: italic;">-- send notification</span>
			notify <span style="color: #ff0033; font-weight: bold;">with</span> <span style="color: #0066ff;">name</span> notificationID title myApp description myText <span style="color: #0066ff;">application</span> <span style="color: #0066ff;">name</span> myApp
		<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span>
	<span style="color: #ff0033; font-weight: bold;">else</span>
		<span style="color: #808080; font-style: italic;">-- skip alert if no Growl installed</span>
		<span style="color: #808080; font-style: italic;">--display alert &quot;Growl is not installed&quot;</span>
	<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">if</span>
<span style="color: #ff0033; font-weight: bold;">end</span> notifyWithGrowl</pre></div></div>

<p>Lustáknak zip-be csomagolt, script app-ba fordított, szuperszexi <a href="http://trn.hu">trn</a> weather ikonos verzió leech <a href="http://fns.hu/freestuff/mac/meteo.zip">erre</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://fns.csokolade.hu/2011/12/15/yet-another-meteo-script-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mac workflow: fordító service</title>
		<link>http://fns.csokolade.hu/2011/02/08/mac-workflow-fordito-service/</link>
		<comments>http://fns.csokolade.hu/2011/02/08/mac-workflow-fordito-service/#comments</comments>
		<pubDate>Tue, 08 Feb 2011 14:27:30 +0000</pubDate>
		<dc:creator>eFi</dc:creator>
				<category><![CDATA[AppleScript]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[workflow]]></category>
		<category><![CDATA[service]]></category>

		<guid isPermaLink="false">http://fns.csokolade.hu/?p=1319</guid>
		<description><![CDATA[Preface: a workflow Google API-t használ, így feltételezem, hogy rendelkezel a használatához szükséges Google accounttal, továbbá Growl felhasználó vagy. Ha nincs Google accountod és nem is akarsz gyártani magadnak, illetve a Growl-tól is kiver a víz, akkor ez a leírás számodra nem nyújt explicit megoldást. Update: fds Mester hatására kigyomláltam a gusztustalan urlencode függvényt és [...]]]></description>
			<content:encoded><![CDATA[<p><em>Preface: a workflow Google API-t használ, így feltételezem, hogy rendelkezel a használatához szükséges Google accounttal, továbbá <a href="http://growl.info">Growl</a> felhasználó vagy. Ha nincs Google accountod és nem is akarsz gyártani magadnak, illetve a Growl-tól is kiver a víz, akkor ez a leírás számodra nem nyújt explicit megoldást.</em></p>
<p><em>Update: fds Mester hatására kigyomláltam a gusztustalan urlencode függvényt és az amúgyis nagyon okos curl binárisra róttam ezt a terhet.<br />
</em></p>
<h4>A probléma</h4>
<p>Idegen szóval / kifejezéssel találkozunk a computeren olvasás közben, amire a gyári <a href="http://plastik.hu/2009/09/02/spotlightolhato-en-hu-es-hu-en-szotar/">Dictionary.app-ba integrált szótárunk</a> nem ad fordítást.</p>
<h4>A megoldás</h4>
<p>Van a Google-nek jóféle online translation API-ja, amit megkérhetünk szépen, hogy fordítson nekünk. Az OS X nagy varázslata a rendszer szintű AppleScript támogatás és az Automator fedőnevű makrózó csoda - őket szólítjuk most csatába.</p>
<p>Első körben ellátogatunk a <a href="http://code.google.com/apis/language/translate/overview.html">Google Translate API</a> oldalára és végigolvassuk a doksit. A dokumentáció szépen elmagyarázza, hogy Google-ék egy ilyen GET requestre adnak értelmes választ:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">https://www.googleapis.com/language/translate/v2?parameters</pre></div></div>

<p>A HTTPS request felparaméterezve így néz ki:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">https://www.googleapis.com/language/translate/v2?key=INSERT-YOUR-KEY&amp;q=hello%20world&amp;source=en&amp;target=hu</pre></div></div>

<p>Miután ezt megtudtuk, a doksiban leírtak szerint látogassunk el a <a href="https://code.google.com/apis/console/?api=translate">Google APIs Console</a> oldalra, készítsünk egy új Translate projectet és már meg is szereztük a Translate API híváshoz szükséges kulcsot.</p>
<p>Megvan a kulcs, csinálhatunk jó kis Service-et!<br />
Elindítod az Automator alkalmazást, majd kiválasztod a Service típusú template-et:</p>
<p><a href="http://fns.csokolade.hu/files/2011/02/automator-new.jpg"><img src="http://fns.csokolade.hu/files/2011/02/automator-new.png" alt="" title="automator-new" class="aligncenter"/></a></p>
<p>A megjelenő editorban a Library/Utilities szekcióból kikeresed a Run AppleScript actiont és behúzod a munkaterületre:</p>
<p><a href="http://fns.csokolade.hu/files/2011/02/automator-new-service-run-applescript.jpg"><img src="http://fns.csokolade.hu/files/2011/02/automator-new-service-run-applescript.png" alt="" title="automator-new-service-run-applescript" class="aligncenter"/></a></p>
<p>Ezután már csak bepakolod a script helyére azt, amint én hajnalban már kiszenvedtem, beteszed a <code>	set myKey to "PUT_YOUR_GOOGLE_API_KEY_HERE"</code> sorba a te saját Google Translate API kulcsod és lemented a file-t Translate néven.</p>
<p>Ha mindent jól csináltál, akkor megjelent egy Translate nevű service a gépeden, ami úgy működik, hogy egy tetszőleges alkalmazásban kijelölt szövegen jobb clicket nyomva, majd a Services menü Translate opcióját kiválasztva a script megküldi a Google Translate APInak a kijelölt szöveget és a visszakapott fordítást megjeleníti neked egy Growl notification buborékban, valahogy így:</p>
<p><!-- degradable html5 audio and video plugin --><div class="video_wrap html5video"><object width="500" height="320" type="application/x-shockwave-flash" data="http://fns.csokolade.hu/wp-content/plugins/degradable-html5-audio-and-video/incl/videoplayer.swf?file=.m4v" id="f-html5video-0"><param name="movie" value="http://fns.csokolade.hu/wp-content/plugins/degradable-html5-audio-and-video/incl/videoplayer.swf?file=.m4v" /></div></p>
<p>Végül nézzük meg a scriptet egyben, úgy, ahogy magamnak implementáltam:</p>

<div class="wp_syntax"><div class="code"><pre class="applescript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">(*
	Translate
	by Gabor PENOFF (http://fns.csokolade.hu)
&nbsp;
	release 20110208_092849
&nbsp;
	About:
&nbsp;
&nbsp;
	Requirements:
	- insert your own Google API key
	- install Growl from http://growl.info to get non-modal notification dialogs
&nbsp;
	Usage:
	- select some text and run the service
&nbsp;
	That's all.
*)</span>
&nbsp;
<span style="color: #ff0033; font-weight: bold;">on</span> <span style="color: #0066ff;">run</span> <span style="color: #000000;">&#123;</span>input, parameters<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #ff0033; font-weight: bold;">set</span> srcText <span style="color: #ff0033; font-weight: bold;">to</span> input <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">text</span>
&nbsp;
	<span style="color: #ff0033; font-weight: bold;">set</span> srcLang <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;en&quot;</span> <span style="color: #808080; font-style: italic;">-- source language</span>
	<span style="color: #ff0033; font-weight: bold;">set</span> tgtLang <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;hu&quot;</span> <span style="color: #808080; font-style: italic;">-- target language</span>
	<span style="color: #ff0033; font-weight: bold;">set</span> myKey <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;AIzaSyCI-2oapEkMpRFfd6Ltv4HkZhf1Zq-VU9o&quot;</span>
	<span style="color: #ff0033; font-weight: bold;">set</span> myScriptID <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;Translate&quot;</span> <span style="color: #808080; font-style: italic;">-- ID for Growl display</span>
&nbsp;
	<span style="color: #ff0033; font-weight: bold;">set</span> myTranslation <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">do shell script</span> <span style="color: #009900;">&quot;/usr/bin/curl -G --data-urlencode q=&quot;</span> <span style="color: #000000;">&amp;</span> <span style="color: #0066ff;">quoted form</span> <span style="color: #ff0033; font-weight: bold;">of</span> srcText <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot; --data-urlencode key=&quot;</span> <span style="color: #000000;">&amp;</span> <span style="color: #0066ff;">quoted form</span> <span style="color: #ff0033; font-weight: bold;">of</span> myKey <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot; --data-urlencode source=&quot;</span> <span style="color: #000000;">&amp;</span> <span style="color: #0066ff;">quoted form</span> <span style="color: #ff0033; font-weight: bold;">of</span> srcLang <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot; --data-urlencode target=&quot;</span> <span style="color: #000000;">&amp;</span> <span style="color: #0066ff;">quoted form</span> <span style="color: #ff0033; font-weight: bold;">of</span> tgtLang <span style="color: #000000;">&amp;</span> <span style="color: #0066ff;">space</span> <span style="color: #000000;">&amp;</span> <span style="color: #0066ff;">quoted form</span> <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #009900;">&quot;https://www.googleapis.com/language/translate/v2&quot;</span>
&nbsp;
	<span style="color: #ff0033; font-weight: bold;">if</span> myTranslation <span style="color: #000000;">=</span> <span style="color: #009900;">&quot;&quot;</span> <span style="color: #ff0033; font-weight: bold;">then</span>
		<span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">me</span> <span style="color: #ff0033; font-weight: bold;">to</span> notifyWithGrowl<span style="color: #000000;">&#40;</span>myScriptID, <span style="color: #009900;">&quot;ERROR&quot;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #ff0033; font-weight: bold;">return</span>
	<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">if</span>
&nbsp;
	<span style="color: #808080; font-style: italic;">-- get rid of JSON (ugly but works)</span>
	<span style="color: #ff0033; font-weight: bold;">set</span> myPrefix <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;translatedText<span style="color: #000000; font-weight: bold;">\&quot;</span>: <span style="color: #000000; font-weight: bold;">\&quot;</span>&quot;</span>
	<span style="color: #ff0033; font-weight: bold;">set</span> myPostfix <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;<span style="color: #000000; font-weight: bold;">\&quot;</span>&quot;</span>
	<span style="color: #ff0033; font-weight: bold;">set</span> myStartPos <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#40;</span><span style="color: #0066ff;">offset of</span> myPrefix <span style="color: #ff0033; font-weight: bold;">in</span> myTranslation<span style="color: #000000;">&#41;</span> <span style="color: #000000;">+</span> <span style="color: #000000;">&#40;</span>length <span style="color: #ff0033; font-weight: bold;">of</span> myPrefix<span style="color: #000000;">&#41;</span>
	<span style="color: #ff0033; font-weight: bold;">set</span> myText <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">text</span> myStartPos <span style="color: #ff0033;">thru</span> <span style="color: #000000;">-</span><span style="color: #000000;">1</span> <span style="color: #ff0033; font-weight: bold;">of</span> myTranslation
	<span style="color: #ff0033; font-weight: bold;">set</span> myEndPos <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#40;</span><span style="color: #0066ff;">offset of</span> myPostfix <span style="color: #ff0033; font-weight: bold;">in</span> myText<span style="color: #000000;">&#41;</span>
	<span style="color: #ff0033; font-weight: bold;">set</span> myText <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">text</span> <span style="color: #000000;">1</span> <span style="color: #ff0033;">thru</span> <span style="color: #000000;">&#40;</span>myEndPos <span style="color: #000000;">-</span> <span style="color: #000000;">1</span><span style="color: #000000;">&#41;</span> <span style="color: #ff0033; font-weight: bold;">of</span> myText
&nbsp;
	<span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">me</span> <span style="color: #ff0033; font-weight: bold;">to</span> notifyWithGrowl<span style="color: #000000;">&#40;</span>myScriptID, myText<span style="color: #000000;">&#41;</span>
&nbsp;
	<span style="color: #ff0033; font-weight: bold;">return</span> <span style="color: #009900;">&quot;&quot;</span> <span style="color: #808080; font-style: italic;">-- myText</span>
<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #0066ff;">run</span>
&nbsp;
<span style="color: #808080; font-style: italic;">-- GrowlCheck:</span>
<span style="color: #ff0033; font-weight: bold;">on</span> growlInstalled<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
	<span style="color: #ff0033; font-weight: bold;">try</span>
		<span style="color: #0066ff;">do shell script</span> <span style="color: #009900;">&quot;ls /Library/PreferencePanes/Growl.prefPane/&quot;</span>
		<span style="color: #ff0033; font-weight: bold;">return</span> <span style="color: #0066ff;">true</span>
	<span style="color: #ff0033; font-weight: bold;">on</span> <span style="color: #ff0033; font-weight: bold;">error</span>
		<span style="color: #ff0033; font-weight: bold;">return</span> <span style="color: #0066ff;">false</span>
	<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">try</span>
<span style="color: #ff0033; font-weight: bold;">end</span> growlInstalled
&nbsp;
<span style="color: #808080; font-style: italic;">-- Growl notifier:</span>
<span style="color: #ff0033; font-weight: bold;">on</span> notifyWithGrowl<span style="color: #000000;">&#40;</span>myApp, myText<span style="color: #000000;">&#41;</span>
	<span style="color: #ff0033; font-weight: bold;">set</span> myIconApp <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;Safari&quot;</span>
	<span style="color: #ff0033; font-weight: bold;">set</span> notificationID <span style="color: #ff0033; font-weight: bold;">to</span> myApp <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot;.default&quot;</span>
&nbsp;
	<span style="color: #ff0033; font-weight: bold;">if</span> growlInstalled<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #ff0033; font-weight: bold;">then</span>
		<span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;GrowlHelperApp&quot;</span>
			<span style="color: #808080; font-style: italic;">-- list of notification types</span>
			<span style="color: #ff0033; font-weight: bold;">set</span> <span style="color: #ff0033;">the</span> ANL <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#123;</span>notificationID<span style="color: #000000;">&#125;</span>
			<span style="color: #808080; font-style: italic;">-- list of enabled notifications</span>
			<span style="color: #ff0033; font-weight: bold;">set</span> <span style="color: #ff0033;">the</span> DNL <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#123;</span>notificationID<span style="color: #000000;">&#125;</span>
&nbsp;
			<span style="color: #808080; font-style: italic;">-- register script</span>
			register <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">application</span> myApp all notifications ANL default notifications DNL icon <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">application</span> myIconApp
			<span style="color: #808080; font-style: italic;">-- send notification</span>
			notify <span style="color: #ff0033; font-weight: bold;">with</span> <span style="color: #0066ff;">name</span> notificationID title myApp description myText <span style="color: #0066ff;">application</span> <span style="color: #0066ff;">name</span> myApp
		<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span>
	<span style="color: #ff0033; font-weight: bold;">else</span>
		<span style="color: #808080; font-style: italic;">-- skip alert if no Growl installed</span>
		<span style="color: #808080; font-style: italic;">--display alert &quot;Growl is not installed&quot;</span>
	<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">if</span>
<span style="color: #ff0033; font-weight: bold;">end</span> notifyWithGrowl</pre></div></div>

<p>Türelmetleneknek / elfoglaltaknak / lustáknak az egész service szedhető <a href="http://fns.hu/freestuff/mac/Translate.zip">innen</a> - persze még ebben is be kell pakolnod a saját magad Google API kulcsát, hogy működjön.</p>
]]></content:encoded>
			<wfw:commentRss>http://fns.csokolade.hu/2011/02/08/mac-workflow-fordito-service/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
<enclosure url="http://fns.hu/video/mac-workflow-translate-service.mov" length="726395" type="video/quicktime" />
		</item>
		<item>
		<title>Mac workflow: blogpic HOWTO</title>
		<link>http://fns.csokolade.hu/2010/06/23/mac-workflow-blogpic-howt/</link>
		<comments>http://fns.csokolade.hu/2010/06/23/mac-workflow-blogpic-howt/#comments</comments>
		<pubDate>Wed, 23 Jun 2010 15:33:58 +0000</pubDate>
		<dc:creator>eFi</dc:creator>
				<category><![CDATA[AppleScript]]></category>
		<category><![CDATA[Gastro]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[workflow]]></category>

		<guid isPermaLink="false">http://fns.csokolade.hu/?p=604</guid>
		<description><![CDATA[A mai mese arról fog szólni, hogy hogyan készítem el egy-egy postba a szép felgörbült szélű thumbnailes képeket, mint amilyen ez a kovászos uborka itt alant: A Mac recept Hozzávalók: Acorn - image editor Gus Mueller billentyűzetéből. Puritán, letisztult, szeretem. JSTalk - script bridge, szintén Gustól. Segítségével a scriptelhető OS X alkalmazásokhoz JavaScriptes vagy Objective [...]]]></description>
			<content:encoded><![CDATA[<p>A mai mese arról fog szólni, hogy hogyan készítem el egy-egy postba a szép felgörbült szélű thumbnailes képeket, mint amilyen ez a kovászos uborka itt alant:</p>
<p><a href="http://fns.csokolade.hu/files/2010/06/koviubi.jpg"><img src="http://fns.csokolade.hu/files/2010/06/koviubi.png" alt="" title="koviubi" align="center"/></a></p>
<p><strong>A Mac recept</strong></p>
<p>Hozzávalók:</p>
<ul>
<li><a href="http://flyingmeat.com/acorn/">Acorn</a> - image editor <a href="http://gusmueller.com/blog/">Gus Mueller </a>billentyűzetéből. Puritán, letisztult, szeretem.</li>
<li><a href="http://jstalk.org/">JSTalk</a> - script bridge, szintén Gustól. Segítségével a scriptelhető OS X alkalmazásokhoz JavaScriptes vagy Objective C-s stílusban írhatsz scripteket.</li>
<li><a href="http://www.smileonmymac.com/TextExpander/">TextExpander</a> - (akár) scriptelhető text makrózó tool, mely számos változó használatát (dátum és idő, clipboard tartalom, kép, kurzorműveletek) engedi meg.</li>
<li>WordPress <a href="http://granades.com/wp-fancyzoom-wordpress-plugin/">FancyZoom</a> plugin - <a href="http://www.cabel.name/">Cabel Sasser</a> JavaScriptben írt remeke. Ő állítja elő az oldalba pakolt img HTML tag-ekhez a zoom effektet, amikor a thumbnailre klattyolsz.</li>
</ul>
<p>A workflow</p>
<p>A dolog onnan indul, hogy a kívánt képet 1280x1280 max méretre cropolom, majd lementem jpg formátumban. Az így előkészített képet bedobom az Acorn-ba, majd lefuttatom a Framer fedőnevű JSTalk scriptet, aki előállít egy 500 pixel széles smallDoc.png thumbnail image-et a beledobott képből.<br />
A két képet feltöltöm a WordPressbe, majd egy TextExpander makró segítségével berámolom a postba a thumbnailhez és az alatta levő image-hez szükséges HTML kódot.</p>
<p>Nézzük meg a JSTalk scriptet és a TextExpander snippetet, aztán jöhet a kovászos ubi receptje. Elsőként itt a script - ehhez túl sok közöm nincs, Gus csomagolta a JSTalk példák közé, nekem meg nagyon megtetszett az eredménye. Persze lehetne ez egyszer CSS3, de amíg nem, addig jó ez így is, hardcoded módon:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;">&nbsp;
&nbsp;
var acorn <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>JSTalk application<span style="color: #002200;">:</span><span style="color: #bf1d1a;">&quot;Acorn&quot;</span><span style="color: #002200;">&#93;</span>;
<span style="color: #11740a; font-style: italic;">// var doc = acorn.open_(&quot;/path/to/SomeImage.jpg&quot;);</span>
var doc <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>acorn orderedDocuments<span style="color: #002200;">&#93;</span> objectAtIndex<span style="color: #002200;">:</span><span style="color: #2400d9;">0</span><span style="color: #002200;">&#93;</span>;
&nbsp;
<span style="color: #11740a; font-style: italic;">// scale our image down</span>
<span style="color: #002200;">&#91;</span>doc scaleImageToWidth<span style="color: #002200;">:</span><span style="color: #2400d9;">492</span><span style="color: #002200;">&#93;</span>;
&nbsp;
var image <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSImage</span> alloc<span style="color: #002200;">&#93;</span> initWithData<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>doc dataRepresentationOfType<span style="color: #002200;">:</span><span style="color: #bf1d1a;">&quot;public.png&quot;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span> autorelease<span style="color: #002200;">&#93;</span>;
&nbsp;
<span style="color: #11740a; font-style: italic;">// close the doc, since we've already got the data we need.</span>
<span style="color: #002200;">&#91;</span>doc close<span style="color: #002200;">&#93;</span>;
&nbsp;
var bitmap <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>image bestRepresentationForDevice<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;
&nbsp;
var extent <span style="color: #002200;">=</span> NSMakeRect<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">0</span>, <span style="color: #2400d9;">0</span>, <span style="color: #002200;">&#91;</span>bitmap pixelsWide<span style="color: #002200;">&#93;</span>, <span style="color: #002200;">&#91;</span>bitmap pixelsHigh<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>;
var xOffset <span style="color: #002200;">=</span> <span style="color: #2400d9;">5</span>;
var yOffset <span style="color: #002200;">=</span> <span style="color: #2400d9;">35</span>;
var curveHeight <span style="color: #002200;">=</span> <span style="color: #2400d9;">15</span>;
var imageYOffset <span style="color: #002200;">=</span> <span style="color: #2400d9;">10</span>;
var whiteBorderWidth <span style="color: #002200;">=</span> <span style="color: #2400d9;">4</span>;
var doubleBorderWidth <span style="color: #002200;">=</span> whiteBorderWidth <span style="color: #002200;">*</span> <span style="color: #2400d9;">2</span>;
&nbsp;
var newSize <span style="color: #002200;">=</span> NSMakeSize<span style="color: #002200;">&#40;</span>extent.size.width <span style="color: #002200;">+</span> <span style="color: #002200;">&#40;</span>whiteBorderWidth <span style="color: #002200;">*</span> <span style="color: #2400d9;">2</span><span style="color: #002200;">&#41;</span>,
                         extent.size.height <span style="color: #002200;">+</span> imageYOffset <span style="color: #002200;">+</span> <span style="color: #002200;">&#40;</span>whiteBorderWidth <span style="color: #002200;">*</span> <span style="color: #2400d9;">2</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span>;
&nbsp;
var newImage <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSImage</span> alloc<span style="color: #002200;">&#93;</span> initWithSize<span style="color: #002200;">:</span>newSize<span style="color: #002200;">&#93;</span> autorelease<span style="color: #002200;">&#93;</span>;
&nbsp;
<span style="color: #002200;">&#91;</span>newImage lockFocus<span style="color: #002200;">&#93;</span>;
&nbsp;
<span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSGraphicsContext</span> currentContext<span style="color: #002200;">&#93;</span> saveGraphicsState<span style="color: #002200;">&#93;</span>;
&nbsp;
var shadow <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSShadow</span> alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>shadow setShadowColor<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSColor</span> blackColor<span style="color: #002200;">&#93;</span> colorWithAlphaComponent<span style="color: #002200;">:</span>.6<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
&nbsp;
var shadowOffset <span style="color: #002200;">=</span> NSMakeSize<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">0</span>, <span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span>yOffset <span style="color: #002200;">+</span> <span style="color: #2400d9;">5</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span>;
<span style="color: #002200;">&#91;</span>shadow setShadowOffset<span style="color: #002200;">:</span>shadowOffset<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>shadow setShadowBlurRadius<span style="color: #002200;">:</span><span style="color: #2400d9;">5</span><span style="color: #002200;">&#93;</span>;
shadow.set<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span>
&nbsp;
<span style="color: #11740a; font-style: italic;">// make a curved path, at the bottom of our image.</span>
bezierPath <span style="color: #002200;">=</span> <span style="color: #400080;">NSBezierPath</span>.bezierPath<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span>;
&nbsp;
<span style="color: #002200;">&#91;</span>bezierPath moveToPoint<span style="color: #002200;">:</span>NSMakePoint<span style="color: #002200;">&#40;</span>xOffset, <span style="color: #2400d9;">40</span> <span style="color: #002200;">+</span> yOffset<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>bezierPath lineToPoint<span style="color: #002200;">:</span>NSMakePoint<span style="color: #002200;">&#40;</span>extent.size.width <span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>xOffset<span style="color: #002200;">&#41;</span> <span style="color: #002200;">+</span> doubleBorderWidth, <span style="color: #2400d9;">40</span> <span style="color: #002200;">+</span> yOffset<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>bezierPath lineToPoint<span style="color: #002200;">:</span>NSMakePoint<span style="color: #002200;">&#40;</span>extent.size.width <span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>xOffset<span style="color: #002200;">&#41;</span> <span style="color: #002200;">+</span> doubleBorderWidth, <span style="color: #2400d9;">10</span> <span style="color: #002200;">+</span> yOffset<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;
&nbsp;
<span style="color: #002200;">&#91;</span>bezierPath curveToPoint<span style="color: #002200;">:</span>NSMakePoint<span style="color: #002200;">&#40;</span>newSize.width <span style="color: #002200;">/</span> <span style="color: #2400d9;">2</span>, curveHeight <span style="color: #002200;">+</span> yOffset<span style="color: #002200;">&#41;</span>
           controlPoint1<span style="color: #002200;">:</span>NSMakePoint<span style="color: #002200;">&#40;</span>extent.size.width <span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>xOffset<span style="color: #002200;">&#41;</span>, <span style="color: #2400d9;">10</span> <span style="color: #002200;">+</span> yOffset<span style="color: #002200;">&#41;</span>
           controlPoint2<span style="color: #002200;">:</span>NSMakePoint<span style="color: #002200;">&#40;</span>newSize.width <span style="color: #002200;">*</span>.75, curveHeight <span style="color: #002200;">+</span> yOffset<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;
&nbsp;
<span style="color: #002200;">&#91;</span>bezierPath curveToPoint<span style="color: #002200;">:</span>NSMakePoint<span style="color: #002200;">&#40;</span>xOffset, <span style="color: #2400d9;">10</span> <span style="color: #002200;">+</span> yOffset<span style="color: #002200;">&#41;</span>
           controlPoint1<span style="color: #002200;">:</span>NSMakePoint<span style="color: #002200;">&#40;</span>newSize.width <span style="color: #002200;">*</span>.25, curveHeight <span style="color: #002200;">+</span> yOffset<span style="color: #002200;">&#41;</span>
           controlPoint2<span style="color: #002200;">:</span>NSMakePoint<span style="color: #002200;">&#40;</span>xOffset, <span style="color: #2400d9;">10</span> <span style="color: #002200;">+</span> yOffset<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;
&nbsp;
<span style="color: #002200;">&#91;</span>bezierPath fill<span style="color: #002200;">&#93;</span>;
&nbsp;
<span style="color: #11740a; font-style: italic;">// get rid of our shadow</span>
<span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSGraphicsContext</span> currentContext<span style="color: #002200;">&#93;</span> restoreGraphicsState<span style="color: #002200;">&#93;</span>;
&nbsp;
<span style="color: #11740a; font-style: italic;">// draw a white border</span>
<span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSColor</span> whiteColor<span style="color: #002200;">&#93;</span> set<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSBezierPath</span> bezierPathWithRect<span style="color: #002200;">:</span>NSMakeRect<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">0</span>, imageYOffset, newSize.width, extent.size.height <span style="color: #002200;">+</span> whiteBorderWidth <span style="color: #002200;">*</span> <span style="color: #2400d9;">2</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span> fill<span style="color: #002200;">&#93;</span>;
&nbsp;
<span style="color: #11740a; font-style: italic;">// draw our gray border around the white border</span>
<span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSColor</span> lightGrayColor<span style="color: #002200;">&#93;</span> set<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSBezierPath</span> bezierPathWithRect<span style="color: #002200;">:</span>NSMakeRect<span style="color: #002200;">&#40;</span>.5, imageYOffset <span style="color: #002200;">+</span> .5 , newSize.width <span style="color: #002200;">-</span> <span style="color: #2400d9;">1</span>, <span style="color: #002200;">&#40;</span>extent.size.height <span style="color: #002200;">-</span> <span style="color: #2400d9;">1</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">+</span> <span style="color: #002200;">&#40;</span>whiteBorderWidth <span style="color: #002200;">*</span> <span style="color: #2400d9;">2</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span> stroke<span style="color: #002200;">&#93;</span>;
&nbsp;
<span style="color: #11740a; font-style: italic;">// NSImage takes into account dpi of the image.  So we force it's size, to avoid small images.</span>
<span style="color: #002200;">&#91;</span>image setSize<span style="color: #002200;">:</span> extent.size<span style="color: #002200;">&#93;</span>;
&nbsp;
<span style="color: #11740a; font-style: italic;">// draw our image</span>
<span style="color: #002200;">&#91;</span>image drawAtPoint<span style="color: #002200;">:</span>NSMakePoint<span style="color: #002200;">&#40;</span>whiteBorderWidth, imageYOffset <span style="color: #002200;">+</span> whiteBorderWidth<span style="color: #002200;">&#41;</span>
          fromRect<span style="color: #002200;">:</span>NSMakeRect<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">0</span>, <span style="color: #2400d9;">0</span>, extent.size.width, extent.size.height<span style="color: #002200;">&#41;</span>
         operation<span style="color: #002200;">:</span>NSCompositeCopy
          fraction<span style="color: #002200;">:</span><span style="color: #2400d9;">1</span><span style="color: #002200;">&#93;</span>;
&nbsp;
<span style="color: #002200;">&#91;</span>newImage unlockFocus<span style="color: #002200;">&#93;</span>;
&nbsp;
&nbsp;
var smallDoc <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>acorn sharedDocumentController<span style="color: #002200;">&#93;</span> newDocumentWithImageData<span style="color: #002200;">:</span> <span style="color: #002200;">&#91;</span>newImage TIFFRepresentation<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
&nbsp;
<span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>smallDoc dataRepresentationOfType<span style="color: #002200;">:</span><span style="color: #bf1d1a;">&quot;public.png&quot;</span><span style="color: #002200;">&#93;</span> writeToFile<span style="color: #002200;">:</span><span style="color: #bf1d1a;">&quot;/Users/fns/Desktop/smallDoc.png&quot;</span><span style="color: #002200;">&#93;</span>;
&nbsp;
<span style="color: #002200;">&#91;</span>smallDoc close<span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>Ez pedig a TextExpander snippet:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;a href=&quot;http://fns.csokolade.hu/files/%Y/%m/%clipboard.jpg&quot;&gt;&lt;img src=&quot;http://fns.csokolade.hu/files/%Y/%m/%clipboard.png&quot; alt=&quot;&quot; title=&quot;%clipboard&quot;/&gt;&lt;/a&gt;</pre></div></div>

<p>A TextExpander snippetnél mindössze annyi dolgom van pluszban, hogy a kép nevét a clipboardba másoljam. Ez meg OS X alatt egy Enter a filenéven, majd ⌘C és Sanyi.</p>
<p><strong>A kovászos ubi recept</strong></p>
<p>Egy 5 literes befőttes üvegbe kb. 3 kiló uborka fér. Az üveget forró vízzel kimosom, majd elfektetem, hogy könnyebb legyen bele pakolni.<br />
Az uborkák két végét levágom, hosszában 4-5-6 vágást ejtek rajtuk. Nekiállok úgy bepakolni az uborkákat, hogy függőlegesen álljanak majd az üvegben, mikor érleli őket a Nap.<br />
Egy réteg uborka után egy nagy adag kaprot teszek be az üvegbe (persze csak akkor, ha épp nem <a href="http://www.pappito.com/2010/02/01/kert-repakrol-es-uborkakrol/#comment-5346">Pappitonak</a> készül a cucc :)), majd megint ubi és ez így megy addig, amíg meg nem telik a bödön.<br />
Óvatosan felállítom az üveget, majd 2 púpos evőkanál sót teszek a tetejére. Felforralok 3-4 liter vizet és egy merőkanállal rákanalazom az uborkákra, amíg tele nem lesz az üveg.<br />
A végén egy szelet kenyeret nyomok a tetejébe, letakarom az egészet egy tányérral és megy ki a Napra, 3-4 napig. Mikor a lé már zavaros, leszedem a kenyeret, de 1-2 napot adok még neki a melegen, hadd érjen össze.</p>
]]></content:encoded>
			<wfw:commentRss>http://fns.csokolade.hu/2010/06/23/mac-workflow-blogpic-howt/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Meteo script update</title>
		<link>http://fns.csokolade.hu/2010/05/16/meteo-script-update/</link>
		<comments>http://fns.csokolade.hu/2010/05/16/meteo-script-update/#comments</comments>
		<pubDate>Sun, 16 May 2010 08:12:06 +0000</pubDate>
		<dc:creator>eFi</dc:creator>
				<category><![CDATA[AppleScript]]></category>
		<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://fns.csokolade.hu/?p=505</guid>
		<description><![CDATA[Tavaly írtam még ezt a pici AppleScriptet, ami leszedi a koponyeg.hu és az idokep.hu site-ok időjárás-vizualizációs képeit és feldobja a monitorodra full screenben az OS X Quick Look-ja segítségével (slight keyboard hack, de megy). A site-ok frissültek, eljött az update ideje is: mostantól nem nyakló nélkül jpg-nek ment a script mindent, hanem amire utasítod. Ennek [...]]]></description>
			<content:encoded><![CDATA[<p>Tavaly írtam még ezt a pici AppleScriptet, ami leszedi a koponyeg.hu és az idokep.hu site-ok időjárás-vizualizációs képeit és feldobja a monitorodra full screenben az OS X Quick Look-ja segítségével (slight keyboard hack, de megy). A site-ok frissültek, eljött az update ideje is: mostantól nem nyakló nélkül jpg-nek ment a script mindent, hanem amire utasítod. Ennek köszönhetően pl. az idokep.hu széltérkép animgif-je animgif marad és teljesen jól mutatja a felhőtérkép után pakolva, hogy merre visszi a szél az előző képen látható felhőket (ma pont jól is jön).</p>
<p>Lustáknak a script app-ba fordítva, zip-be csomagolva <a href="http://fns.hu/freestuff/mac/meteo.zip">itt</a>, magyar billentyűzethez <a href="http://fns.hu/freestuff/mac/meteo-hu.zip">itt</a>, a forrás meg alant <em>(a script a ~/Pictures könyváradban létre fog hozni egy <strong>delme-meteo</strong> nevű foldert, amibe a leszippantott képeket menti. Ezt a foldert törli és létrehozza minden alkalommal újra és újra.)</em>:</p>

<div class="wp_syntax"><div class="code"><pre class="applescript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">(*
	Meteo
	by Gabor PENOFF (http://fns.csokolade.hu)
&nbsp;
	release 20100516-1002
&nbsp;
	Requirements:
	- before run you need to Enable Access for Assistive Devices in SysPrefs/Universal Access
	- install Growl from http://growl.info to get non-modal notification dialogs
&nbsp;
	Usage:
	- just run the script
&nbsp;
	That's all.
*)</span>
&nbsp;
<span style="color: #ff0033; font-weight: bold;">set</span> myScriptID <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;Meteo&quot;</span> <span style="color: #808080; font-style: italic;">-- ID for Growl display</span>
&nbsp;
<span style="color: #808080; font-style: italic;">-- set date variables:</span>
<span style="color: #ff0033; font-weight: bold;">set</span> myYear <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #ff0033; font-weight: bold;">get</span> <span style="color: #0066ff;">text</span> <span style="color: #000000;">1</span> <span style="color: #ff0033;">thru</span> <span style="color: #000000;">4</span> <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #000000;">&#40;</span>year <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #000000;">&#40;</span>current date<span style="color: #000000;">&#41;</span> <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">string</span><span style="color: #000000;">&#41;</span>
<span style="color: #ff0033; font-weight: bold;">set</span> myMonth <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">month</span> <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #000000;">&#40;</span>current date<span style="color: #000000;">&#41;</span> <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">number</span>
<span style="color: #ff0033; font-weight: bold;">if</span> myMonth <span style="color: #000000;">&lt;</span> <span style="color: #000000;">10</span> <span style="color: #ff0033; font-weight: bold;">then</span> <span style="color: #ff0033; font-weight: bold;">set</span> myMonth <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;0&quot;</span> <span style="color: #000000;">&amp;</span> myMonth <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">string</span>
<span style="color: #ff0033; font-weight: bold;">set</span> myDay <span style="color: #ff0033; font-weight: bold;">to</span> day <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #000000;">&#40;</span>current date<span style="color: #000000;">&#41;</span>
<span style="color: #ff0033; font-weight: bold;">if</span> myDay <span style="color: #000000;">&lt;</span> <span style="color: #000000;">10</span> <span style="color: #ff0033; font-weight: bold;">then</span> <span style="color: #ff0033; font-weight: bold;">set</span> myDay <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;0&quot;</span> <span style="color: #000000;">&amp;</span> myDay <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">string</span>
<span style="color: #ff0033; font-weight: bold;">set</span> myHour <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">hours</span> <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #000000;">&#40;</span>current date<span style="color: #000000;">&#41;</span>
<span style="color: #ff0033; font-weight: bold;">if</span> myHour <span style="color: #000000;">&lt;</span> <span style="color: #000000;">10</span> <span style="color: #ff0033; font-weight: bold;">then</span> <span style="color: #ff0033; font-weight: bold;">set</span> myHour <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;0&quot;</span> <span style="color: #000000;">&amp;</span> myHour <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">string</span>
<span style="color: #ff0033; font-weight: bold;">set</span> myMinute <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;00&quot;</span>
&nbsp;
<span style="color: #ff0033; font-weight: bold;">set</span> tmpDir <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;delme-meteo&quot;</span>
<span style="color: #ff0033; font-weight: bold;">set</span> myFilePrefix <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;delme-met-&quot;</span>
<span style="color: #ff0033; font-weight: bold;">set</span> tIdokepStart <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;http://www.idokep.hu/arch_kep.php?kep=&quot;</span>
&nbsp;
<span style="color: #ff0033; font-weight: bold;">set</span> myURLs <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#123;</span>¬
	<span style="color: #009900;">&quot;http://img.koponyeg.hu/img/15napos/&quot;</span> <span style="color: #000000;">&amp;</span> myYear <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot;/&quot;</span> <span style="color: #000000;">&amp;</span> myMonth <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot;/1_&quot;</span> <span style="color: #000000;">&amp;</span> myYear <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot;-&quot;</span> <span style="color: #000000;">&amp;</span> myMonth <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot;-&quot;</span> <span style="color: #000000;">&amp;</span> myDay <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot;grafikon.png|png&quot;</span>, ¬
	<span style="color: #009900;">&quot;http://terkep.idokep.hu/kep.php?kep=mix|jpg&quot;</span>, ¬
	<span style="color: #009900;">&quot;http://terkep.idokep.hu/kep.php?kep=hoterkep2&amp;regio=hu1680|jpg&quot;</span>, ¬
	<span style="color: #009900;">&quot;http://terkep.idokep.hu/kep.php?kep=felhokep2&amp;regio=hu1680|jpg&quot;</span>, ¬
	<span style="color: #009900;">&quot;http://terkep.idokep.hu/kep.php?kep=szelterkep2_anim|gif&quot;</span>, ¬
	<span style="color: #009900;">&quot;http://terkep.idokep.hu/kep.php?kep=szelterkep2&amp;regio=hu1680|jpg&quot;</span>, ¬
	<span style="color: #009900;">&quot;http://terkep.idokep.hu/kep.php?kep=legnyomasterkep|jpg&quot;</span>, ¬
	<span style="color: #009900;">&quot;http://feny.idokep.hu/kep.php?kep=csap24|jpg&quot;</span>, ¬
	<span style="color: #009900;">&quot;http://feny.idokep.hu/kep.php?kep=csap1|jpg&quot;</span>, ¬
	<span style="color: #009900;">&quot;http://feny.idokep.hu/kep.php?kep=aqua|jpg&quot;</span>, ¬
	<span style="color: #009900;">&quot;http://terkep.idokep.hu/kep.php?kep=rh|jpg&quot;</span>, ¬
	<span style="color: #009900;">&quot;http://terkep.idokep.hu/kep.php?kep=uv|jpg&quot;</span>, ¬
	<span style="color: #009900;">&quot;http://terkep.idokep.hu/kep.php?kep=pollen0|jpg&quot;</span><span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #ff0033; font-weight: bold;">set</span> rootDir <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#40;</span><span style="color: #0066ff;">path to</span> home <span style="color: #0066ff;">folder</span> <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">string</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot;Pictures&quot;</span>
<span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;Finder&quot;</span> <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #ff0033; font-weight: bold;">set</span> fullDir <span style="color: #ff0033; font-weight: bold;">to</span> rootDir <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot;:&quot;</span> <span style="color: #000000;">&amp;</span> tmpDir <span style="color: #808080; font-style: italic;">-- save fullDir</span>
&nbsp;
<span style="color: #ff0033; font-weight: bold;">set</span> myNotification <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;Downloading METEO images to &quot;</span> <span style="color: #000000;">&amp;</span> fullDir <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot;...&quot;</span>
<span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">me</span> <span style="color: #ff0033; font-weight: bold;">to</span> notifyWithGrowl<span style="color: #000000;">&#40;</span>myScriptID, myNotification<span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #ff0033; font-weight: bold;">try</span>
	<span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;Finder&quot;</span> <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">delete</span> fullDir
<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">try</span>
&nbsp;
<span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;Finder&quot;</span> <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">make</span> <span style="color: #0066ff;">new</span> <span style="color: #0066ff;">folder</span> at <span style="color: #0066ff;">alias</span> rootDir <span style="color: #ff0033; font-weight: bold;">with</span> <span style="color: #0066ff;">properties</span> <span style="color: #000000;">&#123;</span><span style="color: #0066ff;">name</span>:tmpDir<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">-- download files:</span>
<span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;URL Access Scripting&quot;</span>
	<span style="color: #ff0033; font-weight: bold;">set</span> i <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">1</span>
	<span style="color: #ff0033; font-weight: bold;">repeat</span> <span style="color: #ff0033; font-weight: bold;">with</span> myURL <span style="color: #ff0033; font-weight: bold;">in</span> myURLs
		<span style="color: #ff0033; font-weight: bold;">set</span> thisURL <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#40;</span><span style="color: #0066ff;">text</span> <span style="color: #000000;">1</span> <span style="color: #ff0033;">thru</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #0066ff;">offset of</span> <span style="color: #009900;">&quot;|&quot;</span> <span style="color: #ff0033; font-weight: bold;">in</span> myURL<span style="color: #000000;">&#41;</span> <span style="color: #000000;">-</span> <span style="color: #000000;">1</span><span style="color: #000000;">&#41;</span> <span style="color: #ff0033; font-weight: bold;">of</span> myURL<span style="color: #000000;">&#41;</span>
		<span style="color: #ff0033; font-weight: bold;">set</span> thisExt <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#40;</span><span style="color: #0066ff;">text</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #0066ff;">offset of</span> <span style="color: #009900;">&quot;|&quot;</span> <span style="color: #ff0033; font-weight: bold;">in</span> myURL<span style="color: #000000;">&#41;</span> <span style="color: #000000;">+</span> <span style="color: #000000;">1</span><span style="color: #000000;">&#41;</span> <span style="color: #ff0033;">thru</span> <span style="color: #000000;">&#40;</span>length <span style="color: #ff0033; font-weight: bold;">of</span> myURL<span style="color: #000000;">&#41;</span> <span style="color: #ff0033; font-weight: bold;">of</span> myURL<span style="color: #000000;">&#41;</span>
		<span style="color: #ff0033; font-weight: bold;">set</span> <span style="color: #ff0033;">the</span> myFile <span style="color: #ff0033; font-weight: bold;">to</span> fullDir <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot;:&quot;</span> <span style="color: #000000;">&amp;</span> myFilePrefix <span style="color: #000000;">&amp;</span> i <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot;.&quot;</span> <span style="color: #000000;">&amp;</span> thisExt
		download thisURL <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">file</span> myFile replacing <span style="color: #0066ff;">yes</span>
		<span style="color: #ff0033; font-weight: bold;">set</span> i <span style="color: #ff0033; font-weight: bold;">to</span> i <span style="color: #000000;">+</span> <span style="color: #000000;">1</span>
	<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">repeat</span>
<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span>
&nbsp;
<span style="color: #808080; font-style: italic;">-- display images using full-featured QuickLook window:</span>
<span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;Finder&quot;</span>
	<span style="color: #0066ff;">activate</span>
	<span style="color: #0066ff;">open</span> <span style="color: #0066ff;">folder</span> fullDir
	<span style="color: #ff0033; font-weight: bold;">set</span> current view <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #ff0033;">front</span> Finder <span style="color: #0066ff;">window</span> <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">list</span> view
<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span>
&nbsp;
<span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;System Events&quot;</span>
	key code <span style="color: #000000;">0</span> using <span style="color: #000000;">&#123;</span>command down<span style="color: #000000;">&#125;</span> <span style="color: #808080; font-style: italic;">-- cmd+a</span>
	key code <span style="color: #000000;">6</span> using <span style="color: #000000;">&#123;</span>command down, option down<span style="color: #000000;">&#125;</span> <span style="color: #808080; font-style: italic;">-- cmd+opt+y; y is 16 for US, 6 for Hungarians :)</span>
<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span>
&nbsp;
<span style="color: #808080; font-style: italic;">-- that would be the callback after QuickLook:</span>
<span style="color: #808080; font-style: italic;">--tell application &quot;Finder&quot;</span>
<span style="color: #808080; font-style: italic;">--	activate</span>
<span style="color: #808080; font-style: italic;">--	set current view of front Finder window to v</span>
<span style="color: #808080; font-style: italic;">--	close front Finder window</span>
<span style="color: #808080; font-style: italic;">--end tell</span>
&nbsp;
<span style="color: #808080; font-style: italic;">-- display images using a very limited (dumb) QuickLook window:</span>
<span style="color: #808080; font-style: italic;">--do shell script &quot;qlmanage -p  &quot; &amp; (POSIX path of fullDir) &amp; &quot;/* &gt;&amp; /dev/null&quot;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">-- GrowlCheck:</span>
<span style="color: #ff0033; font-weight: bold;">on</span> growlInstalled<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
	<span style="color: #ff0033; font-weight: bold;">try</span>
		<span style="color: #0066ff;">do shell script</span> <span style="color: #009900;">&quot;ls /Library/PreferencePanes/Growl.prefPane/&quot;</span>
		<span style="color: #ff0033; font-weight: bold;">return</span> <span style="color: #0066ff;">true</span>
	<span style="color: #ff0033; font-weight: bold;">on</span> <span style="color: #ff0033; font-weight: bold;">error</span>
		<span style="color: #ff0033; font-weight: bold;">return</span> <span style="color: #0066ff;">false</span>
	<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">try</span>
<span style="color: #ff0033; font-weight: bold;">end</span> growlInstalled
&nbsp;
<span style="color: #808080; font-style: italic;">-- Growl notifier:</span>
<span style="color: #ff0033; font-weight: bold;">on</span> notifyWithGrowl<span style="color: #000000;">&#40;</span>myApp, myText<span style="color: #000000;">&#41;</span>
	<span style="color: #ff0033; font-weight: bold;">set</span> myIconApp <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;Preview&quot;</span>
	<span style="color: #ff0033; font-weight: bold;">set</span> notificationID <span style="color: #ff0033; font-weight: bold;">to</span> myApp <span style="color: #000000;">&amp;</span> <span style="color: #009900;">&quot;.default&quot;</span>
&nbsp;
	<span style="color: #ff0033; font-weight: bold;">if</span> growlInstalled<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #ff0033; font-weight: bold;">then</span>
		<span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;GrowlHelperApp&quot;</span>
			<span style="color: #808080; font-style: italic;">-- list of notification types</span>
			<span style="color: #ff0033; font-weight: bold;">set</span> <span style="color: #ff0033;">the</span> ANL <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#123;</span>notificationID<span style="color: #000000;">&#125;</span>
			<span style="color: #808080; font-style: italic;">-- list of enabled notifications</span>
			<span style="color: #ff0033; font-weight: bold;">set</span> <span style="color: #ff0033;">the</span> DNL <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#123;</span>notificationID<span style="color: #000000;">&#125;</span>
&nbsp;
			<span style="color: #808080; font-style: italic;">-- register script</span>
			register <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">application</span> myApp all notifications ANL default notifications DNL icon <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">application</span> myIconApp
			<span style="color: #808080; font-style: italic;">-- send notification</span>
			notify <span style="color: #ff0033; font-weight: bold;">with</span> <span style="color: #0066ff;">name</span> notificationID title myApp description myText <span style="color: #0066ff;">application</span> <span style="color: #0066ff;">name</span> myApp
		<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span>
	<span style="color: #ff0033; font-weight: bold;">else</span>
		<span style="color: #808080; font-style: italic;">-- skip alert if no Growl installed</span>
		<span style="color: #808080; font-style: italic;">--display alert &quot;Growl is not installed&quot;</span>
	<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">if</span>
<span style="color: #ff0033; font-weight: bold;">end</span> notifyWithGrowl</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://fns.csokolade.hu/2010/05/16/meteo-script-update/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Plain Text QuickLook ismeretlen file-okhoz</title>
		<link>http://fns.csokolade.hu/2010/02/10/plain-text-quicklook-ismeretlen-file-okhoz/</link>
		<comments>http://fns.csokolade.hu/2010/02/10/plain-text-quicklook-ismeretlen-file-okhoz/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 21:57:29 +0000</pubDate>
		<dc:creator>eFi</dc:creator>
				<category><![CDATA[AppleScript]]></category>
		<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://fns.csokolade.hu/?p=25</guid>
		<description><![CDATA[1. Megírod ezt a scriptet a Script Editorban: tell application &#34;Finder&#34; copy selection to selectedItems if &#40;&#40;count of selectedItems&#41; ≠ 0&#41; then repeat with selectedItem in selectedItems set file type of file &#40;selectedItem as alias&#41; to &#34;TEXT&#34; set p to quoted form of &#40;POSIX path of &#40;selectedItem as alias&#41;&#41; as string do shell script &#40;&#34;qlmanage [...]]]></description>
			<content:encoded><![CDATA[<p>1. Megírod ezt a scriptet a Script Editorban:</p>

<div class="wp_syntax"><div class="code"><pre class="applescript" style="font-family:monospace;"><span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;Finder&quot;</span>
	<span style="color: #ff0033; font-weight: bold;">copy</span> <span style="color: #0066ff;">selection</span> <span style="color: #ff0033; font-weight: bold;">to</span> selectedItems
	<span style="color: #ff0033; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #0066ff;">count</span> <span style="color: #ff0033; font-weight: bold;">of</span> selectedItems<span style="color: #000000;">&#41;</span> ≠ <span style="color: #000000;">0</span><span style="color: #000000;">&#41;</span> <span style="color: #ff0033; font-weight: bold;">then</span>
		<span style="color: #ff0033; font-weight: bold;">repeat</span> <span style="color: #ff0033; font-weight: bold;">with</span> selectedItem <span style="color: #ff0033; font-weight: bold;">in</span> selectedItems
			<span style="color: #ff0033; font-weight: bold;">set</span> <span style="color: #0066ff;">file</span> type <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #0066ff;">file</span> <span style="color: #000000;">&#40;</span>selectedItem <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">alias</span><span style="color: #000000;">&#41;</span> <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;TEXT&quot;</span>
			<span style="color: #ff0033; font-weight: bold;">set</span> p <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">quoted form</span> <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #000000;">&#40;</span><span style="color: #0066ff;">POSIX path</span> <span style="color: #ff0033; font-weight: bold;">of</span> <span style="color: #000000;">&#40;</span>selectedItem <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">alias</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #ff0033;">as</span> <span style="color: #0066ff;">string</span>
			<span style="color: #0066ff;">do shell script</span> <span style="color: #000000;">&#40;</span><span style="color: #009900;">&quot;qlmanage -p &quot;</span> <span style="color: #000000;">&amp;</span> p<span style="color: #000000;">&#41;</span>
		<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">repeat</span>
	<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">if</span>
<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span></pre></div></div>

<p>2. Lemented valami rövid néven úgy, hogy a File Format mezőt "Application" típusúra állítod - mehet akár a /Applications folderbe, akár bárhova máshova, amit a Spotlight lát.</p>
<p>Ezek után ha szembejön a Finderben egy file, amit plain textként szeretnél megnézni, de annak a típusa még nem TEXT (.sub, .srt, .nfo file-ok mind ilyenek lesznek), akkor a Finderben a kérdéses file-on állva nyomsz egy ⌘Space kombinációt, hogy előbújjon a Spotlight, beírod neki villámgyorsan, hogy "ql" (vagy amilyen nevet kitaláltál) és az előbb elkészített script alkalmazásod mindjárt be is állítja TEXT típusúnak a kérdéses file-t, plusz szól a QuickLook-nak, hogy meg szeretnéd nézni.</p>
]]></content:encoded>
			<wfw:commentRss>http://fns.csokolade.hu/2010/02/10/plain-text-quicklook-ismeretlen-file-okhoz/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

