Window Methods

master
Leonardo Domingues 2021-12-01 15:27:04 -03:00
parent 44f39c7c16
commit 0363cfc1bc
1 changed files with 62 additions and 0 deletions

View File

@ -303,6 +303,68 @@ func (c *Cli) NotifyBeep(msg, title string) error {
return err
}
/***************** Window Functions *****************/
func (c *Cli) WindowList(s string) error {
err := c.HttpCli().JsonGet("/ipc/window/list?s="+s, nil)
return err
}
func (c *Cli) WindowHwnd(s string) error {
err := c.HttpCli().JsonGet("/ipc/window/hwnd?s="+s, nil)
return err
}
func (c *Cli) WindowActivate(Hwnd string) error {
err := c.HttpCli().JsonGet("/ipc/window/activate?Hwnd="+Hwnd, nil)
return err
}
func (c *Cli) WindowClose(Hwnd string) error {
err := c.HttpCli().JsonGet("/ipc/window/close?Hwnd="+Hwnd, nil)
return err
}
func (c *Cli) WindowMax(Hwnd string) error {
err := c.HttpCli().JsonGet("/ipc/window/max?Hwnd="+Hwnd, nil)
return err
}
func (c *Cli) WindowMin(Hwnd string) error {
err := c.HttpCli().JsonGet("/ipc/window/min?Hwnd="+Hwnd, nil)
return err
}
func (c *Cli) WindowActiveHwnd() (ret interface{}, err error) {
err = c.HttpCli().JsonGet("/ipc/window/activehwnd", &ret)
return ret, err
}
func (c *Cli) WindowWaitActiveTitle(t string, m int) (ret interface{}, err error) {
err = c.HttpCli().JsonGet(fmt.Sprintf("/ipc/window/waitactivetitle?t=%s&m=%d", t, m), &ret)
return ret, err
}
func (c *Cli) WindowActiveTitle() (ret interface{}, err error) {
err = c.HttpCli().JsonGet("/ipc/window/activetitle", &ret)
return ret, err
}
func (c *Cli) WindowWinfo(w string) (ret interface{}, err error) {
err = c.HttpCli().JsonGet("/ipc/window/winfo?w="+w, &ret)
return ret, err
}
func (c *Cli) WindowSendMsg(w, m string) error {
err := c.HttpCli().JsonGet(fmt.Sprintf("/ipc/window/sendmsg?w=%s&m=%s", w, m), nil)
return err
}
func (c *Cli) WindowPostMsg(w, m string) error {
err := c.HttpCli().JsonGet(fmt.Sprintf("/ipc/window/postmsg?w=%s&m=%s", w, m), nil)
return err
}
func NewCli() *Cli {
ret := &Cli{ApiCli: api.NewApiCli()}
return ret