Sign in to follow this  
Followers 0
fmen

WinGetCaretPos ( )

3 posts in this topic

#1 ·  Posted (edited)

WinGetCaretPos ( ) does not work with Firefox. Regardless of the real position of the caret, it always returns x, y as being at the left upper corner of the browser.

Does anyone have any ideas on a workaround? Thanks.

Edited by fmen

Share this post


Link to post
Share on other sites



Bump.....

OK, what I am trying to do is to automate sending an attachment via Yahoo Mail.

The problem is in pressing the "Attach File" button without using the MouseClick coordinates since the coordinates will vary depending on the browser (Firefox) position, ie maximized vs smaller window size.

I thought that if I could get the caret position, it could universalize the Mouseclick to work for any browser position.

Here's my script:

Opt("SendKeyDelay", 0)

Opt("WinTitleMatchMode", 2)

Winactivate("Firefox")

send('!dhttp://us.f526.mail.yahoo.com/ym/Compose?login=1&To=&intl=us&.intl={enter}')

Call ('HourGlass')

Sleep (1000)

Send ("myemailaddress{Enter}{tab}Attached File{tab}Here is the attached file")

$pos = WinGetCaretPos ( )

MouseClick ("left", $pos[0] + 50, $pos[1] + 94,1, 0); This is the line that would univeralize the Attach File button position

Send ('{tab}{enter}')

Sleep (1000)

MouseClick ("Left", 787, 233)

Send ("{tab 3}{Enter}")

Sleep (1000)

Send ('{tab 4}{Down}{PgUP}{Down}{enter}')

Func HourGlass()

Do

Sleep(10)

Until MouseGetCursor()= 2

EndFunc

Unfortunately, WinGetCaretPos ( ) does not work with multiple mdi windows and returns an erroneous position. There has got to be a workaround. Right?

Share this post


Link to post
Share on other sites

Unfortunately, WinGetCaretPos ( ) does not work with multiple mdi windows and returns an erroneous position. There has got to be a workaround. Right?

From the help of WinGetCaretPos()

"WinGetCaretPos might not return accurate values for Multiple Document Interface (MDI) applications if absolute CaretCoordMode is used. See example for a workaround. Note: Some applications report static coordinates regardless of caret position!"

See the example code of WinGetCaretPos() in the help file.

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0