Xojo GUI’s for AppleScript – chapter 1

In this blog category ‘XOJO integration with AppleScript, AppleEvents & Python’ I’m covering the basics of using Xojo / RealBasic as a GUI and wrapper App for commercial AppleScripts and Python scripts, as well as showing how to add a custom scripting dictionary into said app for improved control, flexibility and automation. Frankly, Xojo is the ‘missing link’ when it comes to AppleScript. It provides the missing GUI, the missing Dictionary and also the missing security – as such apps can be notarized and code-signed for public release.

The key requirements are:

1) Script Debugger by Late Night Software
2) MacScript.com Library (available on this site for free)
3) XOJO (REALBasic)
4) TextWrangler or BBEdit from Bare Bones.

InDesign CS4, CS6 and Adobe Acrobat 9, 10 Pro is what we will eventually be automating.

To start at the beginning….

Below is a simple REALBasic project called ‘RB Applescript’ that I started out with when first beginning to write commercial publishing automation solutions.

RB AppleScript

RB Applescript consists of a Window Interface (Window 1) containing a text entry box (named EditFeld1) a push button (named PushButton1) and an AppleScript called ‘SaySomeString.scpt’

You can create a simple interface around your AppleScript in just two minutes so that you can control it with the usual Mac interface elements like buttons and textfields and progress bars supplied by the REALBasic ‘wrapper’. AppleScript in itself gives you very limited dialog boxes that pop up and disappear in a sequential manner, whereas with RB you can create an app with a presence that stays visible on screen throughout the ‘running’ and integrates the scripts with the user. You can attach a whole bunch of applescripts in one app, have many different windows and elements and link them all together in logic with a minimal amount of basic code.

RB Applescript Project with Window 1 interface tab consisting of a Window with an EditField called EditField1 and a BevelButton called pushbutton1

In Script Editor save the following as a script


on run {x}
	tell application "Finder"
		say x
	end tell
end run

Drag the file icon of the script from desktop into your REALBasic ‘RB Applescript’ Project tab.

drag the file icon of the script from desktop into your REALBasic ‘RB Applescript’ Project tab.

In Window1’s code tab add the code for pushbutton1‘s Action under the Controls list. Note the name of the applescript is added as a function here

in Window1’s code tab add the code for pushbutton1‘s Action under the Controls list. Note the name of the applescript is added as a function here

In the Project tab click on the App icon and then in properties pane set the Mac name of the app to RB Applescript.

In the Project tab click on the App icon and then in properties pane set the Mac name of the app to RB Applescript.

Check the Build Settings in the Project menu are set to Intel Mac and then click build

Check the Build Settings in the Project menu are set to Intel Mac and then click build