Refreshing networks

Post Reply
User avatar
ACalcutt
Vistumbler / TechIdiots Admin
Vistumbler / TechIdiots Admin
Posts: 1164
Joined: Sun Oct 21, 2007 6:50 pm
Location: Rutland, MA
Contact:

Refreshing networks

Post by ACalcutt » Mon Nov 12, 2007 2:23 pm

I noticed on my friends laptop that vistumbler wasn't finding networks that good, but if i clicked the refresh button on the "Connect to network window" that it would find new access points.

I have created this script that just keeps clicking the refresh button on the connect to window. This should help make vistumbler results more accurate.

I am looking for a better way of doing this without the connect to gui, but for now here is my test script.

*Note* this is made for US-english, so window titles may need to be changed to have this work in another language. To change edit refreshnetworks.ini.

Code: Select all

#include <GUIConstants.au3>
$setings = "refreshnetworks.ini"
$ConnectToWindowName = IniRead($setings, "Settings", "ConnectToWindowName", "Connect to a network")
$ConnectToButton = IniRead($setings, "Settings", "ConnectToButton", "Button4")

Dim $Running = 0
Dim $timer = TimerInit()

$Form1 = GUICreate("Refresh Networks", 138, 106, -1, -1)
$Start = GUICtrlCreateButton("Start", 8, 8, 121, 25, 0)
$Time = GUICtrlCreateInput("5000", 8, 40, 121, 21)
$Exit = GUICtrlCreateButton("Exit", 8, 72, 121, 25, 0)
GUISetState(@SW_SHOW)

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
		Case $Exit
			Exit
		Case $Start
			If $Running = 1 Then
				$Running = 0
				GUICtrlSetData($Start, "Start")
				WinClose ($ConnectToWindowName)
			Else
				$Running = 1
				GUICtrlSetData($Start, "Stop")
				Run("RunDll32.exe van.dll,RunVAN")
				$timer = TimerInit()
			EndIf
	EndSwitch
	
	If $Running = 1 And TimerDiff($timer) >= GUICtrlRead($Time) And WinExists($ConnectToWindowName) Then
		;WinSetState ("Connect to a network", "", @SW_HIDE)
		$c = ControlClick($ConnectToWindowName, "", $ConnectToButton)
		If $c <> 1 Then MsgBox(0, "error", "error")
		$timer = TimerInit()
	EndIf
		
WEnd

Attachments
RefreshNetworks.zip
(320.75 KiB) Downloaded 304 times

User avatar
ACalcutt
Vistumbler / TechIdiots Admin
Vistumbler / TechIdiots Admin
Posts: 1164
Joined: Sun Oct 21, 2007 6:50 pm
Location: Rutland, MA
Contact:

Post by ACalcutt » Tue Nov 13, 2007 1:07 pm

If anyone finds a way to refresh the networks without the GUI please let me know. (like by dll call or command)

grantusmaximus
Junior Member
Posts: 6
Joined: Tue Nov 27, 2007 12:37 am
Contact:

Post by grantusmaximus » Tue Nov 27, 2007 1:55 am

Ahhh this is the problem I was encountering (see post in bugs)! Glad I'm not the only one... I'm running Vista ultimate that came with a new laptop I purchased a few weeks ago with latest patches.. Supprised more people aren't noticing it - wonder what the difference with my setup is...

Will try track down a solution!! Cause its frustrating me ;)

grantusmaximus
Junior Member
Posts: 6
Joined: Tue Nov 27, 2007 12:37 am
Contact:

Post by grantusmaximus » Tue Nov 27, 2007 2:00 am

Seems this isn't the only project which has encountered this flaw with netsh..

http://www.codeproject.com/gadgets/Wifi ... 1284&exp=0

grantusmaximus
Junior Member
Posts: 6
Joined: Tue Nov 27, 2007 12:37 am
Contact:

Post by grantusmaximus » Tue Nov 27, 2007 3:12 am

Does this help... Briefly scanning the net it appears the WLAN Autoconfig Service is what is responsible for periodically checking for networks. Also known as WZC Wireless Zero Configuration http://en.wikipedia.org/wiki/Wireless_Z ... figuration...

Apparently (if I read correctly) this service presents the Native Wifi API or uses it?

http://msdn2.microsoft.com/en-us/library/ms706556.aspx

Which has a WlanScan function which actually does the scan i think, as appose to WlanGetAvailableNetworkList which sounds like it does what netsh does for you....

http://msdn2.microsoft.com/en-us/library/ms706783.aspx

Hope this information helps!

User avatar
ACalcutt
Vistumbler / TechIdiots Admin
Vistumbler / TechIdiots Admin
Posts: 1164
Joined: Sun Oct 21, 2007 6:50 pm
Location: Rutland, MA
Contact:

Post by ACalcutt » Tue Nov 27, 2007 10:07 am

I have looked at the Wifi API before but I am unsure how to use it in AutoIt. This is the direction I would like to go. I am hoping someone comes along with a little more knowlege on using this API

User avatar
ACalcutt
Vistumbler / TechIdiots Admin
Vistumbler / TechIdiots Admin
Posts: 1164
Joined: Sun Oct 21, 2007 6:50 pm
Location: Rutland, MA
Contact:

Post by ACalcutt » Tue Nov 27, 2007 10:14 am

Originally posted by grantusmaximus
Ahhh this is the problem I was encountering (see post in bugs)! Glad I'm not the only one... I'm running Vista ultimate that came with a new laptop I purchased a few weeks ago with latest patches.. Supprised more people aren't noticing it - wonder what the difference with my setup is...

Will try track down a solution!! Cause its frustrating me ;)
This problem seems to be very network card specific. My network card (Intel 3945ABG) seems to work very well with vistumbler (using microsoft drivers). My friend has a "Dell" branded network card and he has the same problem as you.

I created the refresh script in this post after using my friends laptop and noticing how little APs he was finding.

grantusmaximus
Junior Member
Posts: 6
Joined: Tue Nov 27, 2007 12:37 am
Contact:

Post by grantusmaximus » Tue Nov 27, 2007 7:20 pm

Unfortunately I'm a web application developer by trade otherwise I'd be contributing (happy to if you have some cool ideas in this space..)! I really like your project and wifi has always been an area of interest for me... I just check out AutoIt for the first time and it looks pretty cool... Now to find some time to play with it ;)

After my numerous posts yesterday it struck me why I might have been having problems and not other people... It was so blindly obvious, in the end you'll kick yourself as well... So I tested it on my bus road home and in going the same route I picked up 600 AP's as appose to 60...

Ever wondered what putting Vista on the Power Saver plan does to conserve power? Well.. it turns out that WLAN Autoconfig Service does scans a lot less frequently!!! Hence netsh continues to report the available networks from the last scan run AGES ago ;)

SOLUTION - DON'T USER POWER SAVER PLAN..

This doesn't however solve the problem of AP's not dropping out as quickly as expected.. It appears there is a 'feature' in the netsh wlan show networks.. it continues to report networks that are long since gone.

I imagine it does this just incase you're just out of range, so just because it didn't return a response in the last couple of scans it 'could' still there... But probably not if you're doing 60 on a bus like me.. Hehe

The problem with this is it also continues to report the last known signal even though I'm in the next suburb and it clearly hasn't received a response from the AP in awhile ;) Hehe..

This can then screw with the GPS location as I noticed one returned a good signal and then continued to return this same signal for ages (presumably an example of the above case) so the location kept updating as I traveled further and further away..

I'll have a play with AutoIt on the weekend and see how I go.. Keen to help you out with this project :)

grantusmaximus
Junior Member
Posts: 6
Joined: Tue Nov 27, 2007 12:37 am
Contact:

Post by grantusmaximus » Tue Nov 27, 2007 7:46 pm

Hi Andrew - Did some research and came across this post...

http://www.autoitscript.com/forum/index ... opic=42219

The guy with the question is using an alternate wifi dll... the guy with the response with using the microsoft one! Looks like some good code examples...

Hope this help! Grant

User avatar
ACalcutt
Vistumbler / TechIdiots Admin
Vistumbler / TechIdiots Admin
Posts: 1164
Joined: Sun Oct 21, 2007 6:50 pm
Location: Rutland, MA
Contact:

Post by ACalcutt » Tue Nov 27, 2007 8:08 pm

Originally posted by grantusmaximus
After my numerous posts yesterday it struck me why I might have been having problems and not other people... It was so blindly obvious, in the end you'll kick yourself as well... So I tested it on my bus road home and in going the same route I picked up 600 AP's as appose to 60...

Ever wondered what putting Vista on the Power Saver plan does to conserve power? Well.. it turns out that WLAN Autoconfig Service does scans a lot less frequently!!! Hence netsh continues to report the available networks from the last scan run AGES ago ;)

SOLUTION - DON'T USER POWER SAVER PLAN..
Thank you for the information on the power saving problem. I was not aware of it.
Originally posted by grantusmaximus

This doesn't however solve the problem of AP's not dropping out as quickly as expected.. It appears there is a 'feature' in the netsh wlan show networks.. it continues to report networks that are long since gone.

I imagine it does this just incase you're just out of range, so just because it didn't return a response in the last couple of scans it 'could' still there... But probably not if you're doing 60 on a bus like me.. Hehe

The problem with this is it also continues to report the last known signal even though I'm in the next suburb and it clearly hasn't received a response from the AP in awhile ;) Hehe..
Have you tried the refresh script above? That should make the APs drop when they are out of range. its kinda a shitty way to attack the problem, but it does work
This can then screw with the GPS location as I noticed one returned a good signal and then continued to return this same signal for ages (presumably an example of the above case) so the location kept updating as I traveled further and further away..
Unless I messed something up in the latest version, the GPS should not change once it gets a location (i did this because of the AP staying active longer than it actually should). I figured first seen was a more acurate GPS position.
I'll have a play with AutoIt on the weekend and see how I go.. Keen to help you out with this project :)
AutoIt is a cool scripting language, all the functions are documneted well in its help file. And most people are very helpful on the AutoIt forum

User avatar
ACalcutt
Vistumbler / TechIdiots Admin
Vistumbler / TechIdiots Admin
Posts: 1164
Joined: Sun Oct 21, 2007 6:50 pm
Location: Rutland, MA
Contact:

Post by ACalcutt » Wed Nov 28, 2007 2:18 pm

Originally posted by grantusmaximus
Hi Andrew - Did some research and came across this post...

http://www.autoitscript.com/forum/index ... opic=42219

The guy with the question is using an alternate wifi dll... the guy with the response with using the microsoft one! Looks like some good code examples...

Hope this help! Grant
Looks interesting. I could probrably use that except it is not freeware. The DLL is only a 30 day trial and it gives a nag prompt on every use. To bad :-(.

It would cost $199 for me to get a developers licence and be able to distibute it and not get nag screens. Maybe we could try to raise some funds. I don't make any money off this site (ads are basically useless) so I don't really want to eat the cost. Another idea would be to make a Pro version that costs like $5-$10 with the better scanning feature, that way if i did pay the money up front i could get it back.

rsimpson
Junior Member
Posts: 3
Joined: Sat Jan 19, 2008 4:17 pm

Post by rsimpson » Mon Jan 21, 2008 1:47 am

How many people could put in a few bucks for this. If enough people chip in would you do it.
You have access to my email so let me know what you would need.

Thanks
Robert

User avatar
ACalcutt
Vistumbler / TechIdiots Admin
Vistumbler / TechIdiots Admin
Posts: 1164
Joined: Sun Oct 21, 2007 6:50 pm
Location: Rutland, MA
Contact:

Post by ACalcutt » Mon Jan 21, 2008 11:23 am

I can attemp to make a test version during the 30 day trial. I don't think it will be this week, but i will try.

The only issue is this Native Wifi does not give all the information vistumbler currently gets from netsh.

Post Reply