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.

<< < (11/16) > >>

pilgrim:
With 'Match whole string only' ticked it found nothing.
With it unticked it found these:

HKEY_CURRENT_USER\Software\Microsoft\Virtual PC\VPCVApps\Windows XP Mode\8eaecac8.Windows.XP.Mode - AppPath - file:%7BBA126AD7-2166-11D1-B1D0-00805FC1270E%7D
HKEY_USERS\S-1-5-21-1575597446-1753356474-449700370-1000\Software\Microsoft\Virtual PC\VPCVApps\Windows XP Mode\8eaecac8.Windows.XP.Mode - AppPath - file:%7BBA126AD7-2166-11D1-B1D0-00805FC1270E%7D

pilgrim:
VIndicator is synching perfectly with a VPN and only time the icon hung was when I was using a batch file to shut it down, adding any of the tray cleaning programs gets rid of it as unlike PPTPchek it was only the icon and not the program that was hanging. When run permanently this never happened.  :Thmbsup:

If I am not mistaken there is a 5 second delay before the icon appears once the VPN connects, could that be reduced to say 2 seconds?

For my own uses I don't like the idea of the program running when a VPN is not connected so I have been doing a bit of experimenting.
I have set up a scheduled task as I did with PPTPchek and that solves the start-up nicely.  :)
If I am changing between one PPTP/L2TP VPN and another there is no point in shutting the actual program down as it would only be restarted.
If I am changing from PPTP/L2TP to OpenVPN I need to stop and restart the main connection in any event so I have added VIndicator to the main batch file which shuts the program down and gets rid of the icon, as well as shutting down any PPTP/L2PT connection that is enabled.

It would be nice if there was a way for the program to close on VPN disconnect but not essential. As you said it uses very little in the way of resources, while I've been testing it has been using between 1.4 & 1.7MB of RAM, it tends to drop to near the lower figure when nothing has changed for a while and with my i5 it is not showing any CPU usage at all.  :)
If you can get the icons to indicate activity it would be a bonus but indicating connection status was the main object and it is already doing that.

I will leave this where it is for the moment in case you come up with any different versions, once you think you've got as far as you're going I'll move it on to the system partition.

The only thing I am not certain about is the log, it's picking up login details. Not something I would want lying about if there was more than one user on a computer.
I am adding a sequence from it with those details removed but you can see where they were:

### VPN Indicator Log ###

2013-05-22  16:25:59  (0001)  Program start
2013-05-22  16:26:01  OS Version: WIN_7 Build: 7601 CPUScore: 9.9
2013-05-22  16:26:01  (0002)  GetState: VPN - US
2013-05-22  16:27:49  (0004)  Disconnected: 'PASSWORD'!

2013-05-22  16:28:48  (0001)  Program start
2013-05-22  16:28:51  OS Version: WIN_7 Build: 7601 CPUScore: 9.9
2013-05-22  16:28:51  (0002)  GetState: VPN - US

2013-05-22  16:33:13  (0001)  Program start
2013-05-22  16:33:16  OS Version: WIN_7 Build: 7601 CPUScore: 9.9
2013-05-22  16:33:16  (0002)  GetState: VPN - US

2013-05-22  16:34:06  (0001)  Program start
2013-05-22  16:34:08  OS Version: WIN_7 Build: 7601 CPUScore: 9.9
2013-05-22  16:34:08  (0002)  GetState: VPN - US

2013-05-22  16:34:39  (0001)  Program start
2013-05-22  16:34:42  OS Version: WIN_7 Build: 7601 CPUScore: 9.9
2013-05-22  16:34:42  (0002)  GetState: VPN - US

2013-05-22  16:35:36  (0001)  Program start
2013-05-22  16:35:39  OS Version: WIN_7 Build: 7601 CPUScore: 9.9
2013-05-22  16:35:39  (0002)  GetState: VPN - US

2013-05-22  16:52:10  (0001)  Program start
2013-05-22  16:52:12  OS Version: WIN_7 Build: 7601 CPUScore: 9'9
2013-05-22  16:52:12  (0002)  GetState: VPN - UK
2013-05-22  16:52:40  (0004)  Disconnected: 'PASSWORD'!
2013-05-22  16:53:16  (0003)  Connected: VPN - US
2013-05-22  17:11:22  (0004)  Disconnected: 'PASSWORD'!
2013-05-22  17:12:02  (0003)  Connected: VPN - US
2013-05-22  17:17:20  (0004)  Disconnected: 'PASSWORD'!
2013-05-22  17:17:30  (0003)  Connected: VPN - US
2013-05-22  17:21:09  (0004)  Disconnected: 'PASSWORD'!
2013-05-22  17:21:24  (0003)  Connected: L2TP - US
2013-05-22  17:22:01  (0004)  Disconnected: 'USER ID'!
2013-05-22  17:22:15  (0003)  Connected: L2TP - US
--- End quote ---

4wd:
f I am not mistaken there is a 5 second delay before the icon appears once the VPN connects, could that be reduced to say 2 seconds?-pilgrim (May 22, 2013, 11:50 AM)
--- End quote ---

The time the icon is displayed is within a second or so of VIndicator receiving the Event Norification, so this might come down to the host machine generating an absolute sh*tload of events for some reason.
I can try and make my Notification hook a bit more discriminatory but can you do VIndicator.exe /debug, do a connection then disconnection, wait 30 seconds, exit VIndicator and send me the log.

NOTE: Remove any password/username but please leave the line they appeared on.

EDIT: I've shortened the interval, (at least I think I have), so don't bother with the debug output.

It would be nice if there was a way for the program to close on VPN disconnect but not essential.
--- End quote ---

That's easy enough.

If you can get the icons to indicate activity it would be a bonus....
--- End quote ---

