topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Tuesday March 19, 2024, 12:53 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Last post Author Topic: Turn a batch file into an AHK script.  (Read 55628 times)

pilgrim

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 316
  • Cogito ergo ?
    • View Profile
    • Pilgrim's Page
    • Donate to Member
Re: Turn a batch file into an AHK script.
« Reply #50 on: May 22, 2013, 07:05 AM »
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
I spent 25 years training to be an eccentric then I woke up one morning and realised that I'd cracked it.
I've not had to try since.

I wonder what happens if I click on thi

pilgrim

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 316
  • Cogito ergo ?
    • View Profile
    • Pilgrim's Page
    • Donate to Member
Re: Turn a batch file into an AHK script.
« Reply #51 on: May 22, 2013, 11:50 AM »
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

I spent 25 years training to be an eccentric then I woke up one morning and realised that I'd cracked it.
I've not had to try since.

I wonder what happens if I click on thi

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,640
    • View Profile
    • Donate to Member
Re: Turn a batch file into an AHK script.
« Reply #52 on: May 22, 2013, 07:01 PM »
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?

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.

That's easy enough.

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

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.

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).
« Last Edit: May 23, 2013, 01:52 AM by 4wd »

pilgrim

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 316
  • Cogito ergo ?
    • View Profile
    • Pilgrim's Page
    • Donate to Member
Re: Turn a batch file into an AHK script.
« Reply #53 on: May 23, 2013, 08:35 AM »
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 :)

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 ?

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

Who me?
I spent 25 years training to be an eccentric then I woke up one morning and realised that I'd cracked it.
I've not had to try since.

I wonder what happens if I click on thi
« Last Edit: May 23, 2013, 08:45 AM by pilgrim »

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,640
    • View Profile
    • Donate to Member
Re: Turn a batch file into an AHK script.
« Reply #54 on: May 23, 2013, 09:07 AM »
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.  :-\

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.

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.

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

pilgrim

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 316
  • Cogito ergo ?
    • View Profile
    • Pilgrim's Page
    • Donate to Member
Re: Turn a batch file into an AHK script.
« Reply #55 on: May 23, 2013, 10:04 AM »
No offence, but you were talking about people who couldn't write a batch file - an ini file falls into the same category AFAIAC.
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.

Taking the first part of your comment I think in this case the ini file is much easier, a single entry regardless of system and put it in the same folder as the exe.  8)
I hadn't got as far as specific details but your comments make sense, so you I just explain how to set it and how to delete the file.
Seems like the same thing approached from opposite directions. (Could be something to do with geolocation?)  ;D

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

All the programs I run at start up have that option turned off if they have it, I put everything into HKLM - Run rather than HKCU.

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

I was expecting to have to put something together anyway so that's not a problem.  :)
I spent 25 years training to be an eccentric then I woke up one morning and realised that I'd cracked it.
I've not had to try since.

I wonder what happens if I click on thi

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,640
    • View Profile
    • Donate to Member
Re: Turn a batch file into an AHK script.
« Reply #56 on: May 23, 2013, 09:08 PM »
All the programs I run at start up have that option turned off if they have it, I put everything into HKLM - Run rather than HKCU.

I'm thinking of the people who don't edit the registry, don't set Scheduled Tasks and don't put shortcuts in the Startup menu.

You're probably on a single user system, others might not be and thus prefer a per user basis, anyway, costs nothing to put it in..........so far  >:D

Which reminds me I need to see what happens when UAC is turned on.

Turns out polling RAS stats at 100ms didn't increase CPU by much at all, still around 2% or less on my Neo N40L server.  Drops to 0% when no VPN active but mem use seems to stay at around 9-10MB.
« Last Edit: May 23, 2013, 09:19 PM by 4wd »

pilgrim

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 316
  • Cogito ergo ?
    • View Profile
    • Pilgrim's Page
    • Donate to Member
Re: Turn a batch file into an AHK script.
« Reply #57 on: May 24, 2013, 03:37 AM »
I'm thinking of the people who don't edit the registry, don't set Scheduled Tasks and don't put shortcuts in the Startup menu.

Why does that sound familiar?  :tellme:

Which reminds me I need to see what happens when UAC is turned on.

The OS takes over the machine?  ;D

