Opening web site according to my order Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Ebs
Posts: 2
Joined: 21 Aug 2019, 06:18

Opening web site according to my order

21 Aug 2019, 06:26

I have a list of websites I have to open and check at work, I'm a beginner to ahk, so I took a acript from someone else on the forum (forgot who so can't credit). The script works perfectly, but the sites open in a random order, rather than the order I've written in the code.

I can't giveaway the sites, as they're private business, but I do have a example of the code:

sites:="site a|site b|site c|site d"
Loop, Parse, sites, |
if A_Index = 1
Run chrome.exe ℅A_LoopField℅
if A_Index = 0
Run chrome.exe -new-tab ℅A_LoopField℅
The sites' order is very random, like: bcad, and then dbac etc.
All I need is that the order goes like abcd.
Thanks in advance!
User avatar
Sir Teddy the First
Posts: 94
Joined: 05 Aug 2019, 12:31
Contact:

Re: Opening web site according to my order  Topic is solved

21 Aug 2019, 09:38

Hi,
first of all you probably need to insert a Sleep command after each tab, because your browser has to register what you are doing first and the response time will vary depending on the website's response time.

Second, what exactly does "If A_Index = 0" mean?
"A_Index" will never be "0" inside a loop, only outside, so what do you expect this command to do?

This should work:

Code: Select all

sites:="site a|site b|site c|site d"

Loop, Parse, sites, |
{
	if (A_Index = 1)
		Run chrome.exe %A_LoopField%
	else
		Run chrome.exe -new-tab %A_LoopField%
	Sleep 350
}
:eh: :think:
Ebs
Posts: 2
Joined: 21 Aug 2019, 06:18

Re: Opening web site according to my order

21 Aug 2019, 14:17

You don't know how much I want to thank you! It's such a easy solution, just needed to figure out what I was doing wrong.

As for the A_Index = 0 , I meant with it something like: "if chrome is not on", however I didn't realise it has no point using it in a loop :lol:
Thanks again for helping!
garry
Posts: 3760
Joined: 22 Dec 2013, 12:50

Re: Opening web site according to my order

21 Aug 2019, 15:13

script to check if program already running ( here firefox , errorlevel=0 not running )

Code: Select all

#warn
#NoEnv
#SingleInstance Force
setworkingdir,%a_scriptdir%
process, exist,firefox.exe
status2 = %ErrorLevel%
if (status2<>0)       
 msgbox,FIREFOX = YES running
else
 msgbox,FIREFOX = NOT runnig
return
Getfree
Posts: 231
Joined: 12 Oct 2014, 18:00

Re: Opening web site according to my order

28 Aug 2019, 09:36

It would be much easier to just put those sites in a bookmark folder and then click with middle button on that folder to open all sites in the specified order.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Exies, Google [Bot], hiahkforum, scriptor2016 and 116 guests