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
1
u/scrutinizer1 Oct 31 '25
If allowing access and setting the permissions didn't help, try wrapping Scripting Additions commands, such as mount volume, do shell script and display dialog, in
tell application "System Events"...end tell3
u/CaptureJuan Oct 30 '25
Ive not done this in a while, but app(lets) may need permissions depending on how its complied and published. Check Gatekeeper Automation options for the app
1
u/ax-grinder Oct 31 '25
What sort of errors are you seeing? That will help a lot in diagnosing where the script is going wrong outside of Script Editor.
1
u/SvilenOvcharov Nov 01 '25
Try wrapping the script in Shortcuts, with Run AppleScript action.
1
u/roycetech Nov 02 '25
Add some logs to see where it fails
-3
u/Rare_Pin9932 Oct 30 '25
Believe it or not, ChatGPT has helped me with these sorts of things