<?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>A FileMaker Blog&#187; Custom Function</title>
	<atom:link href="http://www.gaslowitz.net/filemaker/blog/topic/custom-function/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gaslowitz.net/filemaker/blog</link>
	<description>I have your database right here</description>
	<lastBuildDate>Mon, 08 Feb 2010 20:28:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Windows Users May Snarl</title>
		<link>http://gaslowitz.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.gaslowitz.net%2Ffilemaker%2Fblog%2F2008%2F08%2Fwindows-users-may-snarl%2F&amp;seed_title=Windows+Users+May+Snarl</link>
		<comments>http://gaslowitz.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.gaslowitz.net%2Ffilemaker%2Fblog%2F2008%2F08%2Fwindows-users-may-snarl%2F&amp;seed_title=Windows+Users+May+Snarl#comments</comments>
		<pubDate>Tue, 12 Aug 2008 18:50:13 +0000</pubDate>
		<dc:creator>Michael Gaslowitz</dc:creator>
				<category><![CDATA[Custom Function]]></category>
		<category><![CDATA[FileMaker]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[360Works]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[ScriptMaster]]></category>
		<category><![CDATA[Snarl]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.gaslowitz.net/filemaker/blog/?p=49</guid>
		<description><![CDATA[If you liked the post where I integrated Growl into FileMaker, but wondered if it could work on Windows, you might want to take a look at Snarl. Like Growl on Mac OS X, Snarl displays on-screen notifications in Windows, and with the help of the command-line utility Snarl_CMD.exe, Snarl can be integrated to work [...]]]></description>
			<content:encoded><![CDATA[<p>If you liked the post where I <a href="http://www.gaslowitz.net/filemaker/blog/2008/07/video-growl-integration/">integrated Growl into FileMaker</a>, but <a href="http://www.longtermsolutions.com">wondered</a> if it could work on <a href="http://www.amazon.com/gp/product/B00022PTRU?ie=UTF8&#038;tag=afilblo-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=B00022PTRU">Windows</a>, you might want to take a look at <a href="http://www.fullphat.net/index.php">Snarl</a>.</p>
<p>Like <a href="http://growl.info/">Growl</a> on <a href="http://www.amazon.com/gp/product/B000FK88JK?ie=UTF8&#038;tag=afilblo-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=B000FK88JK">Mac OS X</a>, Snarl displays on-screen notifications in Windows, and with the help of the command-line utility <a href="http://tlhan-ghun.de/?q=node/59">Snarl_CMD.exe</a>, Snarl can be integrated to work with your FileMaker solutions as a <a href="http://www.gaslowitz.net/filemaker/blog/category/custom-function/">custom function</a>.</p>
<p>Below is an outline of what I would do if I was using Windows. I apologize for not including a sample file this time, but I do not have access to a Windows machine, and I do not want to post a file that does not work.</p>
<h4>The Custom Function</h4>
<p>Since Snarl_CMD.exe accepts parameters as follows:</p>
<pre>
Snarl_CMD.exe snShowMessage TIME TITLE BODY [iconPATH]
<span style="color: #AAAAAA">
/*

TIME is the time the message should be displayed in seconds
(0 means forever/sticky),

TITLE and BODY are the texts which should be displayed, and

iconPath is the windows path for an icon to be displayed in
the notifcation: 

"C:\my\path\img.png" or  "\\server\path\on\server\img.png"

*/
</span>
</pre>
<p>the Snarl custom function will look something like this:</p>
<pre>Snarl ( Time; Title; Body; Path )

"Snarl_CMD.exe snShowMessage" &#038; Quote ( Time ) &#038; Quote ( Title ) &#038; Quote ( Body ) &#038; Quote ( Path )
</pre>
<h4>The External Function</h4>
<p>The Snarl custom function gets passed into the built-in FileMaker function <em>Set Variable</em>, but since  Snarl_CMD.exe is a shell script, it requires a plugin to be executed. <a href="http://www.360works.com/scriptmaster/">ScriptMaster</a> from <a href="http://www.360works.com/">360Works</a> is a free one, and it can do a whole lot more than execute shell scripts.</p>
<p>To configure ScriptMaster, set a variable in your startup script with the following value:</p>
<pre>RegisterGroovy( "RunShellScript( shellScript )" ; "Process process = Runtime.getRuntime().exec( shellScript );¶
String processResult = process.getInputStream().getText();¶
process.waitFor();¶
exitValue = process.exitValue();¶
return processResult;" )</pre>
<p>You have now created an external function for this solution:</p>
<pre>RunShellScript ( shellScript )</pre>
<h4>The Script</h4>
<p>Now it is time to put everything together in a <em>Set Variable</em> script step:</p>
<pre>Set Variable [ RunShellScript( Snarl ( "Time" ; "Title" ; "Body" ; "Icon Path" ) ) ]</pre>
<p>Hopefully it works. Leave a comment and let me know!</p>
]]></content:encoded>
			<wfw:commentRss>http://gaslowitz.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.gaslowitz.net%2Ffilemaker%2Fblog%2F2008%2F08%2Fwindows-users-may-snarl%2F&amp;seed_title=Windows+Users+May+Snarl/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Video: Quicksilver for Large Type Functionality</title>
		<link>http://gaslowitz.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.gaslowitz.net%2Ffilemaker%2Fblog%2F2008%2F07%2Fvideo-quicksilver-for-large-type-functionality%2F&amp;seed_title=Video%3A+Quicksilver+for+Large+Type+Functionality</link>
		<comments>http://gaslowitz.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.gaslowitz.net%2Ffilemaker%2Fblog%2F2008%2F07%2Fvideo-quicksilver-for-large-type-functionality%2F&amp;seed_title=Video%3A+Quicksilver+for+Large+Type+Functionality#comments</comments>
		<pubDate>Wed, 30 Jul 2008 20:05:29 +0000</pubDate>
		<dc:creator>Michael Gaslowitz</dc:creator>
				<category><![CDATA[AppleScript]]></category>
		<category><![CDATA[Custom Function]]></category>
		<category><![CDATA[FileMaker]]></category>
		<category><![CDATA[Podcast]]></category>
		<category><![CDATA[Quicksilver]]></category>

		<guid isPermaLink="false">http://www.gaslowitz.net/filemaker/blog/?p=15</guid>
		<description><![CDATA[This post demonstrates how to integrate Large Type functionality into your FileMaker Pro database using Quicksilver. For those who have never poked around in Apple&#8217;s Address Book, clicking on a phone number type (work, home, etc.) pulls up a list of options, one of which is Large Type. Think big numbers across the screen for [...]]]></description>
			<content:encoded><![CDATA[<p>This post demonstrates how to integrate Large Type functionality into your FileMaker Pro database using <a href="http://www.blacktree.com">Quicksilver</a>. For those who have never poked around in Apple&#8217;s Address Book, clicking on a phone number type (work, home, etc.) pulls up a list of options, one of which is Large Type. Think big numbers across the screen for easy viewing and dialing.</p>
<p>Quicksilver&#8217;s Large Type functionality is accessed via an <a href="http://www.apple.com/applescript/">AppleScript</a> that has been embedded in a custom function. <a href="http://www.amazon.com/gp/product/B000SST6RW?ie=UTF8&#038;tag=afilblo-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=B000SST6RW">Filemaker Pro Advanced</a> is required to view the custom function.</p>
<p><a class="img" href="http://www.gaslowitz.net/filemaker/blog/files/2008/07/LargeType.mov"><br />
<img alt="large type video" title="Click to Play" src="http://www.gaslowitz.net/filemaker/blog/files/2008/07/LargeType_poster.jpg" /></a></p>
<p><img alt="ipod version" src="http://www.gaslowitz.net/filemaker/images/ipod.png" alt="" width="16" height="16" /> <a href="http://www.gaslowitz.net/filemaker/blog/files/2008/07/LargeType.m4v">iPod Download</a> (11.5 MB)  </p>
<p><img title="Quicksilver website" src="http://www.gaslowitz.net/filemaker/images/world.png" alt="" width="16" height="16" /> <a href="http://www.blacktree.com">Quicksilver website</a></p>
<p><img title="Quicksilver tutorials" src="http://www.gaslowitz.net/filemaker/images/world.png" alt="" width="16" height="16" /> <a href="http://docs.blacktree.com/quicksilver/tutorials?DokuWiki=c18b5e6fe13586d77a08f3eb2c3f2042">Quicksilver tutorials</a></p>
<p><img title="download file" src="http://www.gaslowitz.net/filemaker/images/file.png" alt="" width="16" height="16" /> <a href="http://www.gaslowitz.net/filemaker/blog/files/2008/07/LargeType.zip">Download LargeType.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://gaslowitz.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.gaslowitz.net%2Ffilemaker%2Fblog%2F2008%2F07%2Fvideo-quicksilver-for-large-type-functionality%2F&amp;seed_title=Video%3A+Quicksilver+for+Large+Type+Functionality/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://www.gaslowitz.net/filemaker/blog/files/2008/07/LargeType.m4v" length="" type="" />
<enclosure url="http://www.gaslowitz.net/filemaker/blog/files/2008/07/LargeType.mov" length="16566411" type="video/quicktime" />
		</item>
		<item>
		<title>Video: Growl Integration</title>
		<link>http://gaslowitz.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.gaslowitz.net%2Ffilemaker%2Fblog%2F2008%2F07%2Fvideo-growl-integration%2F&amp;seed_title=Video%3A+Growl+Integration</link>
		<comments>http://gaslowitz.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.gaslowitz.net%2Ffilemaker%2Fblog%2F2008%2F07%2Fvideo-growl-integration%2F&amp;seed_title=Video%3A+Growl+Integration#comments</comments>
		<pubDate>Sat, 12 Jul 2008 00:56:22 +0000</pubDate>
		<dc:creator>Michael Gaslowitz</dc:creator>
				<category><![CDATA[AppleScript]]></category>
		<category><![CDATA[Custom Function]]></category>
		<category><![CDATA[FileMaker]]></category>
		<category><![CDATA[Podcast]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Growl]]></category>
		<category><![CDATA[Mac OS X]]></category>

		<guid isPermaLink="false">http://www.gaslowitz.net/filemaker/blog/?p=12</guid>
		<description><![CDATA[This post demonstrates how to integrate the Growl notification system for Mac OS X with your FileMaker Pro Database. Growl notifications are called via an AppleScript that has been formatted into a custom function. FileMaker Pro Advanced is required to view the custom function. These notifications can be used whenever you want to alert a [...]]]></description>
			<content:encoded><![CDATA[<p>This post demonstrates how to integrate the <a href="http://growl.info">Growl</a> notification system for Mac OS X with your FileMaker Pro Database. Growl notifications are called via an AppleScript that has been formatted into a custom function. <a href="https://store.filemaker.com/product/viewfamily/family/FDE?buy=pro9advpp">FileMaker Pro Advanced</a> is required to view the custom function. These notifications can be used whenever you want to alert a user without requiring his or her interaction.</p>
<p><a class="img" href="http://www.gaslowitz.net/filemaker/blog/files/2008/07/Growl_large.mov"><br />
<img alt="growl video" title="Click to Play" src="http://www.gaslowitz.net/filemaker/blog/files/2008/07/Growl_poster.jpg" /></a></p>
<p><img alt="ipod version" src="http://www.gaslowitz.net/filemaker/images/ipod.png" alt="" width="16" height="16" /> <a href="http://www.gaslowitz.net/filemaker/blog/files/2008/07/Growl_small.m4v">iPod Download</a> (18.5 MB)  </p>
<p><img title="Growl website" src="http://www.gaslowitz.net/filemaker/images/world.png" alt="" width="16" height="16" /> <a href="http://growl.info">Growl website</a></p>
<p><img title="download file" src="http://www.gaslowitz.net/filemaker/images/file.png" alt="" width="16" height="16" /> <a href="http://www.gaslowitz.net/filemaker/blog/files/2008/07/Growl.zip">Download Growl.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://gaslowitz.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.gaslowitz.net%2Ffilemaker%2Fblog%2F2008%2F07%2Fvideo-growl-integration%2F&amp;seed_title=Video%3A+Growl+Integration/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
<enclosure url="http://www.gaslowitz.net/filemaker/blog/files/2008/07/Growl_large.mov" length="20332569" type="video/quicktime" />
<enclosure url="http://www.gaslowitz.net/filemaker/blog/files/2008/07/Growl_small.m4v" length="19441217" type="audio/x-m4a" />
		</item>
		<item>
		<title>Function Scripting [ learn ]</title>
		<link>http://gaslowitz.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.gaslowitz.net%2Ffilemaker%2Fblog%2F2008%2F05%2Flearn-function-scripting%2F&amp;seed_title=Function+Scripting+%5B+learn+%5D</link>
		<comments>http://gaslowitz.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.gaslowitz.net%2Ffilemaker%2Fblog%2F2008%2F05%2Flearn-function-scripting%2F&amp;seed_title=Function+Scripting+%5B+learn+%5D#comments</comments>
		<pubDate>Thu, 29 May 2008 23:38:15 +0000</pubDate>
		<dc:creator>Michael Gaslowitz</dc:creator>
				<category><![CDATA[Custom Function]]></category>
		<category><![CDATA[FileMaker]]></category>
		<category><![CDATA[Scripting]]></category>

		<guid isPermaLink="false">http://www.filemaking.org/?p=6</guid>
		<description><![CDATA[The method I use to pass and retrieve parameters in almost all of my scripts is something I learned from Matt Petrowsky&#8217;s instructional video at FileMaker Magazine called Function Scripting. It is not for beginners, but it is one of the more powerful and dynamic things you can learn to do with FileMaker. Function Scripting [...]]]></description>
			<content:encoded><![CDATA[<p>The method I use to pass and retrieve parameters in almost all of my scripts is something I learned from  Matt Petrowsky&#8217;s instructional video at <a href="http://www.filemakermagazine.com">FileMaker Magazine</a> called <a href="http://www.filemakermagazine.com/videos/function-scripting.html" title="function scripting">Function Scripting</a>. It is not for beginners, but it is one of the more powerful and dynamic things you can learn to do with FileMaker.</p>
<p>Function Scripting requires three custom functions to do the heavy lifting; one by <a href="http://clevelandconsulting.com/support/viewtopic.php?t=1345">Alexander Zueiv</a>, and two by <a href="http://edoshin.skeletonkey.com/2006/02/options.html#more">Mikhail Edoshin</a>. </p>
<p>A copy of <a href="https://store.filemaker.com/product/viewfamily/family/FDE?buy=pro9advpp">FileMaker Pro Advance</a> will be needed to view the custom functions. If you do not have a copy of FileMaker Pro Advanced, you will still be able to use the <a href="/filemaker/blog/files/2008/05/LearnFunctionScripting.zip">sample file</a>.</p>
<h4>Name your scripts [ like; this ]</h4>
<p>To use this method you need to format the names of your scripts with the parameters the script will use:</p>
<pre>Example Script [ expected; (this|or|that) {; optional } ]</pre>
<p>Notice how it looks like a function? This is why it is called Function Scripting! How about some real-world examples:</p>
<pre>
Dialog [ title ; message ]
<span style="color: #AAAAAA">// A script that takes two parameters: title and message</span>

Create [ name ; user|admin ]
<span style="color: #AAAAAA">// A script that uses an "or"</span>

Record [ ID ; add|delete ; action ]
<span style="color: #AAAAAA">// A script that uses an "or" and optional third parameter</span>
</pre>
<p>Spaces are not important, but the brackets, semicolons, and pipes are. Your scripts will not work if you omit them.</p>
<h4>Supply parameters</h4>
<p>When passing parameters into a script, format them using the custom function &nbsp;<span style="font-family: 'Courier New'; line-height: 18px; white-space: pre;"><strong>param.set[ ]</strong></span>:</p>
<pre>
param.set( "expected" ; "value1" ) &amp;
param.set( "this|or|that" ; "value2" ) &amp;
param.set( "optional" ; "value3" )
</pre>
<p>I have formatted the parameters for the dialog script. Try to do the other two scripts yourself, or consult the <a href="/filemaker/blog/files/2008/05/LearnFunctionScripting.zip">sample file</a>:</p>
<pre>param.set( "title" ; "Alert") &amp;
param.set( "message" ; "This is an alert!" )</pre>
<h4>Now the magic</h4>
<p>The custom function <span style="font-family: 'Courier New'; line-height: 18px; white-space: pre;"><strong>param.assign[ ]</strong></span> does the rest of the work. Use it at the beginning of the script, and it will do two things:</p>
<ol>
<li>It will first check to see if you supplied and properly formatted all of the script&#8217;s parameters, and if you did,</li>
<li>it will then assign each parameter to a $local variable to use throughout the script.</li>
</ol>
<pre>
If [param.assign]
  <span style="color: #AAAAAA">//Do something here</span>
Else
  <span style="color: #AAAAAA">//Parameters not assigned</span>
End If
</pre>
<p>Our script:</p>
<pre>Dialog [ title ; message ]</pre>
<p>Receives parameters:</p>
<pre>
param.set ( "title" ; "Alert") &amp;
param.set ( "message" ; "This is an alert!" )
</pre>
<p>And performs the following steps:</p>
<pre>
If [ param.assign ]<span style="color: #AAAAAA">
  // We now have variables to use throughout the script:
  // $title = "Alert"
  // $message = "This is an alert."</span>
  Show Custom Dialog [ $title; $message ]
Else<span style="color: #AAAAAA">
  // Missing or improperly formatted parameters</span>
  Show Custom Dialog [ "Missing Parameters"; "Parameters not assigned."]
End If</pre>
<h4>Download the sample file</h4>
<p>I have included examples in the the sample file that you how to use the (this|or|that) parameter, and how to pass retrieve multiple parameters using the <span style="font-family: 'Courier New'; line-height: 18px; white-space: pre;"><strong>param.get( )</strong></span> custom function.</p>
<p><a href="/filemaker/blog/files/2008/05/LearnFunctionScripting.zip">LearnFunctionScripting.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://gaslowitz.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fwww.gaslowitz.net%2Ffilemaker%2Fblog%2F2008%2F05%2Flearn-function-scripting%2F&amp;seed_title=Function+Scripting+%5B+learn+%5D/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
