Setting a script to mount a user’s network folder, all of which are housed within 13 shares named similar to (a01-b01, c01-d01, e01-f01, etc.). Taking the first letter of their username, I need to tell applescript what the next letter in the alphabet is past that letter, and then send them to the correct variable to locate their folder. What I have thus far:
=======
tell application “System Events”
set shortName to name of current user
--Set the next variable using bash to ascertain the sub-folder of the server
set Mark to do shell script "echo $(whoami | cut -c 1)"
set Grp1 to {"a", "c", "e", "g", "i", "k", "m", "o", "q", "s", "u", "w", "y"}
set Grp2 to {"b", "d", "f", "h", "j", "l", "n", "p", "r", "t", "v", "x", "z"}
end tell
set verifyShortName to display dialog “Please verify that your account name is correct” default answer shortName with icon 2 buttons {“Cancel”, “OK”} default button {“OK”}
set shortName to text returned of verifyShortName
if Mark is in Grp1 then
set SubFolder to (Mark & “0” & “1” & “-” & (select (Mark) + 1) & “0” & “1”)
else if Mark is in Grp2 then
set SubFolder to ((select (Mark) - 1) & “0” & “1” & Mark & “0” & “1”)
end if
– Mount the Network Home Directory (U Drive).
tell application “Finder”
try
mount volume “smb://network/” & SubFolder & “$/” & shortName & “/”
end try
end tell
The script fails on finding the next letter (select (Mark) + 1). Is there a way to tell applescript to use the variable Mark and insert the next letter from the alphabetic (and ANSII) order?
Model: MacBook Pro (13-inch, Mid-2012)
AppleScript: 2.3.2
Browser: Safari 537.85.10
Operating System: Other