Drops to 0% when no VPN active but mem use seems to stay at around 9-10MB.

That was what I got the first time I ran it, after that it settled at around 1.5MB.
I spent 25 years training to be an eccentric then I woke up one morning and realised that I'd cracked it.
I've not had to try since.

I wonder what happens if I click on thi

pilgrim

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 316
  • Cogito ergo ?
    • View Profile
    • Pilgrim's Page
    • Donate to Member
Re: Turn a batch file into an AHK script.
« Reply #58 on: May 24, 2013, 10:57 AM »
I just tried the devcon script for XP in reply 47, the cmd window flashes but nothing else happens, I suspect it is jumping straight to alldone because none of the programs in the main batch file are trying to open.  :huh:
I spent 25 years training to be an eccentric then I woke up one morning and realised that I'd cracked it.
I've not had to try since.

I wonder what happens if I click on thi

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,640
    • View Profile
    • Donate to Member
Re: Turn a batch file into an AHK script.
« Reply #59 on: May 25, 2013, 06:16 AM »
I just tried the devcon script for XP in reply 47, the cmd window flashes but nothing else happens, I suspect it is jumping straight to alldone because none of the programs in the main batch file are trying to open.  :huh:

I'm afraid you're going to have to do better than that, being an ex-tech I want want to know every little thing you tried without me asking for it....including the obvious things like typing devcon status "*DEV_001C*" in a CLI and you telling me what it says both with and without the interface disabled.

In the meantime: VIndicator 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

pilgrim

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 316
  • Cogito ergo ?
    • View Profile
    • Pilgrim's Page
    • Donate to Member
Re: Turn a batch file into an AHK script.
« Reply #60 on: May 25, 2013, 06:54 AM »
I'm afraid you're going to have to do better than that, being an ex-tech I want want to know every little thing you tried without me asking for it....including the obvious things like typing devcon status "*DEV_001C*" in a CLI and you telling me what it says both with and without the interface disabled.

Strewth Guv, gi's a break I'm only a beginner. You call that obvious? Thank God we're not into difficult stuff.  :D


Thanks for the update, the details look interesting.

I'll get back to you on both.
I spent 25 years training to be an eccentric then I woke up one morning and realised that I'd cracked it.
I've not had to try since.

I wonder what happens if I click on thi

pilgrim

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 316
  • Cogito ergo ?
    • View Profile
    • Pilgrim's Page
    • Donate to Member
Re: Turn a batch file into an AHK script.
« Reply #61 on: May 25, 2013, 08:35 AM »
VIndicator v0.3.0.23

CPU - 0-2%, only briefly hit 2% once, 1% flashed up every few seconds the rest of the time 0%.
RAM - 1st 3 minutes 10MB. Next 3 minutes slowly dropped to 2.7MB. Following 3 minutes slowly dropped to 2.2MB and stabilised.
These readings are rounded up or down slightly but seemed to ignore what was going on in terms of traffic.

Icons - All 4 of them showed depending on traffic, the one for connection idle and the one for combined traffic up and down seemed to respond quicker than the other two based on what Networx was showing at the time.
I have long had a suspicion that although Networx is set to ignore LAN traffic both it and NAI, which is set for the router, are actually picking up other things which might account for them being slightly out of synch with the VIndicator icons.

I never tried the options in the context menu as I still have the Scheduled Task set up to enable it and the main batch file to shut it down, if you want I will try them another time but I am sure they will work.
The auto-scaling works fine but I was surprised you had abbreviated 'Received', as in my case the connection name is the longest line in the pop-up the full word would not have made it any larger.

It looks like you have a winner.  :Thmbsup:
I spent 25 years training to be an eccentric then I woke up one morning and realised that I'd cracked it.
I've not had to try since.

I wonder what happens if I click on thi

pilgrim

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 316
  • Cogito ergo ?
    • View Profile
    • Pilgrim's Page
    • Donate to Member
Re: Turn a batch file into an AHK script.
« Reply #62 on: May 26, 2013, 03:52 AM »
devcon status CLI results:

Connection Enabled:

C:\Documents and Settings\Pilgrim>devcon status *DEV_001C*
PCI\VEN_168C&DEV_001C&SUBSYS_E00C105B&REV_01\4&192AC53F&0&00E0
    Name: Atheros AR5007EG Wireless Network Adapter
    Driver is running.
