Accessing IE windows
I am trying to access a page on an IE rum electronic medical record. I wish to format, print, and edit in a free field text (?edit) box. I would like to get access, but do not have the COM skills needed. any advice would be appreciated.
Below is a portion of what does not work.
# Text Selection 0811009 2150
#
# Python Macro Language for Dragon NaturallySpeaking
# (c) Copyright 1999 by Joel Gould
# Portions (c) Copyright 1999 by Dragon Systems, Inc.
#
import natlink
natut = __import__('natlinkutils')
import win32ui, win32com, win32con, commctrl, win32api, traceback
import pythoncom
ancestor = natut.GrammarBase
class ThisGrammar(ancestor):
gramSpec = """
exported = select text;
"""
def initialize(self):
self.load(self.gramSpec)
self.iexplore = win32com.client.dynamic.Dispatch("InternetExplorer.Application")
self.activateAll()
def gotBegin(self,moduleInfo):
pass
def gotResults_selectText(self, words, fullResults):
natlink.playString('selectText rule caught... ')
## I HAVE TRIED ALL OF THE BELOW TO RETRIEVE TEXT WITHOUT SUCCESS
#text = self.iexplore.Document.body.innerHTML
#text = self.iexplore.Document.body
#text = self.iexplore.Document
#text is in unicode, so get it into a string
#text = unicode(text)
thisGrammar = ThisGrammar()
thisGrammar.initialize()
def unload():
global thisGrammar
if thisGrammar:
thisGrammar.unload()
thisGrammar = None
