[Solved] Sending CTRL+F to Chrome is working intermittently

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
ocnuybear
Pro Scripter
Posts: 100
Joined: Sun Jul 15, 2018 5:14 pm

[Solved] Sending CTRL+F to Chrome is working intermittently

Post by ocnuybear » Thu Aug 02, 2018 9:01 am

I'm trying to send CTRL+F keys to Chrome to do a find on page and sometimes it works, sometimes not.

Setting Let>SK_DELAY=100 is not making any difference

Could this be a timing issue between the keys?

Code: Select all

Let>SK_DELAY=100
GetWindowHandle> - Google Chrome*,hWndParent
SetFocus> - Google Chrome*
FindObject>hWndParent,Chrome_RenderWidgetHostHWND,,1,hWnd,X1,Y1,X2,Y2,result
ObjectSendKeys>hWnd,CTRL_DN,VK70,CTRL_UP
Last edited by ocnuybear on Thu Aug 02, 2018 9:19 am, edited 1 time in total.

ocnuybear
Pro Scripter
Posts: 100
Joined: Sun Jul 15, 2018 5:14 pm

Re: Sending CTRL+F to Chrome is working intermittently

Post by ocnuybear » Thu Aug 02, 2018 9:18 am

Just solved it by using Idiot's Script and just inserting Send>F between the CTRL press & releases and it now works 100% of the time :D

Thank you Idiot :D

Code: Select all

setfocus> - Google Chrome*
Let>VK_control=17
Let>ExtendedKey=1
Let>KeyUp=2
Press ctrl
LibFunc>user32.dll,keybd_event,r,VK_control,0,ExtendedKey,0
Wait>0.1
Send>f
Release ctrl
Let>FLAGS={%ExtendedKey% OR %KeyUp%}
LibFunc>user32.dll,keybd_event,r,VK_control,0,FLAGS,0

ocnuybear
Pro Scripter
Posts: 100
Joined: Sun Jul 15, 2018 5:14 pm

Re: [Solved] Sending CTRL+F to Chrome is working intermittently

Post by ocnuybear » Thu Aug 02, 2018 9:25 am

Seems like the Wait>0.1 is not playing any role here, script works consistently without it,

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts