View Single Post
Old 10-11-2006   #6 (permalink)
quhaha
Registered Member
 
Join Date: Oct 2006
Posts: 5
Quote:
Originally Posted by Thorn
It's the "winsound" library.

Google "Python playsound" and "Python playsound winsound", and you hsould find plenty of references.
Thanks!!!

Now, I can do stuff like:
Code:
import winsound
import easygui

easygui.msgbox('lol')
winsound.PlaySound("ns-signal-1.wav", winsound.SND_FILENAME)
easygui is from : http://ferg.org/easygui/ (simple Tkinter routines)

If I run above, it displays a message box and when I close it, it plays sound (easygui.msgbox probably has a loop).

So far so good.

Now, I want to try OnScalResult:
First, using JScript:
Code:
function OnScanResult(SSID,BSSID,CapFlags,Signal,Noise,LastSeen) {
	PlaySound("ns-signal-1.wav");
}
If I run above, it plays periodic sound, whenever scan is done.

Now, onto Python:
Code:
import winsound

def OnScanResult(SSID,BSSID,CapFlags,Signal,Noise,LastSeen):
    winsound.PlaySound("ns-signal-1.wav", winsound.SND_FILENAME)
Now, the script doesn't even run (when I click Apply, it shows Not Running).

Do I have to put OnScanResult to some specific module??

I don't know why JScript version works but not Python version...
Ok, to make Python version really identical to JScript version, I did:
Code:
import winsound
def PlaySound(name):
    winsound.PlaySound(name, winsound.SND_FILENAME)

def OnScanResult(SSID,BSSID,CapFlags,Signal,Noise,LastSeen):
    PlaySound("ns-signal-1.wav")
Still, NetStumbler doesn't seem to call OnScanResult...
Help.
Thanks.


-edit
Better yet, if there is a documentation that describes how netstumbler calls those functions..etc will be awesome!!!!!!

Last edited by quhaha : 10-11-2006 at 07:46 AM.
quhaha is offline   Reply With Quote