pls help translate my words to a working applescript

I’m hoping someone thinks this is easy and fun since I can’t figure it out.

Basically this is what I’m trying to do.

set NetVolume to “NameOfMyVolume”
set NetPath “cifs://Server/NameOfMyVolume”

So that I later can call the aliases like this

tell application “Finder”
if not (disk “NetVolume” exists) then
mount volume “NetPath”
end if
end tell

If I write the volume name and the correct path in the script, it works.

tell application “Finder”
if not (disk “NameOfMyVolume” exists) then
mount volume “cifs://Server/NameOfMyVolume”
end if
end tell

So I know that the actual script is ok, it’s the use of aliases that confuse me.
I’ve tried
set NetPath to POSIX path of “cifs://Server/NameOfMyVolume”

as well but it doesn’t work.

I’m new to programming and I’m just trying to learn the basics so I’d be thankful for easy-to-follow-help since I seem to have a nack of not understanding…

Hi luvis. Welcome to MacScripter.

Putting quotes round NetPath produces the text “NetPath”, so the script thinks “NetPath” the path to the volume you’re trying to mount. To use the variable you’ve set, leave off the quotes:

mount volume NetPath

Thank you! It was so much easier than I thought =) Thanks for the explanation too, it made perfect sense. The script works now!