1 matching device(s) found.

Connection Disabled:

C:\Documents and Settings\Pilgrim>devcon status *DEV_001C*
PCI\VEN_168C&DEV_001C&SUBSYS_E00C105B&REV_01\4&192AC53F&0&00E0
    Name: Atheros AR5007EG Wireless Network Adapter
    Device is disabled.
1 matching device(s) found.
I spent 25 years training to be an eccentric then I woke up one morning and realised that I'd cracked it.
I've not had to try since.

I wonder what happens if I click on thi

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,640
    • View Profile
    • Donate to Member
Re: Turn a batch file into an AHK script.
« Reply #63 on: May 26, 2013, 05:54 AM »
Code: Text [Select]
  1. devcon status "*DEV_001C*" | find /i "disabled" >NUL
  2. if errorlevel 1 goto running

You forgot the 1 didn't you?











pilgrim

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 316
  • Cogito ergo ?
    • View Profile
    • Pilgrim's Page
    • Donate to Member
Re: Turn a batch file into an AHK script.
« Reply #64 on: May 26, 2013, 06:05 AM »
Code: Text [Select]
  1. devcon status "*DEV_001C*" | find /i "disabled" >NUL
  2. if errorlevel 1 goto running

You forgot the 1 didn't you?


Who moi?  :o

Actually no, I noticed it was missing the first time when I compared it to other scripts I have a note of.  :P

Still didn't work.  :(
I spent 25 years training to be an eccentric then I woke up one morning and realised that I'd cracked it.
I've not had to try since.

I wonder what happens if I click on thi

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,640
    • View Profile
    • Donate to Member
Re: Turn a batch file into an AHK script.
« Reply #65 on: May 26, 2013, 07:05 AM »
devcon status "*DEV_001C*" | find /i "disabled"

So what does the above produce for enabled/disabled?

And what does this output:
Code: Text [Select]
  1. devcon status "*DEV_001C*" | find /i "disabled" >NUL
  2. if errorlevel 1 goto running
  3. echo disabled
  4. goto alldone
  5. :running
  6. echo enabled
  7. :alldone
  8. pause

pilgrim

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 316
  • Cogito ergo ?
    • View Profile
    • Pilgrim's Page
    • Donate to Member
Re: Turn a batch file into an AHK script.
« Reply #66 on: May 26, 2013, 07:18 AM »
You're Famous!:

1.jpg  :Thmbsup:

I'll check the script out when I'm next using the Netbook.  :)
I spent 25 years training to be an eccentric then I woke up one morning and realised that I'd cracked it.
I've not had to try since.

I wonder what happens if I click on thi

pilgrim

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 316
  • Cogito ergo ?
    • View Profile
    • Pilgrim's Page
    • Donate to Member
Re: Turn a batch file into an AHK script.
« Reply #67 on: May 28, 2013, 09:16 AM »
devcon status "*DEV_001C*" | find /i "disabled"

So what does the above produce for enabled/disabled?

enabled: Nothing!
disabled: Device is disabled

And what does this output:
Code: Text [Select]
  1. devcon status "*DEV_001C*" | find /i "disabled" >NUL
  2. if errorlevel 1 goto running
  3. echo disabled
  4. goto alldone
  5. :running
  6. echo enabled
  7. :alldone
  8. pause

C:\Documents and Settings\Pilgrim\My Documents\Received Files>
devcon status "*DEV_001C*"   | find /i "disabled"  1>NUL
The process tried to write to a nonexistent pipe.
The process tried to write to a nonexistent pipe.
The process tried to write to a nonexistent pipe.
The process tried to write to a nonexistent pipe.
The process tried to write to a nonexistent pipe.
The process tried to write to a nonexistent pipe.
The process tried to write to a nonexistent pipe.
The process tried to write to a nonexistent pipe.
The process tried to write to a nonexistent pipe.
The process tried to write to a nonexistent pipe.
The process tried to write to a nonexistent pipe.
The process tried to write to a nonexistent pipe.
The process tried to write to a nonexistent pipe.
The process tried to write to a nonexistent pipe.
The process tried to write to a nonexistent pipe.
The process tried to write to a nonexistent pipe.
The process tried to write to a nonexistent pipe.