Discovered at 0200 last night...I really should stop taking the netbook to bed :)

The only thing I am not certain about is the log, it's picking up login details. Not something I would want lying about if there was more than one user on a computer.
--- End quote ---

Now that's just plain wrong.....your event texts must be different from what I get.  That it's apparently happening on Disconnect is even stranger as the password wasn't in any event I received.

Hmmm......maybe there's a difference when the connection is initiated via CLI.....have to check that but it still seems contrary to MS' MSDN docs unless I misread something, (wouldn't be the first time :D ).

EDIT: Mea culpa  :-[  Was getting wrong line on disconnect, however, password is never reported in disconnection event so I can only think that for some of your VPNs the password is the same as the username, (which I was mistakenly getting).

BTW, how is it you have a CPUScore of 9.9 ?

Maximum is supposed to be 7.9, have you been fudging the figures  >:(  ;D

UPDATE up there
Fix: Hopefully reports which connection was disconnected rather than username in the log now
Added: Menu item Quit on Disconnect 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

About the only changes I'd make now, (barring bugs - that's squashing not adding), is refine the Tx/Rx icon toggling so it only happens after a set amount of data has been transferred and autoscale the data measurement, (ie. kB, MB, etc).

pilgrim:
OK, it looks like we are down to some small refinements if they are possible.  :)

I am looking at this from two points of view, the first is my own as someone who is happy to play with batch files and scheduled tasks etc, the second, which is more important, is from the point of view of making it more widely available (via my VPN provider friend) to people who just want something that works, I will concentrate on the second point of view.

When I have the VIndicator icon showing it is next to the NAI icon which I suspect is a position that many people who used both programs would choose, (given the fact that there are no network icons in Windows 7 at all I think it likely that people with PPTP/L2TP VPN's would use both) so it is impossible not to compare what they are showing/doing.
Taking what it shows on mouse-over first: NAI shows just three items: connection name, Sent and Received (totals). Transmission speeds are not really necessary in what is basically a status indicator.

NAI makes use of all 4 icons in that icon group in the same way that XP does, in particular when the connection is idle both parts of the icon go dark, in VIndicator one or other parts of it is always bright, if you are using this as a straight toggle between traffic/no traffic it would look better if you used a completely/partly bright icon with the completely dark icon as it would give a more accurate representation, if of course you could incorporate all 4 icons it would be even better and I am guessing that as you are now able to show traffic statistics that might well be possible.  :-\


Moving on to some of the things I mentioned yesterday: The start-up delay on the icon is down to just over 3 seconds so whatever you did shortened it.

The only identifying information now showing in the log file is the connection name.  :)

The 'Quit on Disconnect' works perfectly but I have been thinking about people setting it and then wondering why, the next time they start a VPN it doesn't show.  :huh:
While I think it is a feature worth leaving in it might be better if the option was hidden from the icon and the exe placed in a ZIP file with a short Readme?  :-\
The Readme could contain details about how to run the program at system start-up and how to create the .ini file to run the auto shutdown option if required, while pointing out that once shut down it would need to be manually restarted. To remove the option they simply delete the .ini file.

EDIT: Thinking about it a Readme could also contain brief details about how to set it up as a scheduled task so it would be fully automatic. I was thinking about putting this information on my friends website but if it was included with the program as well it would probably be better.

I really should stop taking the netbook to bed :)
--- End quote ---

Reminds me of when I used to be awake half the night designing circuit diagrams in my head.  :o

BTW, how is it you have a CPUScore of 9.9 ?
--- End quote ---

You obviously have a very advanced logging system, it picks up Windows 8 scores on a Windows 7 computer.  :D

Maximum is supposed to be 7.9, have you been fudging the figures  >:(  ;D
--- End quote ---

Who me?

4wd:
NAI makes use of all 4 icons in that icon group in the same way that XP does, in particular when the connection is idle both parts of the icon go dark, in VIndicator one or other parts of it is always bright, if you are using this as a straight toggle between traffic/no traffic it would look better if you used a completely/partly bright icon with the completely dark icon as it would give a more accurate representation, if of course you could incorporate all 4 icons it would be even better and I am guessing that as you are now able to show traffic statistics that might well be possible.  :-\-pilgrim (May 23, 2013, 08:35 AM)
--- End quote ---

Possible, yes, but at the cost of increased resource usage.  At the moment it polls the RAS statistics every 500ms and being an interpreted language I strongly suspect if I did it more often, like every 100ms, (which I believe NAI is), then there'll be an attendant rise in CPU usage - it might be excessive....but I'll have a play.

The 'Quit on Disconnect' works perfectly but I have been thinking about people setting it and then wondering why, the next time they start a VPN it doesn't show.  :huh:
While I think it is a feature worth leaving in it might be better if the option was hidden from the icon and the exe placed in a ZIP file with a short Readme?  :-\
The Readme could contain details about how to run the program at system start-up and how to create the .ini file to run the auto shutdown option if required, while pointing out that once shut down it would need to be manually restarted. To remove the option they simply delete the .ini file.
--- End quote ---

No offense, but you were talking about people who couldn't write a batch file - an ini file falls into the same category AFAIAC.

There's nothing simpler than selecting a menu item and letting the program take care of the rest.

The readme could just as easily contain a FAQ:

Q: Where's the icon?
A: Run the program.

Besides which it defaults to always running, they'd only have to delete the ini file to restore it to that if they mistakenly select the option - no editing of ini files required.

I might add a Start with Windows option just for giggles too :D

EDIT: Thinking about it a Readme could also contain brief details about how to set it up as a scheduled task so it would be fully automatic. I was thinking about putting this information on my friends website but if it was included with the program as well it would probably be better.
--- End quote ---

I was thinking I'll let you write it  ;)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version