r/applescript • u/ColPaulR • Oct 30 '25
Help with AppleScript
I can run the below code directly from the Script Editor and it runs fine. However, it does not work when I try to run it as an applet. Any suggestions?
set mySSID to (do shell script "system_profiler SPAirPortDataType | awk '/Current Network/ {getline;$1=$1;gsub(\":\",\"\");print;exit}'")
if (mySSID contains "Rounsavall") then
-- display dialog (mySSID & " contains Rounsavall")
set userName to short user name of (system info)
-- display dialog userName
tell application "Finder"
try
mount volume ("smb://" & userName & "@192.168.0.210/Public")
end try
delay 0.5
try
mount volume ("smb://" & userName & "@192.168.0.210/photo")
end try
delay 0.5
try
mount volume ("smb://" & userName & "@192.168.0.210/Movies")
end try
delay 0.5
try
mount volume ("smb://" & userName & "@192.168.0.210/home")
end try
delay 0.5
try
mount volume ("smb://" & userName & "@192.168.0.210/Music")
end try
end tell
else
display dialog (mySSID & " does not contains Rounsavall")
end if
View all comments
Show parent comment
1
u/Intelligent_World412 Nov 01 '25
That's the problem, no errors. It just doesn't work. If I uncomment the display statements, it works. I added delays hoping there was a race condition. I just want to mount the SMB shares by clicking an app vs. having to mount them manually or via script that had to create the directories first and then smbmount to the newly created directories. I'm open to debugging help!