can Loop help repeated "Send" more steady

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
AmDeG 11
Posts: 388
Joined: 28 Nov 2013, 11:42

can Loop help repeated "Send" more steady

09 Dec 2018, 13:52

I need to open a website but Sending 17 times Tab not always brings me to the place where I want

Using "Loop" can solve my problem?

Code: Select all

#IfWinActive dictionary ahk_class IEFrame
 !d::   
        Sleep 500
        Send {Tab 17}
        Return
#IfWinActive
User avatar
Scr1pter
Posts: 1272
Joined: 06 Aug 2017, 08:21
Location: Germany

Re: can Loop help repeated "Send" more steady

09 Dec 2018, 19:50

Eh, I don't think Loop will solve that problem.
Where should be the difference between

Code: Select all

Send {Tab 17}
and

Code: Select all

Loop, 17
{
  Send {Tab}
}
?

I believe it doesn't work always because the website wasn't completely loaded.
Increase your sleep time.
Safest would be to test if the site was loaded completely.
(E.g. ImageSearching the icon which indicates the loading status.)

Regards
Please use [code][/code] when posting code!
Keyboard: Logitech G PRO - Mouse: Logitech G502 LS - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.33.09
neokix
Posts: 36
Joined: 10 May 2017, 07:50
Contact:

Re: can Loop help repeated "Send" more steady

10 Dec 2018, 00:37

Sometimes putting "Sleep" between each keypress solved problems (at least for me).
So it's like this.

Code: Select all

Loop, 17
{
  Send {Tab}
  Sleep, 100 ;or 200 or 300 or 500 depending on programs
}
But Scr1pter-san can be right. I'm not sure. Just have a try and let us know how it goes. ;)
hymal7
Posts: 66
Joined: 14 Sep 2016, 05:37

Re: can Loop help repeated "Send" more steady

10 Dec 2018, 04:49

when you open a site on the browser, the cursor doesnt guarantee that it always lands on the same place everytime.
so you can write a code at the start of your script that clicks a specific location.

Code: Select all

Mouseclick, left, x,y
User avatar
Scr1pter
Posts: 1272
Joined: 06 Aug 2017, 08:21
Location: Germany

Re: can Loop help repeated "Send" more steady

10 Dec 2018, 12:55

@neokix:
Yes, if his device is not really fast, probably a sleep time within the loop might be useful.
I'm also a friend of sleep times (at least in coding) :D

@hymal7:
Yeah, would be useful to know which site he's talking about.
Maybe there is really some "dynamic" there.

Regards
Please use [code][/code] when posting code!
Keyboard: Logitech G PRO - Mouse: Logitech G502 LS - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.33.09
User avatar
Nextron
Posts: 1391
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win10 AHK: Unicode x32

Re: can Loop help repeated "Send" more steady

10 Dec 2018, 13:06

To target browser elements, I usually send ^f///' to search for the matching (or nearest selectable) text/link.
AmDeG 11
Posts: 388
Joined: 28 Nov 2013, 11:42

Re: can Loop help repeated "Send" more steady

11 Dec 2018, 13:48

I realized that my problem MAY be solved if the machine opens the http slower

how can I do that?
User avatar
Scr1pter
Posts: 1272
Joined: 06 Aug 2017, 08:21
Location: Germany

Re: can Loop help repeated "Send" more steady

11 Dec 2018, 14:52

Opening the site slower?
Can you please list the steps you do?
It's always meaningless if we have to guess how it can be.

Just list the steps, like:
- opening browser (manually)
- running a site (keypress script)
- running the ahk script to make tab 17

Write what you do.
Please use [code][/code] when posting code!
Keyboard: Logitech G PRO - Mouse: Logitech G502 LS - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.33.09
hymal7
Posts: 66
Joined: 14 Sep 2016, 05:37

Re: can Loop help repeated "Send" more steady

12 Dec 2018, 05:09

in that case, you could delay the start of your code by a few seconds after the browser is loaded

add this to the start of your code:

sleep, 5000 ;waits 5 seconds before launching the next script lines

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: FanaticGuru, filipemb, Google [Bot] and 305 guests