how do you identify a variable as a variable not as a word

I’m trying to make it easyer for my users to logon on there accounts held on a win2000 server. The user enters their user name and password into a logon box press’s ok and the following code should take there username and password and mount their area on the network as a drive, but doesn’t.

on clicked theObject
tell window of theObject
try
set theUsername to contents of text field “username” as number
set thePassword to contents of text field “password” as number
end try
end tell
tell application “Finder”
mount volume “smb://theUsername:thePassword@10.0.1.13/theUsername”
end tell
end clicked

The problem being that i think that it is using the name of the variable not the contents of it. How can i do this ???

I Know its simple but I’ve only just started playing with this and I’m want to get it working.

For this line, try this syntax:

mount volume ("smb://" & theUsername & ":" & thePassword & "@10.0.1.13/" & theUsername)

:wink:

Fredo described how to code that line correctly. AppleScript does not have an interpolate mode as, for example, perl does, so you have to explicitly separate the variable from the other parts of the string and put them all together. Makes for slightly more typing, but it prevent confusion on whether you’re printing the variable’s value or its name. :slight_smile: