Page 1 of 10

Master script for NetStumbler 0.4 (Filter, MapPoint, Roadnav, Speech, DB, Log, more!)

PostPosted: Thu Sep 16, 2004 8:44 pm
by goldfndr
Attached is a refined version of my overhaul of the [thread=10364]MapPoint+Speech[/thread] script. I don't have MapPoint, so I'm unable to test with it, but so far it remains better (at least no worse) than the original's MapPoint-specific code. As time goes on, I hope to continue updating this message and attach further updates, moderators-willing.

If you're downloading from here, check for the last date - "ns04master.zip" should actually be named "20040918.zip". I'm keeping the old versions available in case anyone wants to perform comparisons.

Changes thus far:
  • Separated Mappoint, Speech, and settings into their own scripts, for easier maintenance.
    • Theoretically, you shouldn't have to overwrite the settings file, just keep it constant.
    • I might have introduced a bug; if so I apologize and will be happy to fix it. The speech code I heavily analyzed, but I don't have MapPoint so I wasn't able to do much scrutiny there.
    • If you don't want to use MapPoint functionality or Speech functionality, those parts of the code don't reside in memory. It might run slightly faster due to fewer checks, but there will be increased function call overhead.
    • I didn't separate the history, although I did change the dates to ISO-8601 (rather than some nationalistic schemes).
  • Localized variables, made constants where appropriate.
  • Optimized some flow logic, fixed some bugs.
  • Removed numerous comments that consisted solely of things like start of _____, end of _____ - is anyone actually lacking a diff utility?
  • Added DiGLE mapping; no need to have MapPoint folks have all the fun! Again, if you don't use it, it won't be in memory.
  • For speech, check NetStumbler folder for WAVs that match the strings, so you can have custom sound effects for things like "GPS Timeout", just have a "GPS Timeout.wav" and it should substitute automatically. It gets a list at startup (if speech is enabled), so disk activity is relatively minimized.
  • For speech, there's a bit of stub code that converts SSIDs (e.g. NETGEAR becomes netgear, ACTIONTEC becomes ActionTec).

    (New as of [post=93046]2004-09-18[/post], all files except DiGLE improved)
  • Added speed speech: if enabled, tells when speeding, going slowly, speed in preferred units with granularity for easier WAV matching, how often to say so. Avoids telling speed while actively detecting (gotta have priorities). Introduced many new options in the Settings file.
  • If you don't want to hear particular types (e.g. WEP-enabled peers) enunciated, you can substitute a particular string (e.g. "ns-aos-new" or " ") for effects or silence.
  • If NetStumbler doesn't detect that your GPS receiver doesn't have a fix (the Lat/Lon stay constant, e.g. DigiTraveler and some Deluo), this script will notify you.
  • Converted spaces to tabs, beautified, func-ified some duplicated code, optimized some code (e.g. bitwise AND's), no more script import dialogs.

    (New as of [post=96888]2004-10-30[/post], all files except DiGLE improved)
  • Split appended speech (AddWep/strYesWep/strNonWep) to separate pronunciation
  • Added option for speed callouts during scanning - if you are detecting APs, you might not want to hear the speed and wait to hear more APs or otherwise interfere with scanning
  • Added option to say speed as two numbers (e.g. "55" becomes "50", pause, "5"), better for WAVs
  • Added option for speech of null/empty SSIDs (so you don't completely miss them)
  • Added option to shorten some default SSIDs (currently just "Apple Network" and "2WIRE" - if there are others that have defaults that include part of the SSID, please post about it!)
  • Added option for a specific folder for WAVs - if you are using pregenerated ones, you could easily have over 60, polluting a program folder
  • Bugfix: check that custom icons actually exist before using
  • Bugfix: use pushpin set names rather than hardcoded names

    (New as of [post=98971]2004-11-24[/post], all files except MapPoint improved)
  • Threaded speech!!!
  • Bugfix: DiGLE didn't have OnGPSPosition call
  • Option to check for constant coordinates split out from the No GPS reporting option

    (New as of [post=126011]2005-06-30[/post], all files except DiGLE improved)
  • Use SCBLIB for sounds if available; any work-alikes?
  • Bugfix for bad WAV folder setting - if invalid, use script's folder
  • Bugfix for script location bug - locate the set of scripts wherever you'd like
  • Option for speaking directions after speed (if enabled)
  • Improve thread start/exit - alas, OnEnableScan and OnDisableScan are only for green triangle (as of 0.4.0)
  • Option to run thread forever, in case you're disabling/enabling scan (^B) for bad GPS unit
  • Flexible MapPoint centering, with code from ragmanii (untested)
  • More code optimization, cruft removal, and commentary

    (New as of [post=154283]2006-02-28[/post], all files except DiGLE and MapPoint improved)
  • Fix for fix for bad WAV folder setting - was still referring to WavFolder even if it didn't exist
  • Reverted MapPoint code (per TPEER) to not change parameters passed to Distance() function
  • Added really simple how-to instructions at the top of ns04master.vbs (for the tards)
  • Added UseDatabase (code based on [thread=18601]Chris H's[/thread])
  • UseDatabase can create a new database - note that Chris H's "DateTime" field is renamed to "DT"
  • UseThreading can use appended files as an alternative to registry keys
  • Added UseFiltering (get only the info you want or avoid cruft)
  • Added UseSubstation (code based on [thread=17773]Xarth's[/thread])
  • UseSubstation has reduced file size: styles, combined durations
  • UseDatabase can do a Position Summary or Individual Readings or both, and also GPS readings
  • More code optimization, cruft removal, and commentary

    (New as of [post=167656]2006-06-29[/post], all files improved)
  • Separated ns04master vs ns04events so events don't spend time checking disabled modules
  • Cleaned up MapPoint code - hopefully nothing got broken in the conversion
  • Module deactivation error dialogs formatted consistently (via DisableModule)
  • Fixed SSID cleanliness bugs in UseDatabase (thanks to valic's comment in posts 84 and 87)
  • UseThread can use SAPI.SpFileStream if SCBLIB is unavailable - arguably better than calling sndrec32
  • Added UseGPX (loosely[!] based on crschmidt's code)
  • UseGPX can append to an existing file and has track start/stop if GPS reception is lost
  • Added UseGPS setting, for those who will NEVER connect a GPS and don't want the overhead
  • More code optimization (global Lat/Lon/Alt, no unused args), cruft removal, and commentary

    (New as of [post=184798]2007-01-20[/post], most files improved)
  • Added UseLogging: Logging facility (record and playback)
  • Removed UseGPS setting - the GPS functions aren't called when GPS is disabled, nobody defended it
  • Modified DisableModule to bomb out if called with "Main" as the module
  • Added UseStatus (code inspired by [thread=8280]supadave's[/thread])
  • Added logMultiple for using multiple instances of NetStumbler (see instructions at top of ns04master.vbs; [thread=21863]NetStumbler 0.4 Helper[/thread] is recommended)
  • FormatMP from MapPoint becomes ReducedPrecision; fewer calls, only for text
  • Added UseRoadnav: Free realtime mapping of Detections and Crumb trail; best with 0.17 or later
  • Added Winsock code (using OstroSoft Winsock Component) so Roadnav 0.16 is sufficient (but not ideal)
  • BugFix for scripts running from path other than NetStumbler's (see posts [post=155486]80[/post],[post=155724]83[/post],[post=156917]96[/post])
    (New as of [post=185143]2007-01-25[/post], minor errata and...)
  • Check variable settings, make sure (to some extent) that they're valid
  • If ns04immed.vbs exists, read in when Scanning is enabled or disabled

To-do list:
  • More error checking (if needed).
  • Add support for more mapping programs. See ns04settings.vbs's Mapping section for some possibilities.

I've run it a lot (I'm now on WiGLE's top 10, although the rise above #35 is mostly due to Kismet), it was nice knowing when my DigiTraveler stopped sending updates (although now I use a Holux GPSlim236).

While it pays to have backups of data, after over 2100 downloads there have been few complaints.

Oh, these .ZIPs don't include any icons. I'm sure you can grab some from the [thread=10364]MapPoint+Speech thread[/thread].

If you want support for your mapping program, you MUST BE WILLING TO WORK FOR IT. Saying support of this or that would be nice - well, duh. On the positive side, ns04logger (introduced 2007-01) can be really helpful for testing.

Updated: [post=93046]2004-09-18[/post] ("ns04master", 13.8kB); previous (2004-09-16) had 16+2=18 views
Updated: [post=96888]2004-10-30[/post], new zip file (17.8kB) (removed after 500 downloads due to limit of five attachments, attached to [post=167656]post #100[/post])
Updated: [post=98971]2004-11-24[/post], new zip file (20.7kB); still haven't renamed old zip file (removed after 973 downloads due to limit of five attachments, attached to [post=184798]post #107[/post])
Updated: [post=126011]2005-06-30[/post], new zip file (24.8kB)
Updated: [post=154283]2006-02-28[/post], new zip file (32.4kB)
Updated: [post=167656]2006-06-29[/post], new zip file (37.4kB)
Updated: [post=184798]2007-01-20[/post], new zip file (46.7kB) (removed after 9 downloads due to five attachment limit and errata, attached to [post=185143]post #109[/post])
Updated: [post=185143]2007-01-25[/post], new zip file (48.7kB)

PostPosted: Thu Sep 16, 2004 10:55 pm
by wrzwaldo
Cool... Grabbed it and will drive it to work tomorrow!

PostPosted: Fri Sep 17, 2004 4:32 am
by seinman
I need to get a new laptop that doesn't make NS 0.4 crash every 15 to 20 minutes. Then I could finally try all these nifty ass scripts that people are writing. :( Anybody want to donate to the "by seinman a better laptop than the 150mhz crap he has now" fund?

PostPosted: Sat Sep 18, 2004 1:38 pm
by goldfndr
I've added more voice stuff: it will tell your current speed at predefined intervals, warns you if you're speeding; if you don't want to hear particular APs/peers, you can change them to a sound effect; cleanups.

Any other suggestions?

I think it's ready for use, but I don't have MapPoint so I can't test that aspect of it.

PostPosted: Sat Oct 09, 2004 6:01 pm
by Traversatech
Dumb question, but vbs file do I point NS to?

First post on forum..

PostPosted: Sat Oct 09, 2004 9:20 pm
by Casca
Hi all.

I downloaded the master script last night, and it worked very well on my setup. Crappy DWL-630 card, Mappoint 2004 and a Lowrance Airmap 100 GPS.

Mappoint 2002 Eu

PostPosted: Sun Oct 10, 2004 9:36 am
by radiodesign
Many thanks.

goldfndr wrote:I've added more voice stuff: it will tell your current speed at predefined intervals, warns you if you're speeding]

I was not getting speed info. However, I did not have much time to play so I need to double check everything. It may be operator error on my part! The GPS is an Oncore GT. It is sending GGA, GLL, RMC & VTG.

goldfndr wrote:I think it's ready for use, but I don't have MapPoint so I can't test that aspect of it.


On my quick run around the block, it worked fine. I am using Dell C810, Win2k SP4, speechsdk51 installed, Senao NL-2511-CD-EXT2 (Prism 2.5), Mappoint 2002 Europe (for UK).

slight problem...

PostPosted: Sun Oct 10, 2004 11:09 am
by Casca
If you set mappoint=True in the ns04settings.vbs and then load the ns04master.vbs script, you get scripting error...

An Error was reported in your script

Microsoft VBscript runtime error
Type mismatch: cSymbol1.symbol
Line: 1 Char: 1
SCode : 800A000D

If you just run the ns04mappoint.vbs script, the functionality seems to be there, without the speech enhancements or other niceties.

PostPosted: Wed Oct 13, 2004 6:27 pm
by goldfndr
Casca wrote:Type mismatch: cSymbol1.symbol
I doublechecked the code, and to me it looks right. I'm wondering if you didn't heed this line in the settings:
'Icons are branched off the script's folder

What you can do to check this is to edit ns04mappoint.vbs, and just above this line:
cSymbol1 = .Symbols.Add(nameDir & cSymbol1)
add this line:
MsgBox "I'm looking for a file named:" & vbCRLF & nameDir & cSymbol1
and that will show where it's looking.

If that still doesn't show the error then please declare your cSymbol1 setting.

Upon further analysis, it looks like the useCustIcon setting isn't being honoured - the custom icons are always added to MapPoint even if you don't want them. This code might work:
if useCustIcon then
if not FSO.FileExists(nameDir & cSymbol1) or not FSO.FileExists(nameDir & cSymbol2) or not FSO.FileExists(nameDir & cSymbol3) or not FSO.FileExists(nameDir & cSymbol4) then
useCustIcon = "Unable to find the following custom icons, disabling feature:"
if not FSO.FileExists(nameDir & cSymbol1) then useCustIcon = useCustIcon & vbCRLF & nameDir & cSymbol1
if not FSO.FileExists(nameDir & cSymbol2) then useCustIcon = useCustIcon & vbCRLF & nameDir & cSymbol2
if not FSO.FileExists(nameDir & cSymbol3) then useCustIcon = useCustIcon & vbCRLF & nameDir & cSymbol3
if not FSO.FileExists(nameDir & cSymbol4) then useCustIcon = useCustIcon & vbCRLF & nameDir & cSymbol4
MsgBox useCustIcon, vbCritical, nameScript
useCustIcon = False
else
...
end if
end if

after making useCustIcon a non-const (gee, that whole section is non-const-able!)

Can I blame Laidback? ;)

PostPosted: Wed Oct 13, 2004 6:31 pm
by goldfndr
radiodesign wrote:I was not getting speed info. However, I did not have much time to play so I need to double check everything. It may be operator error on my part! The GPS is an Oncore GT. It is sending GGA, GLL, RMC & VTG.
The 20040918 version disables speed-alerting while scanning - a bug. It was supposed to disable speed-alerting only when something was detected. Improved version will follow (hopefully tomorrow or Friday).

Thanks, all, for confirmation that MapPoint support wasn't broken completely!

I'll give the new code a try when I get off work tomorrow...

PostPosted: Wed Oct 13, 2004 7:36 pm
by Casca
Looks good from here. I read every line of code in all of the files, and it just didn't register in my brain I guess :-).

Couldn't wait until after work...

PostPosted: Thu Oct 14, 2004 5:07 am
by Casca
Made the changes this morning - that got it. Identified the missing files, works like a champ now.

PostPosted: Sat Oct 30, 2004 11:53 am
by goldfndr
I've finally submitted an update - lots of new speech capabilities. Also the custom icon fix. Filename is 20041030.zip. Enjoy!

Since this update allows splitting of the speed (albeit with a kludgy delay loop), you might find it worth your while to look for some pronounced numbers - a search for "19.wav" and "90.wav" finds a few sites. Or you could record your own, or you can generate some (I used AT&T's Lauren and Audrey to create over 30 for personal use; while others have uploaded derivatives elsewhere, I don't think the demo allows redistribution).

Several URLs for pregenerating WAVs are in the settings file. Of course, if you already have a sound effects library... :)

1030 version reports no GPS fix

PostPosted: Wed Nov 17, 2004 1:38 pm
by godrick
The 1030 version of the script reports "GPS Locked", but then gets into a "No GPS Fix" loop, even though Netstumbler reports a GPS position at the bottom of the screen, and the GPS Stat (SDV modded).zip version from the other thread works fine.

PostPosted: Thu Nov 18, 2004 1:24 am
by goldfndr
godrick wrote:The 1030 version of the script reports "GPS Locked", but then gets into a "No GPS Fix" loop, even though Netstumbler reports a GPS position at the bottom of the screen, and the GPS Stat (SDV modded).zip version from the other thread works fine.

One of the bullet items for this, introduced 2004-09-18, is:
goldfndr wrote:If NetStumbler doesn't detect that your GPS receiver doesn't have a fix (the Lat/Lon stay constant, e.g. DigiTraveler and some Deluo), this script will notify you.

The easiest way to check this is to note the lat/lon in the status bar, move away (100ft or 33m ought to be enough), and see if the lat/lon ever change. If there's a change then it's overly sensitive, and you should increase the appropriate variable (I don't remember which one). My DigiTraveler generally wanders a little bit over time, but if yours has an actual lock without ever wandering (also can be tested in other apps, e.g. VisualGPS), more power to you.

It's a good thing to know, because if your GPS isn't accurate you'll screw up your stats/maps (and anyone to whom you send your logs), and it might be preferable to turn off detection/logging when this occurs. What receiver do you have? I'm guessing it gives non-zero coordinates before it actually has a fix, and it seems that NetStumbler might only being paying attention to zero coordinates or dead silence for evidence of a lack of fix.