Mounting shared volumes in ASS application

I’ve been working on an AppleScript Studio application to mount some shared volumes on a login. But before I run, I have to walk, and walking is turning out to be pretty tough. I’ve distilled the problem to the way ASS pulls text out of a field and sets it to a variable (loginUsername). I then try to get it to display in another text field to see if I get a result (I’ve also tried “log”) but it doesn’t work and I get that great NSCannotCreateScriptCommandError (10). Here’s the code. I’m sure the solution is simple, but I cannot figure it out for the life of me.

on clicked theObject
	if (name of theObject is "login") then
		set LoginUsername to contents of text field "username"
		set contents of text field "result" to LoginUsername
	end if
end clicked

Any advice people have would be greatly appreciated!

Most probably:

(if the text field is not located within another element, such as tabs or a box)

Wow! Thanks. That fixed that problem. Unfortunately, I now have another. I get the application to run, authenticate to the two servers (Sven and Brit), and mount all four shares that we need. The one from Sven mounts fine as does one from Brit (always the same share). The other two shares from Brit appear to mount but then disappear as soon as I click on them. Also, shares from Brit mount twice as the result of one mount command for each share (i.e. two Brit.Class appear on desktop in spite of one mount volume command listed for Brit.Class).

I tried paring down the script and running it in Script Editor, getting somewhat duplicated results. The shares worked fine but again mounted twice. Is this an AppleScript problem? I can post code if anyone thinks that would help.