Add sleep to code

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Rooie
Posts: 2
Joined: 12 Feb 2019, 04:26

Add sleep to code

12 Feb 2019, 04:32

Hi all

With help from old posts on the old forum i succeeded in creating a small script that opens a certain set of websites that I want to open on regular basis.

Code: Select all

^#k::
	links =
(
url1.url
url2.url
url3.url
)
	While Pos:=RegExMatch(links,"`am)^(?<link>h\w{3}:.*?)$",_,!Pos?1:StrLen(_)+Pos)
    Run % _link
Return
However, the actual list of websites that I would like to open is pretty large. It consists of like 50+ websites, so if i run this command it just wants to open them in one go.
I have been trying to add like a sleep command in between but as I dont understand this code really, I dont know how to add a certain amount of time in between opening each url.

I think its fairly easy but I really can't seem to figure out how, please help :)

Thanks!
Rohwedder
Posts: 7683
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Add sleep to code

12 Feb 2019, 04:39

Hallo,
try:

Code: Select all

^#k::
	links =
(
url1.url
url2.url
url3.url
)
	While Pos:=RegExMatch(links,"`am)^(?<link>h\w{3}:.*?)$",_,!Pos?1:StrLen(_)+Pos)
	{
		Run % _link
		Sleep, 1000
	}
Return
Rooie
Posts: 2
Joined: 12 Feb 2019, 04:26

Re: Add sleep to code

12 Feb 2019, 06:11

That seems to have done the trick, thanks a lot!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Descolada, Google [Bot], ScooberDiver and 125 guests