ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Post New Requests Here

Turn a batch file into an AHK script.

<< < (10/16) > >>

4wd:
If I create a shortcut to any PPTP/L2TP VPN, in 'properties' they all show the same 'target':
{BA126AD7-2166-11D1-B1D0-00805FC1270E}
I cannot find that anywhere, as a device ID, a file name, or a registry key, so what is it?-pilgrim (May 20, 2013, 05:19 AM)
--- End quote ---

It's a CLSID, (Class Identifier), entry in the registry, (look under HKCR\CLSID), for Dial-up Connection Class, ie. the PPTP/L2TP connections are in the same class as dial-up modem connections.

In Network Connections under 'Device Name' all PPTP/L2TP VPN's show 'WAN Miniport'.
Is there a way to 'trigger' from that instead of rasdial?
--- End quote ---

I looked at that, as well as Network Performance data for the network but couldn't seem to separate out the VPN stuff from normal LAN connection traffic.

However, I have a new program I'm playing with that seems like it might work OK - it'll run all the time and just appear when a VPN connection is active, then hide again when it isn't.

Unfortunately, now my Win8 netbook doesn't want to make VPN connections, so the only things I'll have to test it against are WHS2011 and XP x86, (even though it won't be used on XP, it should still work).

pilgrim:
When I get back on 7 I'll have a look for that key because I entered the number into the registry search both with and without the brackets and it never found it?

After you suggested an edit to the batch file for 7 to do away with the flag file I have been trying to do the same for XP but it uses devcon not netsh.  :huh:
Is it possible?

7:
netsh interface show interface "Router Connection" | find /i "disabled" >NUL
if errorlevel 1 goto running

XP:
rem Check if our flag file exists and act accordingly
if exist internet_is_on.txt goto running

(devcon *DEV_001C*)

4wd:
Okey dokey, back with an all new dang-fangled program that may or may not work.

VPN Indicator a.k.a. VIndicator

Works different to PPTPchek, instead of polling rasdial every so often it just sits back and waits to be told what's happening - a side benefit is virtually no processor usage, (>2% on my netbook).

Start it by just double-clicking on the icon, from that point it just runs in the background.  Works on x86 or x64.
If a PPTP/L2TP VPN is active an icon will show, on disconnect it gets hidden.

Stop it by running it again or choosing Exit from the icon menu when it's visible.

What it does:
1) When first run it checks for other instances of itself, if it finds any it tells it to exit and then exits itself.
2) It sets up a Notification Event on the EventLogs and then waits.
3) When an Event is signaled it fetches the data and if it matches the particular source, (RasClient), and EventIDs, (Vista+ = 20225/20226), it does all the icon-y things.

Because most of the time it spends sitting on its bum I'll look at finding where the network stats are hidden and poll them every 250ms or so, so if they change I can just toggle icons to show activity, (that's the theory anyway).

Haven't tested it on XP, (not really required), but it shouldn't do anything nasty - it'll either indicate something or it won't.

PS.


--- Code: Text ---devcon status "*DEV_001C*" | find /i "disabled" >NULif errorlevel 1 goto running rem Enable devicegoto alldone :runningrem disable device :alldone
Update: 0.3.0.30
Changed: No longer requires rasdial.exe to get initial connection
Changed: No longer relies on text within EventLog entry for information
Fixed: If the PC itself runs a VPN server, Event IDs 20267 and 20268 weren't reported.  Now uses Event IDs 20225/20226.
Added: Shows IP in ToolTip

UPDATE: v0.3.0.25
Changed: Logging disabled

v0.3.0.24
Changed: Refined Notification Event which hopefully will reduce load a little
Fixed: Small bug with Quit on Disconnect

v0.3.0.23
Changed: RAS stats polled every 100ms, icon reflects data direction
Changed: Tooltip auto-scales data kB -> PB, removed transfer rate
Removed: Debugging stuff
Added: Windows version check, doesn't run on less than Vista now
Added: Start with Windows option, (HKCU Run)
Added: Checks for Remote Access Service installation - required for MS PPTP/L2TP VPN connections

v0.3.0.20
Fix: Hopefully reports which connection was disconnected rather than username in the log now
Added: Menu item Quit on Disconnection added, setting is saved to .ini for subsequent starts - obviously the icon needs to be visible to select it
Added: Icon toggles if amount of data Rx/Tx changes, only does this every 500ms - any more often increases CPU load
Added: Tooltip shows data Rx/Tx and rate
Maybe: The event checking has been reduced to 2 seconds - CPU load increases the shorter the interval

pilgrim:
Looks good.  :)  I can't change connection at the moment so I'll give it a run later, I just started it up and it showed 0% CPU and slightly under 10MB RAM.
As you say it is not needed in XP.

There is something very weird about that registry key: {BA126AD7-2166-11D1-B1D0-00805FC1270E}
If I search for that in regedit it simply does not appear, if I search for it in a third party program it shows one entry under HKLM and if I tell it to go to the key it opens {BA126AD8-2166-11D1-B1D0-00805FC1270E} ?

Thanks for the devcon script, another one to add to my collection.  :)

4wd:
There is something very weird about that registry key: {BA126AD7-2166-11D1-B1D0-00805FC1270E}
If I search for that in regedit it simply does not appear, if I search for it in a third party program it shows one entry under HKLM and if I tell it to go to the key it opens {BA126AD8-2166-11D1-B1D0-00805FC1270E} ?
-pilgrim (May 22, 2013, 06:28 AM)
--- End quote ---

I just did a search for the first group of characters:

Turn a batch file into an AHK script.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version