Showing posts with label moveStart. Show all posts
Showing posts with label moveStart. Show all posts

Tuesday, October 11, 2011

How To Get Cursor Position From WebEdit

The below snippet can be used to get the cursor position from WebEdit
Dim oPage:Set oPage=Browser("name:=Google").Page("title:=Google")
Dim oSel:Set oSel=oPage.Object.Selection.createRange
Dim oWebEdit:Set oWebEdit=oPage.WebEdit("name:=q").Object

oSel.moveStart "character",-Len(oWebEdit.value)

Msgbox Len(oSel.text)'Here you will get the cursor position.

Set oPage=Nothing
Set oSel=Nothing
Set oWebEdit=Nothing