mas81 Posted December 15, 2011 Share Posted December 15, 2011 (edited) Hello, I have been looking for something to do the below scenario and searched through the forum but all what I have found are scripts that only do one part of the scenario: PC have 3 ways to connect to the internet: 1- GRPS modem (which connect useing a dial up connection) 2- USB Modem (which connect useing a dial up connection) 3- LAN ( which is disabled) When you start the PC the script will be in the windows start up and the following will happen: 1- Dial GRPS connection 2- Launch an application 3- Check connection every 5 minutes through ping / IP address or URL 4- If the connection is up the script will sleep for another 5 minutes then repeat step 3 and keep doing this in a loop 5- If the connection is down the script will disconnect the previous dial up connection and dial USB modem connection 6- Repeat step 3 7- If the connection is down the script will disconnect the previous dial up connection and enable the LAN connection 8- Repeat step 3 9- If the connection is down the script will disable lan connection and dial GPRS connection 10- Repeat step 3 I'm not a programmer but I have found a script here in the forum and tried to make it do the above scenario but with no luck, below is what I have done: ; put the compiled EXE (or a reference to it) in the startup folder. #NoTrayIcon ; disable tray icon. So, no accidential pause can occour Sleep(300000) ; allow 5 minutes boot time. While 1 ; never ending loop Ping("google.com") ; try to reach google. If @error Then Ping("de.pool.ntp.org", 2000) ; try to reach a time server. If @error Then Run("netsh interface set interface ""Local Area Connection"" DISABLE") Run, %COMSPEC% /C rasdial con1,Hide EndIf Sleep(300000) ; Ping("google.com") ; try to reach google. If @error Then Ping("de.pool.ntp.org", 2000) ; try to reach a time server. If @error Then rasdial /disconnect Run, %COMSPEC% /C rasdial con2,Hide EndIf Sleep(300000) ; Ping("google.com") ; try to reach google. If @error Then Ping("de.pool.ntp.org", 2000) ; try to reach a time server. If @error Then rasdial /disconnect Run("netsh.exe interface set interface ""Local Area Connection"" ENABLE") EndIf EndIf WEnd ; merry go round Edited December 15, 2011 by mas81 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now