I'm attaching a copy of the full script I'm running in case it is of use:

I spent 25 years training to be an eccentric then I woke up one morning and realised that I'd cracked it.
I've not had to try since.

I wonder what happens if I click on thi

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,640
    • View Profile
    • Donate to Member
Re: Turn a batch file into an AHK script.
« Reply #68 on: May 28, 2013, 11:24 PM »
Your XP installation doesn't seem able to accept pipes within a batch file for some reason - you have a problem.

XP did have a known problem with STDIN/STDOUT but it was supposedly fixed in SP1.

Apart from trawling the net, not sure I can tell you what's wrong since it works fine here on both physical and virtual XP setups.  The only thing I can think of is that the output from devcon is appearing faster than the system is able to set up a pipe to find or vice versa.

You could try disabling any AV you have running just in case that is causing a delay due to scanning the system executables, (you could try excluding devcon and find from the AV).

You could also try substituting findstr for find, (probably won't make a difference but who knows): devcon status "*DEV_001C*" | findstr /i "disabled" >NUL

In the meantime a small update to VIndicator, that'll be it until I read up a bit more on Dll calls, (which are extremely confusing), to get rid of the rasdial dependency.

pilgrim

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 316
  • Cogito ergo ?
    • View Profile
    • Pilgrim's Page
    • Donate to Member
Re: Turn a batch file into an AHK script.
« Reply #69 on: May 29, 2013, 04:15 AM »
The Netbook is pretty slow which is why 'sleep' was added between the 'start' items, and because Peerblock always tries to check everything when it starts, its icon still opens several seconds after the connection is made.

If devcon's speed was an issue surely that would affect my existing batch file as well?

I don't think the AV is affecting things as I was trying the script out after the computer had been running for some time and according to the Task Manager nearly all the CPU usage was on the System Idle Process and the AV wasn't showing any.

Don't waste any more time on it unless you want to, the batch file in my last post works every time, all I was trying to do was loose the flag file anyway.  :)


Thanks for the update to VIndicator, I was intending to ask you today if it was ready for a wider audience yet?
I also have a couple of other questions about it:

You have mentioned before about getting away from its dependency on rasdial but as the most recent versions have proved reliable is there any particular reason for doing so?

Log files: When I moved the latest update into the folder I am running it from I noticed that it is creating a separate log file for each day that it is run, they are I admit only 1kb each but is there any built in limit to their number?
If not, once you decide you have gone as far as you can with the program and do not need possible debug information any more will there be an actual need for them?
I spent 25 years training to be an eccentric then I woke up one morning and realised that I'd cracked it.
I've not had to try since.

I wonder what happens if I click on thi

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,640
    • View Profile
    • Donate to Member
Re: Turn a batch file into an AHK script.
« Reply #70 on: May 29, 2013, 08:12 AM »
The Netbook is pretty slow which is why 'sleep' was added between the 'start' items, and because Peerblock always tries to check everything when it starts, its icon still opens several seconds after the connection is made.

That doesn't explain why it works from the CLI but not in the batch file.  If it's fast enough to create the needed pipe in the CLI, it should be able to do it within a batch file.

There's some other weird and wonderful Windows magic at work.

If devcon's speed was an issue surely that would affect my existing batch file as well?

Nope, you're not relying on its output for anything, in fact you have no error checking on any of the commands in your batch script, so if, say, the devcon command failed to (dis|en)able the interface the batch file would happily continue.

I was intending to ask you today if it was ready for a wider audience yet?

If it hasn't formatted your drive yet or caused the sun to go supernova then I guess so.  :)

You have mentioned before about getting away from its dependency on rasdial but as the most recent versions have proved reliable is there any particular reason for doing so?

I don't want to rely on the output from a CLI command that may or may not be executed or that may or may not throw an error when executed. 

If you start it after a VPN connection and it can't run rasdial or rasdial throws an error then it won't show the tray icon, I don't particularly want to sit in a loop until I get a valid output.

It'd be a lot easier to get the information direct from the horses mouth, so to speak, the same place rasdial gets it from.
Plus I have a long term motive for wanting to hit the dll directly, I want to get all information direct from the Remote Access Service rather than wait for things to show up in the EventLog.

Log files: When I moved the latest update into the folder I am running it from I noticed that it is creating a separate log file for each day that it is run, they are I admit only 1kb each but is there any built in limit to their number?

Nope, just something I thought might be useful - I was going to have it put the data usage against each session but....

If not, once you decide you have gone as far as you can with the program and do not need possible debug information any more will there be an actual need for them?

Nope except purely as a statistical source if anyone wants them.  Maybe I'll stop it creating them unless a certain magic word is enabled, (possibly /rumpelstiltskin or something).

pilgrim

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 316
  • Cogito ergo ?
    • View Profile
    • Pilgrim's Page
    • Donate to Member
Re: Turn a batch file into an AHK script.
« Reply #71 on: May 29, 2013, 09:11 AM »
My drives are all still working and the sun has disappeared (yet again) but I don't think that was your fault.  :D

If you start it after a VPN connection and it can't run rasdial or rasdial throws an error then it won't show the tray icon

If VIndicator is run at start-up or as I have it set as a scheduled task is that not avoided?
If rasdial does not run would that not prevent a VPN from connecting, at least in the way that I am using it?  :tellme:
Just trying to understand the technicalities.

The log files are not a big issue, several of the disk cleaning programs I use get rid of them without my changing anything.

Whenever I see log files I am reminded of a weather program I used before I started using sWeather, every time it checked for a change in conditions it created a separate log file, as it ran all the time and checked frequently by the time I discovered what was happening I had quite literally hundreds of them, if I remember correctly they were quite a bit bigger than yours and for some reason all my cleaning programs were ignoring them?

I appreciate there is quite a lot of information that can be picked up from a connection but how often do people check it.
When you started helping me with this I looked at the information that is available through the context menu of NAI, I had never looked at it before and I have never looked at it since.
Mind you, if I do want any usage information I can get it from Networx.

Having logging as an option sounds like a very good idea, I might not use it but I'm sure that some people would.

Personally I'm a great believer in simplicity (there are those who would say I had a head start on everybody else) and I was trying not to complicate things for you.  :)
I spent 25 years training to be an eccentric then I woke up one morning and realised that I'd cracked it.
I've not had to try since.

I wonder what happens if I click on thi

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,640
    • View Profile
    • Donate to Member
Re: Turn a batch file into an AHK script.
« Reply #72 on: May 30, 2013, 04:14 AM »
If VIndicator is run at start-up or as I have it set as a scheduled task is that not avoided?

At startup: Possibly, depends whether a VPN  is set to connect on Windows start and whether that happens before or after startup items get executed.

Scheduled Task: Always after the event since the event has to occur for the Task to trigger.

If rasdial does not run would that not prevent a VPN from connecting, at least in the way that I am using it?

I'm not talking about rasdial failing every time, just the time I want, (VIndicator), to use it.

pilgrim

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 316
  • Cogito ergo ?
    • View Profile
    • Pilgrim's Page
    • Donate to Member
Re: Turn a batch file into an AHK script.
« Reply #73 on: May 30, 2013, 05:13 AM »
I'm not talking about rasdial failing every time, just the time I want, (VIndicator), to use it.

Sorry, looking at it this morning I realise I was thinking back to when I was using a separate batch file to run each VPN and using rasdial to start them.
The only place that rasdial appears in a batch file now is in the main Internet Toggle file as 'rasdial disconnect', to shut down any PPTP/L2TP VPN that might be running.

I also realised that using VIndicator the VPN's do not require any separate batch files so I have deleted the folder containing them, I should have done that when I changed the shortcuts.  :(
I spent 25 years training to be an eccentric then I woke up one morning and realised that I'd cracked it.
I've not had to try since.

I wonder what happens if I click on thi

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,640
    • View Profile
    • Donate to Member
Re: Turn a batch file into an AHK script.
« Reply #74 on: May 31, 2013, 07:34 AM »
v0.3.0.25
Changed: Logging disabled

You may pass it on to whoever wants to play with it, I'm in the process of rewriting it from scratch to get rid of all the hacky bits of code I tacked on as I went but otherwise it's not going to do anything different, (and it'll take a while).