<?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>Claus Witt &#187; applescript</title> <atom:link href="http://www.clauswitt.com/tag/applescript/feed/" rel="self" type="application/rss+xml" /><link>http://www.clauswitt.com</link> <description>software and web developer</description> <lastBuildDate>Thu, 24 Jun 2010 20:07:03 +0000</lastBuildDate> <generator>http://wordpress.org/?v=2.9.2</generator> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <item><title>Using Quicksilver to edit hosts file</title><link>http://www.clauswitt.com/using-quicksilver-to-edit-hosts-file/</link> <comments>http://www.clauswitt.com/using-quicksilver-to-edit-hosts-file/#comments</comments> <pubDate>Wed, 04 Nov 2009 14:38:41 +0000</pubDate> <dc:creator>Claus Witt</dc:creator> <category><![CDATA[Development]]></category> <category><![CDATA[applescript]]></category> <category><![CDATA[hosts]]></category> <category><![CDATA[quicksilver]]></category><guid isPermaLink="false">http://www.clauswitt.com/?p=322</guid> <description><![CDATA[This is mostly just a follow up for my previous post on using a shell script to add and remove test domains in the hosts file. I have created two small applescripts for use in Quicksilver to execute that script. If you need to use these you place them in ~/Library/Application Support/Quicksilver/Actions and set your [...]]]></description> <content:encoded><![CDATA[<p>This is mostly just a follow up for my previous post on <a href="http://www.clauswitt.com/2009/11/04/319/">using a shell script to add and remove test domains in the hosts file</a>. I have created two small applescripts for use in Quicksilver to execute that script. If you need to use these you place them in ~/Library/Application Support/Quicksilver/Actions and set your password. (Beware this could pose a threat, since you will have your password in cleartext on your harddrive).</p><p>The two scripts are almost identical. Actually the only difference is the action the shell script should call (add or remove). The rest of the scripts are completely the same.</p><p>I call this file addhost.</p><pre name="code" class="applescript">
using terms from application "Quicksilver"
	on process text txt
		set the_password to "YOURPASSWORD"
		repeat with delimiter_position from 1 to (length of txt)
			if character delimiter_position of txt = " " then exit repeat
		end repeat
		if delimiter_position = (length of txt) then
			set hostname to txt as string
			set ipaddress to ""
		else
			set hostname to characters 1 thru (delimiter_position - 1) of txt as string
			set ipaddress to characters (delimiter_position + 1) thru (length of txt) of txt as string

		end if

		do shell script "sudo hosts.sh add " &#038; hostname &#038; " " &#038; ipaddress password the_password with administrator privileges

		return nothing
	end process text
end using terms from
</pre><p>I call this file removehost.</p><pre name="code" class="applescript">
using terms from application "Quicksilver"
	on process text txt
		set the_password to "YOURPASSWORD"
		repeat with delimiter_position from 1 to (length of txt)
			if character delimiter_position of txt = " " then exit repeat
		end repeat
		if delimiter_position = (length of txt) then
			set hostname to txt as string
			set ipaddress to ""
		else
			set hostname to characters 1 thru (delimiter_position - 1) of txt as string
			set ipaddress to characters (delimiter_position + 1) thru (length of txt) of txt as string

		end if

		do shell script "sudo hosts.sh remove " &#038; hostname &#038; " " &#038; ipaddress password the_password with administrator privileges

		return nothing
	end process text
end using terms from
</pre><p>Now I am able to create a local domain by opening Quicksilver (double-control in my case) press period, write the domain name, press tab, and select the addhost action (ad is enough in my case). Removing is just as easy &#8211; the last step is just to select the removehost action (re is enough in my case).</p> ]]></content:encoded> <wfw:commentRss>http://www.clauswitt.com/using-quicksilver-to-edit-hosts-file/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>Resizing Itunes Window with Applescript</title><link>http://www.clauswitt.com/resizing-itunes-window-with-applescript/</link> <comments>http://www.clauswitt.com/resizing-itunes-window-with-applescript/#comments</comments> <pubDate>Sun, 31 May 2009 06:14:43 +0000</pubDate> <dc:creator>Claus Witt</dc:creator> <category><![CDATA[Development]]></category> <category><![CDATA[applescript]]></category> <category><![CDATA[itunes window]]></category> <category><![CDATA[set bounds]]></category><guid isPermaLink="false">http://www.clauswitt.com/?p=244</guid> <description><![CDATA[This weekend my girlfriend and I moved all the stuff I had in my private office/homestudio out, to create a room for our son. Because of this my old mac was put in the living room, and is now a primitive media center with the TV as it&#8217;s only screen. The resolution as a result [...]]]></description> <content:encoded><![CDATA[<p>This weekend my girlfriend and I moved all the stuff I had in my private office/homestudio out, to create a room for our son. Because of this my old mac was put in the living room, and is now a primitive media center with the TV as it&#8217;s only screen. The resolution as a result has changed to something significantly lower, and there are no longer two screens. As a result the Itunes window was too big, and I was not able to resize it, since the area where this is possible was outside the viewable area of the screen, no mather what I did.</p><p>I decided it was time for some AppleScript to solve this problem.</p><pre name="code" class="applescript">
tell application "iTunes"
	set bounds of window 1 to {1, 1, 400, 400}
end tell
</pre><p>ps &#8211; had an old cordless windows keyboard and mouse &#8211; it is a bit weird trying to figure out which keys do what&#8230;</p> ]]></content:encoded> <wfw:commentRss>http://www.clauswitt.com/resizing-itunes-window-with-applescript/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using memcached
Page Caching using memcached (user agent is rejected)
Database Caching 5/23 queries in 0.018 seconds using memcached

Served from: www.clauswitt.com @ 2010-07-30 04:38:07 -->