System Operator Tech Tips

Running EchoLink Scripts With Windows Task Scheduler

By Dennis M. Boyle, KB9RRN

EchoLink comes pre-packaged with several scripts that can be invoked either from the command line, a Windows shortcut, a batch file, or using Windows Task Scheduler.  These allow you to tell the software to connect, disconnect, disconnect from all stations, enable and disable the link, connect to a station when it becomes available, or stay connected to a station.  The scripts are located in two subdirectories of the EchoLink directory, specifically C:\Program Files\K1RFD\EchoLink\scripts and C:\Program Files\K1RFD\EchoLink\scripts\samples if you have a standard Windows EchoLink installation.  Please be advised, the methods detailed on this page only apply to Windows XP and earlier versions of Windows that use the same Task Scheduler as Windows XP does.  Windows 7 and newer versions use a completely different task scheduler and thus will require complete re-engineering of the methods detailed here.

The way I get my node to automatically do all the things it does is by running the scripts as scheduled tasks in Windows XP Task Scheduler.  This way, as long as Windows is running properly, I don’t have to worry about third-party software working (or not working) in order to get my tasks done on time.  The scripts to connect and stay connected to stations will even start EchoLink and run it if it is not already running, then they will connect to your desired station.

In order to be successful at setting up Task Scheduler to set up your EchoLink script tasks, you have to be able to think in a linear chronological fashion.  It might help you to draw out a time line graph to write down what tasks you want to do when, and then set up Task Scheduler from there.  You really don’t want to create a scheduled task that causes DisconnectAll.vbs to run the next minute after Connect.vbs has run to connect you to your desired node, so that’s why I say a time line graph could help you in setting things up if you have trouble visualizing in your head.

First, I’ll show you a basic event that connects my node to a repeater for a net every Sunday night.

Simple Connection Task

Here we have the dialog box for the task in Windows Task Scheduler that tells EchoLink to connect to node AK3J-R.  You can see that I am running the connect.vbs script using cscript.exe, which comes with Windows, and allows you to execute Visual Basic scripts from the command line without actually compiling the Visual Basic script into an executable.  You can see that I’ve typed the complete path to cscript.exe in the “Run” text field (C:\WINDOWS\system32\cscript.exe).  Following cscript.exe I enter the name of the script that I want to execute, namely connect.vbs.  It is important to note that you want to enter the directory (or “folder” in Windows 95 terminology) where the scripts are located in the “Start in” text field, so that Windows knows where to find the connect.vbs script.  Looking back to the “Run” text field, you’ll see that after connect.vbs I’ve entered AK3J-R.  That tells the script exactly which node to connect to.

Make sure you have your credentials set up properly.  The “Run as” text field should automatically populate with whatever user name you’re currently logged in to Windows with, but when initially setting up the task, you may have to set your password in the task so that Windows knows it is authorized to run the task as you.  You can do this by clicking the “Set password...” button.

Simple Connection Task Schedule

Here we have the schedule itself.  Since the net actually starts at 1930 hours (7:30 PM – I use 24-hour time format on all of my machines) I have told the task to connect to AK3J-R at 1929 hours, or 7:29 PM.  This gets my node connected to his node a minute before the net starts, so it doesn’t interfere in any way with the beginning of the net.  This box is pretty self explanatory, so I won’t go into any further detail, since the screen shot pretty much says it all.

After the net is done with, I want my node to disconnect from AK3J-R, as well as dump any and all connections that have been made to it while it was connected to AK3J-R.  So, I use the DisconnectAll.vbs script for that purpose, and execute it using yet another scheduled task in Windows Task Scheduler.  Set it up the same way you would set up the Connect.vbs task.

Disconnect All Task

This is where things start to get a little tricky and complex.  My node does many things throughout the week.  Most of the time, it is connected to K9NZF-R, as it’s primary purpose in life is being a remote site for that repeater system.  I accomplish this by using the StayConnected.vbs script, and execute it so that it stays connected to K9NZF-R.  The problem is, when I want the node to disconnect from K9NZF-R and anything else connected to it, I first have to kill the StayConnected.vbs script.  If you don’t kill the script, StayConnected.vbs is written so that it will run indefinitely.  If you run DisconnectAll.vbs while StayConnected.vbs is running, EchoLink will disconnect from whatever StayConnected.vbs has it connected to, but then reconnect as soon as the timer line in StayConnected.vbs tells it to reconnect.  The beauty of StayConnected.vbs is that it will keep your node connected to another node for an indefinite period of time, and if the connection somehow gets interrupted (internet connectivity loss, the other node’s machine crashes, etc.) it will come back up automatically.  You just have to know how to also automatically stop it before you want to do anything else with your system.

Windows provides for this in a somewhat obscure command that you can use to end a running scheduled task, which StayConnected.vbs is when you run it using a Task Scheduler event.  To illustrate how this works, first, I’m going to show you the event I have set up that keeps my node connected to *SCARS* during regular nets.

Stay Connected Task

