I can reproduce this error.
set theList to ( processes whose frontmost is true )
log ( get id of item 1 of theList )
and
set frontApp to first process whose frontmost is true
log ( get id of frontApp)
gives different results then
repeat with theProcess in processes whose frontmost is true
set frontApp to theProcess
end repeat
log ( get id of frontApp )
when multiple applications (i.e. VSCode and another electron app) are both running.
Topic:
App & System Services
SubTopic:
Automation & Scripting
Tags: