Using a Widget as an AppleScript UI

I have made a script that fixes the Address Book entries according to brazilian calling standards (here we need to add the long distance operator on every call, so if you want to change operator this script can change all your entries - and be good to sync with you iPhone :)). It also changes the format of fone numbers acording to where you are, so caller ID will get a nice match on iPhone too… :)).

So, since it has to ask many questions to the user, it is annoying to use Display Dialog, too many pop-ups.
An artist-friend developed a nice Widget as an interface. It has two text boxes and a couple os radio-button sets, and an execute button.

I all need is to call the script when the user hits “execute”, and pass the variables of the selections into the script…

Sounds easy, but I have researched the foruns for a few hours and I didn’t find a solution.

Missinglink is not a good option because users would need to install it - and the idea of the widget is to avoid that… We want to give it to happy brazilian iPhoners for free… :slight_smile:

Any ideas?

If you need to illustrate, I have packed the widget and the script and uploaded here

Thanks a lot!

You have 2 options!

  1. Use Apple Script Studio as your (G)UI
  2. Make a url thingy for your application that runs the script. Like the button would just open a page in the widget like “mygreatapp://” or just “mygreatapp://” would open it.
    It is hard to make your application compatible with this without using something like missinglink but it is possible so If you want to go down this path just reply and I can make an app compatible with it (but the widget is still up to you! :stuck_out_tongue: )

Hope that helped (just reply, dont message me)

Thank a lot for the help.

It seems this is not as trivial as I thought.
I have never used Studio, so I gues I have some homework to do.
Regarding the app, does it mean the user would need to have an app always running to be able to use de widget to launch the script? Or could this app run only when, say, he clicks on a “enable” button on the widget, or when the widget Dashboard gets opened…? I would definetly appreciate your help with such app. The widget is already done (link on other post), and so is the script… I only need to integrate it now…

Thanks again!


You can also use osascript from the command line.

See also: Dashboard Programming Topics: Accessing Command Line Utilities

Edit: It’s also possible to make a plug-in (ObjC) that utilizes the Address Book framework.