Using Smile to replace display dialog for password dialog?

Can someone tell me how to correctly use a Smile custom dialog from an existing AppleScript to put up a password dialog? Using an example I found here in these forums, I’ve gotten a basic example working, but I’m having a couple of problems, and being new to AppleScript (not to mention Smile), I’m pretty lost…

What I’m trying to do is put up a simple password dialog. Basically, I just want to do the equivalent of the standard AppleScript command

display dialog "Please enter your NetWare password:" default answer ""

but have the input appear as bullets instead of clear text to prevent casual password theft.

I’ve created a Smile custom dialog, with some static text as item 1, a password text box as item 2, an ok button as item 3, and a cancel button as item 4. Here is the dialog script I’ve created, mostly copied from that example in these forums I mentioned:

property x : false

on prepare theDialog
	set focus of theDialog to «class DITL» 2 of theDialog
end prepare

on click in theDialog item number i
	if i = 3 then
		set x to «class pass» of theDialog's item 2
	else if i = 4 then
		set x to "canc"
	end if
end click in

Now, I want to call this dialog from an existing AppleScript that does everything I need except hide the password, since display dialog doesn’t do that. Here’s a sample AppleScript I’m using to call the dialog, again mostly based on that example from these forums:

set theDialogPath to alias "Macintosh HD:Users:greg:development:NW Mount:PasswordDialog"
set theDialog to DoOpen(theDialogPath)

repeat
	smilepause 0.1
	set contents_of_text_field to x of script of theDialog
	if contents_of_text_field is not false then
		delete theDialog
		exit repeat
	end if
end repeat

set thePassword to contents_of_text_field

This works fine when I run the script in Smile. However, problem number one is that when I save the script as an application and run it, I get an error dialog saying “«script» doesn’t understand the DoOpen message.”

Problem number two is that I don’t think that repeat loop with smilepause is really the way I’m supposed to call a Smile dialog from a script, and have the script wait for the user to hit the OK or Cancel buttons to continue. But the example I found was that way, and that’s the only way I’ve found to make it work.

If someone could please tell me what I’m doing wrong to be able to save the script as an application to call a Smile dialog, and perhaps give me an example of how to properly call the dialog, I’d really appreciate it.

Thank you for your assistance,

Greg Orman
Information Technolgy
Scripps College

1 - the DoOpen handler is own by the application Smile, you will find it in the context additions folder, so when you make an applet, you’re calling a handler that you have not included.
2 - you shoul not be expecting to be able to call a Smile Dialog outside of Smile, if you need a GUI, then you’ll have to make all your scripting in Smile, except if you build za standalone application which will give you a new application, scriptable, with your own GUI, but this feature was removed in the latest release of SMile, so go and get a previous one.