ComObjCreate how read out this

Get help with using AutoHotkey and its commands and hotkeys
tm6464
Posts: 47
Joined: 17 Jul 2017, 22:56

ComObjCreate how read out this

02 Feb 2020, 04:20

Hello everyone

On a website there are two posible stats and i wanna check if there is currenty red or green
red
Image
green
Image

Code: Select all

status := % wb.document.getElementsByClassName("info-crc").text
tooltip, %status%
Sleep, 10000
If status = red
{
tooltip, red
Sleep, 10000
return
}
If status = green
{
tooltip, green
Sleep, 10000
return
}
User avatar
TLM
Posts: 1582
Joined: 01 Oct 2013, 07:52
GitHub: TLMcode
Contact:

Re: ComObjCreate how read out this

02 Feb 2020, 14:07

Try changing the conditional statements to: If InStr( status, "red" ) and If InStr( status, "green" ).
Instr() will check if either words reside within status.

Also remove the % from status like this: status := wb.document.getElementsByClassName("info-crc").text
teadrinker
Posts: 1495
Joined: 29 Mar 2015, 09:41
Contact:

Re: ComObjCreate how read out this

02 Feb 2020, 14:59

getElementsByClassName returns an array-like object, in addition in pure js elements don't have a "text" property. So must be status := wb.document.getElementsByClassName("info-crc")[0].innerText. Perhaps [0] needs to be changed to [1] or [2] and so on, depending on the number of elements with className "info-crc".

Return to “Ask For Help”

Who is online

Users browsing this forum: AHKStudent, Albireo, Bing [Bot], boiler, michelxd15, Odlanir, sirksel, vsub and 135 guests