If you have actions that need to wait until you are connected to the Internet, not just the Wi-Fi network, you can use this:
[MODERATOR's NOTE:  This is an Action, not a Macro.  If you double-click on it after downloading, it will be inserted into your current Macro that is open for editing, without any notice.]
Execute a Shell Script.kmactions (818 B)
as the first step, and it will wait until you are connected before any of the rest of the steps are taken.
I set the timeout to 1 minute. Adjust to your wishes.
             
            
              
              
              1 Like
            
                
           
          
            
            
              
Thanks for sharing.
I need a bit of clarification.
- Does it require wifi?  I have a ethernet connection.
 
- What are the units of the numbers?  Minutes?
 
- Where is the timeout set?
- You said you set it to 1 minute, but it looks like 5 to me.
 
 
- What is the reliability of the site 
ipinfo.io ?
- How did you pick it?
 
- Other good choices?
 
 
             
            
              
              
              
            
           
          
            
            
              Hi JMichaelTX
Good questions. I was in a bit of a rush when I posted this, so I didn't do a very good job of explaining it. Let me see if I can address your questions.
- 
It should not matter what kind of connection you have, Ethernet, Wi-Fi, or other. All this does is check that you can connect to an external website somehow.
 
- 
The “sleep 5” means “wait 5 seconds”. Since this is a “while” loop, it will run again once the “sleep” expired. Similarly, the '5's in the curl command also mean seconds.
 
- 
The timeout I set was for the Keyboard Maestro macro itself, by using the “Set Action Timeout” option in Keyboard Maestro’s Editor.
 
- 
a) I have used ipinfo.io to check my external IP for years. I picked it because it’s actually even faster than I page I made for the same purpose.
 
- 
b) There are lots of good choices, I suppose. Trying to connect to google.com or apple.com would work too, but I chose ipinfo.io because it actually gives some useful information (your external IP) when you do connect.
 
I hope that helps!
Tj
             
            
              
              
              3 Likes