So, here, I’ve set up StayConnected.vbs to run just like the Connect.vbs script.  You can see that instead of telling it to connect to a straight vanilla callsign, a –R, or a –L, I’ve told it to connect to the *SCARS* conference server.  But, what happens when the SouthCARS nets are done for the day and its time to reconnect to K9NZF-R? I’ll show you.

First, a scheduled task that I’ve named “KillConnectSCARS” runs to end the scheduled task (“ConnectSCARS”) that is running the StayConnected.vbs script to keep the node connected to the *SCARS* conference.

Stop a Scheduled Task

Here, you can see that in the “Run” text field, I’ve entered the Windows command that ends a scheduled task, followed by the name of the scheduled task event that is to be ended.  In this case, that scheduled task’s name is “ConnectSCARS”.

Exactly one minute later, my DisconnectAll event runs.  It executes the DisconnectAll.vbs script.  This is the actual command that ends the *SCARS* connection.  The connection does not end by default when you use the above command to end the scheduled task.  The script ends, but until you actually run a separate command that tells EchoLink to disconnect, it will stay connected indefinitely unless the connection times out, you lose internet, or whatever.

Disconnect All Task

Exactly one minute after that, my KleerKonnect event runs.  This is the name of the scheduled task that I use to run the StayConnected.vbs script that keeps my node connected to K9NZF-R when a net is not active.

Stay Connected Task

When this event runs, EchoLink connects to K9NZF-R, and stays connected for as long as the scheduled task (and the script run by the scheduled task) is running.

I said earlier that my node automatically connects to several other nodes throughout the week for various nets.  How do I accomplish this?  By setting up multiple schedules in the scheduled tasks!  Here are all the scheduled task run times set up in my ConnectSCARS scheduled task.

Multiple Schedules for the Stay Connected Task

Since this scheduled task is running the StayConnected.vbs script to stay connected to *SCARS* for as long as that script runs, I have to also then set up multiple schedules in the scheduled task that ends the ConnectSCARS task, as shown below.

Multiple Schedules for the End Scheduled Task

Of course, after the ConnectSCARS scheduled task is ended by the command invoked in the KillConnectSCARS scheduled task, I then also have to have multiple occurrences of the DisconnectAll event.  I set up multiple schedules for that, too.

Multiple Schedules for the Disconnect All Task

Note that there are more schedules shown here than in the previous two dialog box screen shots.  This is because in addition to disconnecting my node from *SCARS*, this same task also handles the disconnection from connections made by other scheduled events in Task Scheduler.

Windows Task Scheduler

Here you can see all of the tasks I have scheduled to run in Task Scheduler on my EchoLink node computer.  By the way, this computer also handles the SerialPlayer v1.1 program to play an audio file over EchoLink every half-hour, as well as Universal Trunker and Pro96Com for monitoring the control channels of two different public safety trunked radio systems.  So, it is quite the multitasker!

Here is what you’ll see when the StayConnected.vbs script is run by a scheduled event in Windows Task Scheduler.

Running the StayConnected.vbs Script

The other tasks will run in the same kind of box, but since they aren’t perpetual scripts, you’ll only see the box for as long as the script itself is running.  In most cases, that isn’t very long.

Another interesting tidbit of information you may be interested in knowing is that when you use these scripts to give EchoLink commands, the event is recorded as a “COM Command” in EchoLink’s system log file.

Hopefully this will help you get started.  Remember, linear fashion, and make a time line graph if you have to.  This will help you keep things in their proper order.

Copyright Notice and Legal Disclaimer

© 2001-2016 Dennis M. Boyle - K9NZF Systems

Made in USA.  All rights are reserved.  The views expressed on this site are exclusively the opinion of the author of this site.  No guarantee is made as to their accuracy and/or validity in any way, shape, or form.  This site is not an official representation of any group, institution, corporation, or organization of any sort other than K9NZF Systems and it's associates, and the views expressed on this site do not necessarily reflect or negate the official views of any group, institution, corporation, or organization outside of K9NZF Systems and its associates.  All web pages on this server under this domain name (nwjcra.org) and content therein are protected by this copyright, and are subject to the same limitations set forth in this copyright notice.  Any unauthorized reproduction of material from pages protected by this copyright notice without express written, signed, and notarized permission from the author will result in civil prosecution to the maximum extent of applicable laws of the United States of America.  By loading this page into your web browser, you hereby agree to indemnify and hold harmless the author of this site from any damages, physical or emotional, which may occur directly or indirectly as a result of your viewing this material.  All material on this server copyrighted by K9NZF Systems remains the exclusive property of the author, regardless of possession. By loading this page into your web browser, you hereby signify that you fully agree to abide by the stipulations set forth in this copyright notice.  Private Line, Digital Private Line, PL, and DPL are registered trademarks of Motorola.  EchoLink is a registered trademark of Synergenics, LLC.

The code for this site was written exclusively in Microsoft Notepad.  No HTML authoring or web publishing tools of any sort are used in the maintenance of this site.  This site is best viewed at a minumum resolution of 800x600 pixels with a minumum 16-bit color depth, however it looks best at 1024x768 with 32-bit color, which is what it was designed for.