Gooey Gadgets 0.37

This is small background app I wrote a while ago, and just rev’d it once again.

Recapping things, it is a small background application for adding UI functionality that is not easily available in either AppleScript or Filemaker. It supports the following UI elements:

Message Window: display a single line of text sized to fit across entire width of screen (like Address Book)
Progress Window: smaller window displaying a progress control and a cancel button
Table Window: displays list data in a row & column format
Text Window: for larger amounts of text that won’t fit in a typical dialog

Includes both an AppleScript and a .fp7 demo file.

Download at http://sibr.com/downloads/Gooey Gadgets.zip

Use Bonjour name to connect to a system

Many servers and devices, especially those that are Mac OS based, use Bonjour to broadcast their location. On a few occasions, I’ve known that a particular server or workstation was on the network, but not its address.

This tip has two parts to it. The first part of this, and more commonly known, is how you can use a system’s computer (Bonjour) name to contact a system. You can see this for a file server if you go to the Finder’s Network browse folder.

In the example above, there is only one system broadcasting its availability, and showing its name as iMacIntel. From here, I could connect to the system if it was a file server or share its screen if screen sharing (AKA VNC) was enabled. But what if I want to connect via SSH or ping it. Since I know its Bonjour name, I can ping the system in the Terminal by adding .local as a suffix like so:

ping imacintel.local

Now that we know how to use a system’s name as a hostname, how do we find a system if it isn’t showing up in the network view? That will be in the next post.

Gooey Gadgets 0.3.0

Since my last post I’m now up to version 0.3.0, which includes a new command, display text window. This command can be used to display larger amounts of text in a dialog. Currently, the text inside this window is editable. However, there is probably no easy way to properly support the editing of text, so it’s likely this will change to a static view soon. Here’s an example of what it looks like and how to use from AppleScript:

display text window “Text Title” label “Log from: /var/log/system.log” message (do shell script “cat /var/log/system.log”)

There have also been some minor changes to the parameters used for the update window and display progress window commands so that they are consistent with display text window. These may require you to edit or recompile any scripts to use the new version.

Download at http://sibr.com/downloads/Gooey Gadgets.zip.

New version of bBox FileMaker plugin

One of my work/personal projects has been a FileMaker external plug-in for the Mac OS called bBox. The main push with this recently has was to include access to the Python scripting language. Previously, using bBox’s existing bBox_Shell function I could’ve called a Python script this way:

Set Variable [ $script; Value:”xs = ‘He’ + ‘llo’; print xs # Complicated way to say hello” ]

Set Variable [ $res; Value:bBox_Shell( 0; “python -c \”” & $script & “\””) ]

Show Custom Dialog [ Title: “Python”; Message: $res; Buttons: “OK” ]

That’s definitely do-able. But you’ll likely have to reformat your scripts, and be careful about quoting or escaping characters. Alternatively, you could first ensure that your script had first been saved out to a file, perhaps by using FileMaker’s Export Records command.

But instead, I can now write something like the following from a FileMaker script:

Set Variable [ $script; Value:”# Complicated way to say hello. xs = ‘He’ + ‘llo’

print xs “]

Set Variable [ $res; Value:bBox_PythonCompile( 0; $script ) ]

If [ $res = “” ]

Set Variable [ $res; Value:bBox_PythonExecute( 0 ) ]

Set Variable [ $ig; Value:bBox_PythonFinalize ]

End If

You may be wondering why it takes three function calls to execute such a simple script. There are three reasons for this. Most obviously, a script can be executed multiple times but only needs to be executed once. A related, but less obvious reason is the need to setup and then teardown the Python environment, which is significant for a short script like this. Finally, it allows the option of setting or retrieving Python variables from FileMaker, which can now be done with the bBox_PythonSetVar and bBox_PythonGetVar functions.

Now on Twitter as @sibrcode

OK, well who isn’t at this point? But I’ve actually been pleasantly what some people have been doing with it.

Personally, I won’t be tweeting extensively, just occasionally.

bBox FileMaker plug-in for AppleScript, shell, grep, etc.

Finally got a new version of my FileMaker plug-in going with a feature that I’ve been waiting for a long time — the ability to pass parameters to AppleScript without having to resort passing data through FileMaker globals or other craziness. The best place to find it right now is:

http://buzz.beezwax.net/2009/03/19/bbox-filemaker-plug-in-easily-add-applescript-shell-grep-and-more-to-your-filemaker-projects

Since it’s already described there I won’t be going into great detail about it. But I do plan on posting some comments on how to make good (or unexpected) use of it .

Here’s my first easter-egg. In the shell section of the demo file, I’ve put in some of the Safari preference snippets that I mentioned in Hidden preferences, files, and URLs in Safari. Eventually I may get them all in.

Hidden preferences, files, and URLs in Safari

Enter these in Safari’s URL field in the Address Bar:

Open Safari’s bookmark manager:

bookmarks:

Open the boot drive directory in Finder, or open a specified directory in the Finder:

file:
file:///Sys/Users

List all of Safari’s keyboard shortcuts:

file:///Applications/Safari.app/Contents/Resources/Shortcuts.html

 

These must be entered in the Terminal after quitting Safari.

Turn off inline rendering of PDFs:

defaults write com.apple.Safari WebKitOmitPDFSupport -bool YES

Enable the Debug menu:

defaults write com.apple.Safari IncludeDebugMenu 1

Full page zoom feature (works in 3.1?):

defaults write com.apple.Safari WebKitDebugFullPageZoomPreferenceKey 1

Force links that normally open in new window to open in a tab:

defaults write com.apple.Safari TargetedClicksCreateTabs 1

Enable web inspector tool (requires debug mode to be turned on?):

defaults write com.apple.Safari WebKitDeveloperExtras -bool true

Show URL for link as tool tip:

defaults write com.apple.Safari WebKitShowsURLsInToolTips -bool true

Change the length of Safari’s history. To a full year with a maximum of 9999 items:

defaults write com.apple.Safari WebKitHistoryItemLimit 9999
defaults write com.apple.Safari WebKitHistoryAgeInDaysLimit 365

Make safari start displaying web page before all pics have finished downloading:

defaults write com.apple.Safari WebKitInitialTimedLayoutDelay 0.25
defaults write com.apple.Safari WebKitResourceTimedLayoutDelay 0.0001