lagr
#1
This code returns an integer
tell application "Google Chrome" to count tabs of front window
can you somehow use that - as a oneliner, without temporary variables - in an if-statement? Something like
if ((tell application "Google Chrome" to count tabs of front window ) = 1) then
?
Krioni
#2
Try this (not tested):
if (count tabs of front window of application "Google Chrome" ) is 1 then
-- do your thing
end if
lagr
#3
It compiles but fails:
error "Google Chrome got an error: Can’t make |tabs| of window 1 into type specifier." number -1700 from |tabs| of window 1 to specifier
Any ideas?
lagr
#4
count windows of application "Google Chrome"
works!?
Tell to IF:
tell application "Safari" to if (count tabs of front window) = 1 then say "Hello"
2 Likes
lagr
#6
ChatGPT suggested
tell application "Google Chrome" to tell front window to if (count tabs) = 2 then
Seems to work.
This is the same as what I suggested. Written by a robot in a different form.
It might be that snippets without the required tells are failing.