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/ColPaulR Oct 31 '25
I tried this and System Events works from the script editor, but not from double clicking the applet. When I used osascript main.scpt from within the applet folder structure, it ask me for permissions for "System Events" and when I change the script back to Finder, it asked for permission to "Finder". I see both of those under Settings->Security & Privacy->Privacy->Automation. Osascript works, but doubleclicking the file does not