I have an always on cable connection. Because of the security implications associated with an always on modem I’ve set up two locations thru network preferences called Access and No Access. My applescript gives me the power to connect and disconnect by accessing these 2 network locations.
Here are the applescripts:
1 Main
set net_Con to do shell script “ifconfig en0 | grep ‘status: active’ | awk ‘{print $5, $6}’”
if net_Con = “status: active” then
do shell script “usr/bin/open ‘/Users/XXXXXX/Library/Scripts/ personal/ location/progress bar_Disconnect.app’”
do shell script “scselect ‘No Access’”
else
do shell script “usr/bin/open ‘/Users/XXXXXX/Library/Scripts/ personal/ location/progress bar_Connect.app’”
do shell script “scselect Access”
end if
2 progress bar_Connect
global max, Title
set max to 525 – 8.75 sec
set Title to “Connecting…”
progress_Bar()
on progress_Bar()
tell application “Extra Suites”
ES display progress counting to max top 120 with caption Title
repeat with i from 1 to max
set isCancelled to ES advance progress by 1
if isCancelled = true then exit repeat
end repeat
ES close progress
end tell
end progress_Bar
3 progress bar_Disconnecting
set Title to “Disconnecting…”
set max to 220 – 3.67 sec
progress_Bar()
on progress_Bar()
tell application “Extra Suites”
ES display progress counting to max top 120 with caption Title
repeat with i from 1 to max
set isCancelled to ES advance progress by 1
if isCancelled = true then exit repeat
end repeat
ES close progress
end tell
end progress_Bar
My Problem:
If the progress scripts were included in the main script, as far as I can tell, applescript will wait for the progress bar sub-routine to finish before executing the next command. I wanted the progress bar sub-routine to start and then immediately move to the do shell script “scselect Access”. The only way I could see to do this is keeping them separate.
My Questions:
1 Is there a way to combine all 3 apps into one where the progress bar sub-routine will be activated and then applescript moves on to the next command. As opposed to the sub-routine finishing and then moving on.
2 Can I combine all applescripts into a bundle and how do I do this?