Windows Users May Snarl

by Michael Gaslowitz

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 with your FileMaker solutions as a custom function.

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.

The Custom Function

Since Snarl_CMD.exe accepts parameters as follows:

Snarl_CMD.exe snShowMessage TIME TITLE BODY [iconPATH]

/*

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"

*/

the Snarl custom function will look something like this:

Snarl ( Time; Title; Body; Path )

"Snarl_CMD.exe snShowMessage" & Quote ( Time ) & Quote ( Title ) & Quote ( Body ) & Quote ( Path )

The External Function

The Snarl custom function gets passed into the built-in FileMaker function Set Variable, but since Snarl_CMD.exe is a shell script, it requires a plugin to be executed. ScriptMaster from 360Works is a free one, and it can do a whole lot more than execute shell scripts.

To configure ScriptMaster, set a variable in your startup script with the following value:

RegisterGroovy( "RunShellScript( shellScript )" ; "Process process = Runtime.getRuntime().exec( shellScript );¶
String processResult = process.getInputStream().getText();¶
process.waitFor();¶
exitValue = process.exitValue();¶
return processResult;" )

You have now created an external function for this solution:

RunShellScript ( shellScript )

The Script

Now it is time to put everything together in a Set Variable script step:

Set Variable [ RunShellScript( Snarl ( "Time" ; "Title" ; "Body" ; "Icon Path" ) ) ]

Hopefully it works. Leave a comment and let me know!

  • email
  • Twitter
  • Reddit
  • Facebook
  • del.icio.us
  • StumbleUpon

August 12, 2008  •  Custom Function, FileMaker, Plugin, Scripting  •  4 Comments

4 Responses to “Windows Users May Snarl”

  1. Wim Decorte on August 16th, 2008 8:37 am

    Hi Michael. Great Blog!

    To execute a command line on Windows you don’t need a plugin. Use the SEND EVENT script step to execute a dynamic string like this:

    cmd /c your command here

    You can string commands together with the usual Windows command syntax like “&” and “&&”

  2. Michael Gaslowitz on August 19th, 2008 1:01 pm

    Hey Wim,

    I did not know you could use the Send Event script step like that. I wonder if it will work on a Mac.

    Did you get Snarl to work?

    Thanks for the comment!

  3. Sven on August 25th, 2008 4:39 am

    Let me know if it works for you or if you encounter any problems or have a wish for Snarl_CMD.exe – I am always to enhance it :)

    Sven

    P.S. found this posting through my webstats ;)

  4. Michael Gaslowitz on September 2nd, 2008 11:34 am

    Hey Sven,

    Thanks for offer, and I will be sure to send any request from myself or my viewers directly to you.

    Michael