3

I am transferring a large file of about 500MB using bluetooth from one system to another. During this time I will get a balloon popup window saying "Bluetooth Connection" having a text that the mode has changed to high speed mode. I want to get this text in a variable using python. Any clue about how to read text from balloon popups???

Hope to get a reply asap.

Regards Sim

halex
  • 16,253
  • 5
  • 58
  • 67
  • hwat is you use? linux windows? what is balloon? – Mohammad Efazati Aug 02 '12 at 06:54
  • i think windows stores information about those balloon popups temporarily in some internal file, but i doubt you would have read permissions, maybe try a different approach? like perhaps checking the bluetooth program itself for any files or temps that inform of the functionality, maybe hook onto the process of the bluetooth? – Inbar Rose Aug 02 '12 at 07:04

1 Answers1

5

I combined posts of here and here to write the following example for you.

You need Python for Windows extensions which you can download here.

You can get the classname (you need it for the function win32gui.FindWindow) of your balloon tip, with the tool Spy++.

import win32gui, win32con

def get_text(hwnd):
    buf_size = 1 + win32gui.SendMessage(hwnd, win32con.WM_GETTEXTLENGTH, 0, 0)
    buffer = win32gui.PyMakeBuffer(buf_size)
    win32gui.SendMessage(hwnd, win32con.WM_GETTEXT, buf_size, buffer)
    return buffer[:buf_size]

if __name__ == "__main__":
    hwnd = win32gui.FindWindow("tooltips_class32", 0)
    content_of_balloon_tip = get_text(hwnd)
    print content_of_balloon_tip
evandrix
  • 6,041
  • 4
  • 27
  • 38
halex
  • 16,253
  • 5
  • 58
  • 67