fix: find console window
This commit is contained in:
parent
e0fddf6b59
commit
d0b7427efd
1 changed files with 33 additions and 15 deletions
18
vvin.go
18
vvin.go
|
@ -48,6 +48,22 @@ func (c *globalCmd) Before() error {
|
|||
}
|
||||
|
||||
an := ancestors()
|
||||
|
||||
if c.Target == "" {
|
||||
loopConsole:
|
||||
for _, p := range an {
|
||||
for _, w := range wins {
|
||||
if w.PID == p {
|
||||
if c.Debug {
|
||||
rog.Printf("win: %#v", w)
|
||||
}
|
||||
|
||||
c.targetHandle = w.Handle
|
||||
break loopConsole
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
t := strings.ToLower(c.Target)
|
||||
|
||||
for _, w := range wins {
|
||||
|
@ -62,6 +78,7 @@ func (c *globalCmd) Before() error {
|
|||
if c.Debug {
|
||||
rog.Printf("win: %#v (ancestor? %v)", w, ancestor)
|
||||
}
|
||||
|
||||
if t != "" && !ancestor {
|
||||
wt := strings.ToLower(w.Title)
|
||||
|
||||
|
@ -74,6 +91,7 @@ func (c *globalCmd) Before() error {
|
|||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if c.targetHandle == 0 {
|
||||
return errors.New("no target")
|
||||
|
|
Loading…
Reference in a new issue