I have a simple AppleScript that works perfectly on two ML machines (10.8.3), but when I try to run it on a 10.7.5 machine it doesn't work. To make matters more confusing, in 10.7.5 it runs in the actual editor, but not when I run the application. Again, works fine in editor and as standard app in 10.8.
Here is my script:
set IP_Address to "192.168.0.8" tell application "Finder" try set P_Result to (do shell script "ping -c 1 -q " & IP_Address) if "100% packet loss" is not in P_Result then mount volume "smb://192.168.0.8/Disk1" as user name "pcguest" with password "Abcd" mount volume "smb://192.168.0.8/Disk2" as user name "pcguest" with password "Abcd" mount volume "smb://192.168.0.8/Disk3" as user name "pcguest" with password "Abcd" mount volume "smb://192.168.0.8/Disk4" as user name "pcguest" with password "Abcd" end if end try end tell
I have tried removing the
tell application "Finder" and
end tell but still no luck. I have also tried removing the section to ping server but again no luck. When I double click the app all that happens is that the AppleScript icon keeps jumping, whether I leave it for 5 seconds or 5 minutes. When I click on the icon in dock it disappears. On 10.8, my AppleScript icon appears for a second, mounts the volumes, and goes away.
The error I get when I run within AppleScript editor is a 10004 error but still mounts fine (the error only happens on 10.7 not 10.8).
This is driving me crazy - it's simple script to check to see if server is online. If it is, mount volumes. Simple.
How can I fix my script so that it does what I want it to do?