I just tried it again and the icon is flashing between different colours and a cross, I opened Network Connections and the VPN that this is set up for shows no indication of trying to connect.-pilgrim
If it's flashing between an icon and a red cross that means the script is paused, ie. you clicked the RMB on it and the default AutoIt action is to bring up the
Script Paused/Exit menu - just right-click it again and choose
Script Paused to unpause.
The ON files contain the name of the VPN as well as username and password so each one is specific to a single VPN server, therefore I am going to need a different ON file for each VPN server, although I have no intention of creating files for all of them at the last count there were 40+.
This also means that I will need a separate X batch file for each one and that in turn means that I need separate scripts or apps to trigger the various X batch files as the path will be different for each one.
It sounds more like you need a decent Network Connection Manager but let's see if I can reduce the number of batch files required without doing much of anything

The way you've described it you need one "X" batch file for every ON batch file, is this correct?
The "X" batch file is there for the sole purpose of setting/deleting a flag file and choosing which of the following two, (ON or OFF), batch files to run based on the (non)existence of the flag file.
However, if you move the conditional test to the ON and OFF batch files there's no need for the "X" batch files at all.
Now you only need one ON batch file for each connection and the OFF batch file.
eg. The first few lines of each ON batch file would be:
if not exist pptp-running.txt goto startvpn
REM prog is already running
start /D "C:\Batch Files\PPTP ON-OFF" PPTP-OFF.bat
goto alldone
:startvpn
REM prog is not running
copy NUL>pptp-running.txt
VPN connection commands
:alldone
For the OFF batch file, (PPTP-OFF.bat), the first few lines would be:
if not exist pptp-running.txt goto alldone
del pptp-running.txt
VPN disconnection commands
:alldone
Running any ON batch file with an already established connection would cause disconnection, so in effect every ON file becomes an OFF file if there is a connection.
If we add in a little program, (see below), that throws an icon into the SysTray when run and optionally runs the OFF batch file when clicked then all you require would be a program launcher, (Launchy, FARR, etc), to choose which ON batch file you want to run.
Would not this be easier?
NetConnected is a small program that will put an icon into your SysTray and then just sit there. It takes one optional argument, a file to run when you click on it with the LMB or choose Exit from its menu - the file will then execute and NetConnected will exit.
eg. NetConnected.exe "C:\Batch Files\PPTP-OFF.bat"
If you run NetConnected without arguments then it will terminate any previous running instance then exit. You can also rename the executable to anything you like, it will still work. (I chose a generic network icon for it but if you want something else let me know - I might see if I can get it to change according to a supplied country code or icon.)
So your ON files would become:
if not exist pptp-running.txt goto startvpn
REM prog is already running
start /D "C:\Batch Files\PPTP ON-OFF" PPTP-OFF.bat
goto alldone
:startvpn
REM prog is not running
copy NUL>pptp-running.txt
VPN connection commands
NetConnected.exe "C:\Batch Files\PPTP-OFF.bat"
:alldone
And you could add it to the OFF file:
if not exist pptp-running.txt goto alldone
del pptp-running.txt
VPN disconnection commands
:alldone
NetConnected.exe
Is that any better?